Is truth expected to be true?

I upgraded my rspec-rails to 3.0.1 and now I see this error in all my tests

  Failure/Error: Sidekiq::Status::complete?(json.jid).should be_true expected true to respond to `true?` 

I can not find a solution and what I am missing.

+45
ruby-on-rails ruby-on-rails-4 rspec rspec-rails rspec3
Jun 06 '14 at 12:27
source share
2 answers

From rspec 3.0, be_true renamed to be_truthy and be_false to be_falsey

The behavior has not changed. So

 (nil).should be_falsey (false).should be_falsey 

and

 (anything other than nil or false).should be_truthy 

will also be held

From changelog 3.0.0.beta1 / 2013-11-07

Rename be_true and be_false to be_truthy and be_falsey. (Sam Fippen)

+91
Jun 06 '14 at 12:37
source share

In order not to rewrite many existing specifications, you can add this to spec_helper (this harms my sense of harmony, but saves time):

 def true.true? true end def true.false? false end def false.true? false end def false.false? true end 
+1
Dec 04 '14 at 12:51
source share



All Articles