Re: [rspec-users] Rspec matchers confused by hashes?

2013-05-02 Thread Kwasi Mensah
On Thu, May 2, 2013 at 6:29 PM, Vighnesh Rege wrote: > > On Thu, May 2, 2013 at 3:01 PM, Kwasi Mensah 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: >

Re: [rspec-users] Rspec matchers confused by hashes?

2013-05-02 Thread Arne Brasseur
This syntax should work @test_hash["foobar"].size.should eq(1) But @test_hash["foobar"] evaluates to ["a","b","c"], so its size is actually 3. On May 3, 2013 12:12 AM, "Kwasi Mensah" wrote: > sorry if this gets posted twice. I accidentally sent this before I was > confirmed for the mailing lis

Re: [rspec-users] Rspec matchers confused by hashes?

2013-05-02 Thread Vighnesh Rege
I was wrong. This also works: ``` it do @test_hash["foobar"].size.should be 3 end ``` Looks like the error was due to the missing dot between size and should. This test: ``` it do should be 3 end ``` gives the same error: ``` 1) HashBug Test fails Failure/Error:

Re: [rspec-users] Rspec matchers confused by hashes?

2013-05-02 Thread Vighnesh Rege
On Thu, May 2, 2013 at 3:01 PM, Kwasi Mensah 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 t

Re: [rspec-users] Rspec matchers confused by hashes?

2013-05-02 Thread Kwasi Mensah
sorry if this gets posted twice. I accidentally sent this before I was confirmed for the mailing list. On Thu, May 2, 2013 at 5:11 PM, Kwasi Mensah wrote: > I'm having trouble with one of my rspecs and it's coming down to the tests > being confused about what the subject is. Here's an example s