Mailinglist Archive: yast-devel (63 mails)

< Previous Next >
Re: [yast-devel] rspec 3.0 --> .to eq(true)?
  • From: Ancor Gonzalez Sosa <ancor@xxxxxxx>
  • Date: Wed, 17 Dec 2014 13:49:51 +0100
  • Message-id: <>
On 12/17/2014 01:15 PM, Lukas Ocilka wrote:
On 12.8.2014 15:22, Ladislav Slezak wrote:
Dne 23.5.2014 10:04, Josef Reidinger napsal(a):
I agree. I just see one of rspec test using obsolete monkey patching
with `instance.stub(...)`, so I will like to raise it to have easy
switch to new rspec.

I've been just checking a PR made by Schubi: This also changes:

- expect(ServicesManager.import(data)).to be_true
+ expect(ServicesManager.import(data)).to eq(true)

According to documentation at - we should be using

expect(ServicesManager.import(data)).to be true

but according to Ancor, we have to use

expect(ServicesManager.import(data)).to eq(true)

because this works with both, the old and the new version of RSpec.

To be precise

1) be_true
Works only with RSpec 2. That's why we are changing it. It succeeds if x
is evaluated to be true, that is, anything but nil or false.

2) be(true)
Works with both versions. It succeeds only if x is exactly a boolean
true. Internally uses x.equal?(true) for comparison, which leads to
confusing messages sometimes if the comparison fails.

3) eq(true)
Works with both versions. Very similar to (2) but using "==" for
comparison, which leads to more understandable messages (and is probably
what the author meant).

4) be_truthy
Works only with RSpec 3. The equivalent to be_true in the new RSpec version.

In some document (which I cannot find right now) eq(true) or eql(true)
was suggested as migration path from be_true, so we adopted it. In my
opinion, it makes more sense semantically.

Ancor González Sosa
YaST Team at SUSE Linux GmbH
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >