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

spec: Support ruby 3.1 and 3.3 error message formats #23203

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

kbrock
Copy link
Member

@kbrock kbrock commented Sep 24, 2024

This message is different for ruby 3.3 and 3.1

Change phrase to be the common factor for both ruby versions

This is currently the only failure for 3.1/3.3 on master
(besides the gem changes)

@@ -257,12 +257,12 @@ def test_method
expect(api_collection).to receive(:find).with(0).and_return(Struct.new(:id).new(0))
expect(api_collection).to receive(:find).with(1).and_return(double("Something that responds", :id => 0, :the_task => nil))

expect($log).to receive(:error).with(a_string_including("undefined method `the_task' for #<struct id=0>")).and_call_original
expect($log).to receive(:error).with(a_string_matching(/undefined method `the_task' for/)).and_call_original
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't really use a regex so what about:

Suggested change
expect($log).to receive(:error).with(a_string_matching(/undefined method `the_task' for/)).and_call_original
expect($log).to receive(:error).with(a_string_including("undefined method `the_task' for")).and_call_original

Copy link
Member

Choose a reason for hiding this comment

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

Same with below

@Fryguy
Copy link
Member

Fryguy commented Sep 24, 2024

Label says 3.2, but the title says 3.3 - do you know which one introduced the change?

This message is different for ruby 3.3 and 3.1

Change phrase to be the common factor for both ruby versions
@kbrock kbrock force-pushed the flexible_error_matcher_ruby31 branch from 325a347 to 076fdf5 Compare September 25, 2024 13:25
@kbrock
Copy link
Member Author

kbrock commented Sep 25, 2024

update:

  • swapped a_string_matching back to a_string_including

@miq-bot
Copy link
Member

miq-bot commented Sep 25, 2024

Checked commit kbrock@076fdf5 with ruby 3.1.5, rubocop 1.56.3, haml-lint 0.51.0, and yamllint
1 file checked, 0 offenses detected
Everything looks fine. 👍

@Fryguy Fryguy merged commit 3149343 into ManageIQ:master Sep 25, 2024
8 checks passed
@Fryguy Fryguy self-assigned this Sep 25, 2024
@Fryguy Fryguy added test and removed enhancement labels Sep 25, 2024
@kbrock kbrock deleted the flexible_error_matcher_ruby31 branch September 26, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants