I am using rspec and for asserts like
student.name should be nil
student.name should be_nil
Both seem to work. is there a difference between using be nil an be_nil ???
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no difference really, except
be nilgets defined on the fly, andbe_nilhas been specifically programmed by rspec.when you say
should.be something, rspec tries the followingWhereas, when you try
should.be_nilit just checkshttps://github.com/rspec/rspec-expectations/blob/master/lib/rspec/matchers/built_in/be.rb