Skip to content
New issue

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

Fix tests to expect a non-match, not an error #2728

Closed
wants to merge 1 commit into from

Conversation

naveg
Copy link

@naveg naveg commented Feb 2, 2024

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.

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.
@@ -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" }))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we just use a different "wrong type" of matcher here and keep the example as is? Like be_within/cover/contain_exactly.
At the same time, this example won't break after your rspec-expectations fix.

@pirj
Copy link
Member

pirj commented Feb 5, 2024

Closing as the root PR was closed

@pirj pirj closed this Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants