According the answer I can use the rspec
expectation form with the cucumber.
value = true
expect(value).to be_a(TrueClass) # => true
but if I use #be_true
method it refused answering with exception:
expect(true).to be_true # => RSpec::Expectations::ExpectationNotMetError: expected true to respond to `true?`
So I can't use the method like I've used it in rails
but without rails
itself. So question is how can I add the methods not including the rails
, and not defining them manually?
Try like this:
Although the RSpec documentation indicates
be_true
will pass if the object is notnil
orfalse
, in practice I find it does not pass if the object istrue
. If you want to check that the value istrue
specifically, and not just a truthy value, you need to usebe true
, (with the space),eql true
,eq true
,equal true
, etc.(If you're not already familiar, you can read about the difference between RSpec's equality matchers here. You don't say which RSpec version you're using, so that applies to 3.2 and I believe this is the same for other versions.)