On Mon, Apr 13, 2009 at 8:17 AM, David Chelimsky <[email protected]> wrote:
> On Mon, Apr 13, 2009 at 12:09 PM, Salil Gaikwad <[email protected]> wrote:
>> How to write a spec file for a following helper
>>
>> module ArtistsHelper
>>
>> def round_to(x)
>>    (self * 10**x).round.to_f / 10**x
>> end
>>
>> end
>
> in spec/helpers/artists_helper_spec.rb:
>
> describe AristsHelper do
>  it "rounds to ...." do
>    helper.round_to(xxx).should == yyy
>  end
> end

That's what I was going to say, but I'm not sure that it's a Rails
helper...the calculation rounds self.  So I'm a bit confused.

If this is a module that you're using to extend the behavior of
Numeric classes, just mix it in somewhere and write examples for the
class that got the mixin.

Pat
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to