[rspec-users] Rspec matchers confused by hashes?

Kwasi Mensah kwasi.mensah at gmail.com
Thu May 2 23:02:17 UTC 2013


On Thu, May 2, 2013 at 6:29 PM, Vighnesh Rege <vighnesh1987 at gmail.com>wrote:

>
> On Thu, May 2, 2013 at 3:01 PM, Kwasi Mensah <kwasi.mensah at gmail.com>wrote:
>
>>        @test_hash["foobar"].size should be 1
>>
>
> Shouldn't there be a dot between size and should?
> Also, shouldn't the expected value be 3?
>
> Even after making these changes:
> ```
> @test_hash["foobar"].should be 3
> ```
> the test fails for a reason that I'm not aware of. Personally, I'm more
> comfortable with the expect syntax[
> https://github.com/rspec/rspec-expectations]. I changed the first test to:
>
> ```
>     it do
>        expect(@test_hash["foobar"].size).to eq 3
>     end
> ```
>
> And it now works.
>
D'oh. You're right. writing "size.should" should work. And sorry for using
the wrong number (was mixing with the original case that inspired this).

>
>
> Vighnesh
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20130502/ca9f7fa0/attachment.html>


More information about the rspec-users mailing list