X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/a5336e68a3fb124b6d024ea9b0b9d7bfe88b3b6a..0436b4878ce29c48b690772e61fcaf7aaae8a4ac:/vendor/gems/rspec-1.1.2/examples/stories/calculator.rb diff --git a/vendor/gems/rspec-1.1.2/examples/stories/calculator.rb b/vendor/gems/rspec-1.1.2/examples/stories/calculator.rb deleted file mode 100644 index 390437c55..000000000 --- a/vendor/gems/rspec-1.1.2/examples/stories/calculator.rb +++ /dev/null @@ -1,65 +0,0 @@ -$:.push File.join(File.dirname(__FILE__), *%w[.. .. lib]) -require 'spec' - -class AdditionMatchers < Spec::Story::StepGroup - steps do |add| - add.given("an addend of $addend") do |addend| - @adder ||= Adder.new - @adder << addend.to_i - end - end -end - -steps = AdditionMatchers.new do |add| - add.then("the sum should be $sum") do |sum| - @sum.should == sum.to_i - end -end - -steps.when("they are added") do - @sum = @adder.sum -end - -# This Story uses steps (see above) instead of blocks -# passed to Given, When and Then - -Story "addition", %{ - As an accountant - I want to add numbers - So that I can count some beans -}, :steps => steps do - Scenario "2 + 3" do - Given "an addend of 2" - And "an addend of 3" - When "they are added" - Then "the sum should be 5" - end - - # This scenario uses GivenScenario, which silently runs - # all the steps in a previous scenario. - - Scenario "add 4 more" do - GivenScenario "2 + 3" - Given "an addend of 4" - When "they are added" - Then "the sum should be 9" - end -end - -# And the class that makes the story pass - -class Adder - def << addend - addends << addend - end - - def sum - @addends.inject(0) do |result, addend| - result + addend.to_i - end - end - - def addends - @addends ||= [] - end -end