Skip to content

Commit

Permalink
Fix tests to expect a non-match, not an error
Browse files Browse the repository at this point in the history
In rspec/rspec-expectations#1449, the `Include`
matcher is fixed so that it doesn't raise an error when types don't
match. Instead, the actual and expected will be deemed to not match.
  • Loading branch information
naveg committed Feb 2, 2024
1 parent bce9bd1 commit b73cff3
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions spec/rspec/rails/matchers/be_a_new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,7 @@ def new_record?; true; end

context "matcher is wrong type" do
it "fails" do
expect {
expect(record).to be_a_new(record.class).with(
foo: a_hash_including({ no_foo: "foo" }))
}.to raise_error { |e|
expect(e.message).to eq("no implicit conversion of Hash into String").or eq("can't convert Hash into String")
}
expect(record).not_to be_a_new(record.class).with(foo: a_hash_including({ no_foo: "foo" }))
end
end
end
Expand Down

0 comments on commit b73cff3

Please sign in to comment.