Closed Arepo closed 4 years ago
Have you seen this behaviour with 4.0.0.beta3
or only the git based pre-releases? Theres a chance there is an unreleased feature is causing this behaviour (and it might stay unreleased if so), otherwise if you can only replicate it in your app with devise it would suggest that one of your dependencies is to blame not rspec-rails and theres potentially nothing to do...
@Arepo can you please elaborate a bit?
I suggest setting a breakpoint here and identify what has changed exactly that is causing the expectation to fail.
I don't have time
Please keep in mind that we are volunteers here, and even though it's very helpful to report bugs, the more detailed they are, the higher is the chance of them being resolved soon.
Closing until a reproduction or something we can debug arises.
What Ruby, Rails and RSpec versions are you using?
Ruby version: 2.6.5 Rails version: 6.0.0 RSpec versions: rspec-rails 4.0.0.pre rspec-core 3.10.0.pre rspec-expectations 3.10.0.pre rspec-mocks 3.10.0.pre rspec-support 3.10.0.pre
(I wouldn't normally use non-stable releases, but I had the same issues as the user on this thread, and solved them per the suggestion there)
Observed behaviour
In an Rspec test in Rails >6.0.0 and (eg) a Devise confirmable user, run the following command:
(where
nil
can be any operation, and#confirmation_sent_at
is a standard ActiveRecord attribute method, returning an instance of ActiveSupport::TimeWithZone)This fails with a message like expected 'user.confirmation_sent_at' not to have changed, but did change from 2019-11-20 12:43:29.805732000 +0000 to 2019-11-20 12:43:29.805732000 +0000 - where the two times are identical.
Expected behaviour
The test should pass
Can you provide an example app?
I set up a Rails app without Devise, and with the same versions of the relevant testing gems, and unfortunately it didn't recreate the issue. I don't have time to plug in Devise/check the other libraries until it triggers the edge case, and in the meantime I can work around the bug easily enough by just storying the values of confirmation_sent_at, so I'll paste our Gemfile.lock below in the hope that this is helpful to you: