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

Pass CI for [email protected] #415

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

seanpdoyle
Copy link

Follow-up to rails/rails#53962

As of [abdbff4][], calls to Hash#to_query with nil values will omit the joining = character.

This change resolves CI failures for Rails past [email protected] like:

  1) Failure:
BaseTest#test_collection_path_with_parameters [test/cases/base_test.rb:779]:
Expected: "/people.json?gender="
  Actual: "/people.json?gender"

  2) Failure:
SingletonTest#test_singleton_path_with_parameters [test/singleton_test.rb:44]:
Expected: "/weather.json?degrees="
  Actual: "/weather.json?degrees"

Follow-up to rails/rails#53962

As of [abdbff4][], calls to [Hash#to_query][] with `nil` values will
omit the joining `=` character.

This change resolves [CI failures][] for Rails past `[email protected]` like:

```
  1) Failure:
BaseTest#test_collection_path_with_parameters [test/cases/base_test.rb:779]:
Expected: "/people.json?gender="
  Actual: "/people.json?gender"

  2) Failure:
SingletonTest#test_singleton_path_with_parameters [test/singleton_test.rb:44]:
Expected: "/weather.json?degrees="
  Actual: "/weather.json?degrees"
```

[abdbff5]: rails/rails@abdbff5
[Hash#to_query]: https://edgeapi.rubyonrails.org/classes/Hash.html#method-i-to_query
[CI failures]: https://github.com/rails/activeresource/actions/runs/12606260018/job/35136128961?pr=411#step:4:17
@@ -776,7 +776,11 @@ def test_collection_path
def test_collection_path_with_parameters
assert_equal "/people.json?gender=male", Person.collection_path(gender: "male")
assert_equal "/people.json?gender=false", Person.collection_path(gender: false)
assert_equal "/people.json?gender=", Person.collection_path(gender: nil)
if ActiveSupport::VERSION::MAJOR < 8 || ActiveSupport::VERSION::MINOR < 1
Copy link
Author

Choose a reason for hiding this comment

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

As an alternative to version checking, I also considered an explicit { key: nil }.to_query == "key", but felt that was too verbose and harder to grep for in the future when these branches are no longer necessary.

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.

1 participant