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

[WIP] Enable CI for Ruby head #2821

Merged
merged 1 commit into from
Dec 21, 2024
Merged

[WIP] Enable CI for Ruby head #2821

merged 1 commit into from
Dec 21, 2024

Conversation

voxik
Copy link
Contributor

@voxik voxik commented Dec 16, 2024

This is just to demonstrate the Ruby 3.4 errors discussed in #2820

@voxik voxik changed the title [WIP] Enable CI for Ruby hard [WIP] Enable CI for Ruby head Dec 16, 2024
@@ -45,6 +45,9 @@ jobs:
RAILS_VERSION: 'main'

# Rails 8.0 builds >= 3.2
- ruby: head
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer if you used one of the preview versions

@voxik voxik force-pushed the ruby-3.4 branch 2 times, most recently from e7aeecf to cb28b10 Compare December 17, 2024 16:24
@voxik
Copy link
Contributor Author

voxik commented Dec 17, 2024

  1) have_broadcasted_to matchers have_broadcasted_to has an appropriate description including the matcher's description when qualified with `#with` and a composable matcher
     Failure/Error:
       expect(
         have_broadcasted_to("my_stream")
           .from_channel(channel)
           .with(a_hash_including(a: :b))
           .description
       ).to eq("have broadcasted exactly 1 messages to my_stream with a hash including #{{:a => :b}}")

       expected: "have broadcasted exactly 1 messages to my_stream with a hash including {:a=>:b}"
            got: "have broadcasted exactly 1 messages to my_stream with a hash including {:a => :b}"

Eh, ok. Failure due to:

inspect_string.gsub(/(\S)=>(\S)/, '\1 => \2')

@voxik voxik force-pushed the ruby-3.4 branch 2 times, most recently from f6e5c3b to f5fd11e Compare December 17, 2024 16:44
@voxik
Copy link
Contributor Author

voxik commented Dec 17, 2024

The Ruby 3.0 tests become broken since yesterday apparently due to RubyGems update 🤷

@voxik
Copy link
Contributor Author

voxik commented Dec 17, 2024

Not sure about the warning: literal string will be frozen in the future. But I have noticed that the test suite is cloning RSpec components from their original repositories, this should likely change.

@voxik
Copy link
Contributor Author

voxik commented Dec 17, 2024

Yeah, not sure about Rubocop. Maybe using the "#{{}}" syntax is not good idea and everything should be conditionalized? But something along these lines was kind of suggested here

@@ -178,7 +200,7 @@ def new_record?; false; end
expect(record).to be_a_new(String).with(foo: 'bar')
}.to raise_error(
"expected #{record.inspect} to be a new String and " +
%(attribute {"foo"=>"bar"} was not set on #{record.inspect})
%(attribute #{{"foo"=>"bar"}} was not set on #{record.inspect})
Copy link
Member

Choose a reason for hiding this comment

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

I would extract this to a variable which is defined based on a condition and pass that to raise_error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you please elaborate a bit more about the reasons? As I see it, the main advantage of this approach is that the string is still very much reminds the error output. OTOH, if this is extracted into variable, it might have the benefit that Rubocop is happier. Besides that, I'd need to come up with some reasonable variable name, which is always the worst task 🙈

And also is this remark specific to this hunk or in general?

Copy link
Member

Choose a reason for hiding this comment

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

Its in general for these interpolated hunks after your rubocop comment e.g.

message =
  if RUBY_VERSION >= '3.4'
    %(attribute {foo: "bar"} was not set on #{record.inspect})
  else
    %(attribute {"foo"=>"bar"} was not set on #{record.inspect})
  end

...

}.to raise_error(message)

@JonRowe
Copy link
Member

JonRowe commented Dec 17, 2024

If you rebase this the main branch fixed the rubygems errors

@voxik
Copy link
Contributor Author

voxik commented Dec 18, 2024

Rubocop is happy now 👍

But I am not exactly sure about the remaining failures for Ruby 3.4 / Rails 8.0 🤷

@benoittgt benoittgt mentioned this pull request Dec 20, 2024
@benoittgt
Copy link
Member

I've probably fixed the two issues in #2825

@JonRowe JonRowe merged commit a0dc958 into rspec:main Dec 21, 2024
18 of 19 checks passed
@JonRowe
Copy link
Member

JonRowe commented Dec 21, 2024

Thanks @voxik

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.

3 participants