We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expect { ... }.to change { model.association }.to ...
user = User.create! expect { user.visits << Visit.new(session_id: 1) }.to change { user.visits }.to include(have_attributes(session_id: 1))
fails.
It reminds me of rspec/rspec-expectations#1100, since adding to_a makes the spec pass:
to_a
change { user.visits.to_a }
I've just scratched the surface, but for some reason in rspec-expectations-3.9.2/lib/rspec/matchers/built_in/change.rb:
rspec-expectations-3.9.2/lib/rspec/matchers/built_in/change.rb
@actual_before == @actual_after
and their @before_hash == @actual_after.hash as well.
@before_hash == @actual_after.hash
Seems that the issue is just the opposite to what we've fixed in rspec/rspec-expectations#1100, the hash does not change while contents does change.
Ruby version: 2.5.7 Rails version: 5.2 RSpec version: rspec-expectations 3.9.2, rails-rails 4.0.1
Expectation fails:
expected `user.visits` to have changed to include (have attributes {:session_id => 1}), but did not change
Spec passes
A bit later
The text was updated successfully, but these errors were encountered:
No branches or pull requests
fails.
It reminds me of rspec/rspec-expectations#1100, since adding
to_a
makes the spec pass:I've just scratched the surface, but for some reason in
rspec-expectations-3.9.2/lib/rspec/matchers/built_in/change.rb
:and their
@before_hash == @actual_after.hash
as well.Seems that the issue is just the opposite to what we've fixed in rspec/rspec-expectations#1100, the hash does not change while contents does change.
What Ruby, Rails and RSpec versions are you using?
Ruby version: 2.5.7
Rails version: 5.2
RSpec version: rspec-expectations 3.9.2, rails-rails 4.0.1
Observed behaviour
Expectation fails:
Expected behaviour
Spec passes
Can you provide an example app?
A bit later
The text was updated successfully, but these errors were encountered: