summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-07-04 15:13:53 -0500
committerLuke Kanies <luke@madstop.com>2008-07-04 15:13:53 -0500
commita37a7845073ef0b0923549364cbac5e0e39e3194 (patch)
treefc063d12fb973ca3373d495ee824ba96b75d3bdb /spec
parent31ffeabad92338d317c3193d50e8dd9a1a78977c (diff)
downloadpuppet-a37a7845073ef0b0923549364cbac5e0e39e3194.tar.gz
puppet-a37a7845073ef0b0923549364cbac5e0e39e3194.tar.xz
puppet-a37a7845073ef0b0923549364cbac5e0e39e3194.zip
Adding tests for the Transaction::Event class
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/transaction/event.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/unit/transaction/event.rb b/spec/unit/transaction/event.rb
new file mode 100755
index 000000000..7332b782d
--- /dev/null
+++ b/spec/unit/transaction/event.rb
@@ -0,0 +1,37 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+require 'puppet/transaction/event'
+
+describe Puppet::Transaction::Event do
+ Event = Puppet::Transaction::Event
+
+ it "should have an event accessor" do
+ event = Event.new :event => :foo, :source => "foo"
+ event.event.should == :foo
+ end
+
+ it "should have a source accessor" do
+ event = Event.new :event => :foo, :source => "foo"
+ event.source.should == "foo"
+ end
+
+ it "should have a transaction accessor" do
+ event = Event.new :event => :foo, :source => "foo"
+ event.transaction = "eh"
+ event.transaction.should == "eh"
+ end
+
+ it "should require a source" do
+ lambda { Event.new :event => :foo }.should raise_error
+ end
+
+ it "should require an event" do
+ lambda { Event.new :source => "eh" }.should raise_error
+ end
+
+ it "should be able to produce a string containing the event name and the source" do
+ Event.new(:event => :event, :source => :source).to_s.should == "source -> event"
+ end
+end