~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to vendor/gems/rspec/examples/stories/steps/addition_steps.rb

  • Committer: Bazaar Package Importer
  • Author(s): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mto: (3.1.1 lenny) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20080726154345-1fmgo76b4l72ulvc
ImportĀ upstreamĀ versionĀ 0.24.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require File.expand_path("#{File.dirname(__FILE__)}/../helper")
 
2
 
 
3
# This creates steps for :addition
 
4
steps_for(:addition) do
 
5
  Given("an addend of $addend") do |addend|
 
6
    @adder ||= Adder.new
 
7
    @adder << addend.to_i
 
8
  end
 
9
end
 
10
 
 
11
# This appends to them
 
12
steps_for(:addition) do
 
13
  When("the addends are added")  { @sum = @adder.sum }
 
14
end
 
15
 
 
16
steps_for(:more_addition) do
 
17
  Then("the sum should be $sum") { |sum| @sum.should == sum.to_i }
 
18
end