Sometimes when we want to make assertion of array in our rspec then assertion gets failes which in result make the spec failure.
nums = [1,2,3].shuffle
nums.length.should == 3
nums.should include 1
nums.should include 2
nums.should include 3
If we can prevent this buy using =~ opreator where we want to assert in our spec.[1,2,3].shuffle.should =~ [1,2,3]
No comments:
Post a Comment