[rspec-users] speccing a call to break

David Chelimsky dchelimsky at gmail.com
Fri Apr 20 13:00:45 EDT 2007


On 4/20/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:
>
> How can I spec that a method calls break?  As far as I can see from
> ri, break is a pure syntax element (not a method from Kernel or
> Object), so I'm not sure what to mock...
>
> E.g.:
>
> class SomeClass
>         def a_method
>                 loop do
>                         break
>                 end
>         end
> end

Why are you spec'ing such low level implementation detail? The fact
that you're calling break shouldn't matter. What matters is that given
some pre-conditions, some behaviour occurs and given other
pre-conditions different behaviour occurs. Spec the behaviour, not the
implementation.

>
>
>
> Scott
>
> P.S.  Sorry for the annoying questions, but I just want to know!
> P.P.S: What is the right form of the verb "to spec" in the
> Progressive?  Is it "specing" or "speccing"?

We had a poll about that a while back and I think "spec'ing" won.


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


More information about the rspec-users mailing list