examples/steps/steps.rb in turnip-2.0.2 vs examples/steps/steps.rb in turnip-2.1.0
- old
+ new
@@ -63,18 +63,18 @@
step "the monster should be dead" do
@monster.should <= 0
end
step "there are the following monsters:" do |table|
- @monsters = {}
+ $monsters = {}
table.hashes.each do |hash|
- @monsters[hash['Name']] = hash['Hitpoints'].to_i
+ $monsters[hash['Name']] = hash['Hitpoints'].to_i
end
end
-step ":name should have :count hitpoints" do |name, count|
- @monsters[name].should eq(count.to_i)
+step ":monster should have :count hitpoints" do |monster, count|
+ monster.should eq(count.to_i)
end
step "the monster sings the following song" do |song|
@song = song
end
@@ -114,7 +114,13 @@
end
placeholder :color do
match /blue|green|red/ do |color|
color.to_sym
+ end
+end
+
+placeholder :monster do
+ default do |name|
+ $monsters[name]
end
end