El 18/10/2007, a las 10:33, "David Chelimsky" <[EMAIL PROTECTED]>  
escribió:

> Take a look at examples/story/calculator.rb to see what's going on.
>
> Needs docs!!!!
>
> Thoughts welcome.

Could this:

   step_matcher(:given, "an addend of $addend") do |addend|
     @adder ||= Adder.new
     @adder << addend.to_i
   end

   step_matcher(:when, "they are added") do
     @sum = @adder.sum
   end

   step_matcher(:then, "the sum should be $sum") do |sum|
     @sum.should == sum.to_i
   end

Be refactored to this?

   given_matcher("an addend of $addend") do |addend|
     @adder ||= Adder.new
     @adder << addend.to_i
   end

   when_matcher("they are added") do
     @sum = @adder.sum
   end

   then_matcher("the sum should be $sum") do |sum|
     @sum.should == sum.to_i
   end

I'd find that a little bit easier to type; what do you think?

Cheers,
Wincent



_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to