[rspec-users] Rspec matchers confused by hashes?

Vighnesh Rege vighnesh1987 at gmail.com
Thu May 2 22:29:08 UTC 2013


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.


Vighnesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20130502/b281e9b0/attachment.html>


More information about the rspec-users mailing list