1 $:.push File.join(File.dirname(__FILE__), *%w[.. .. lib])
4 class AdditionMatchers < Spec::Story::StepGroup
6 add.given("an addend of $addend") do |addend|
13 steps = AdditionMatchers.new do |add|
14 add.then("the sum should be $sum") do |sum|
15 @sum.should == sum.to_i
19 steps.when("they are added") do
23 # This Story uses steps (see above) instead of blocks
24 # passed to Given, When and Then
29 So that I can count some beans
32 Given "an addend of 2"
35 Then "the sum should be 5"
38 # This scenario uses GivenScenario, which silently runs
39 # all the steps in a previous scenario.
41 Scenario "add 4 more" do
43 Given "an addend of 4"
45 Then "the sum should be 9"
49 # And the class that makes the story pass
57 @addends.inject(0) do |result, addend|