[rspec-users] How do I use expect{}.to change().from().to() on Array?

Justin Ko jko170 at gmail.com
Tue Mar 15 13:08:16 EDT 2011


On Tue, Mar 15, 2011 at 8:57 AM, niku -E:) <niku at niku.name> wrote:

> Hi.
>
> I'm using ruby1.9.2 and rspec2.5.1
> I want to use "expect{}.to change().from().to()" like this
>
> https://gist.github.com/870897
>
> When Int class, it passed.
> When Ary class, it failed.
>
> Why was Ary test failed and How do I pass this test?
>
> regards.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>

Your Ary @ary variable is initialized as "[]". So of course calling
increment on it will change it to "[0]". For your spec to pass, initialize
it as "[0]"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110315/9ebc463d/attachment.html>


More information about the rspec-users mailing list