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

Support Ruby 3.3 #298

Merged
merged 1 commit into from
Jan 4, 2024
Merged

Conversation

m-nakamura145
Copy link
Contributor

@m-nakamura145 m-nakamura145 commented Jan 4, 2024

In Ruby 3.3, the message format for NoMethodError has been changed. I have modified the expected values in the tests to maintain compatibility.

undefined local variable or method 'privatee' for class Foo (NoMethodError)

Ruby 3.2.2

❯ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin22]

❯ bundle exec rspec spec/active_hash/base_spec.rb:956
Run options: include {:locations=>{"./spec/active_hash/base_spec.rb"=>[956]}}
.

Finished in 0.00241 seconds (files took 0.317 seconds to load)
1 example, 0 failures

Ruby 3.3.0

❯ ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]

❯ bundle exec rspec spec/active_hash/base_spec.rb:956
Run options: include {:locations=>{"./spec/active_hash/base_spec.rb"=>[956]}}
F

Failures:

  1) ActiveHash Base custom finders find_by_<field_one>_and_<field_two>! for fields the class doesn't have raises a NoMethodError
     Failure/Error:
       expect {
         Country.find_by_name_and_shoe_size!("US", 10)
       }.to raise_error(NoMethodError, /undefined method `find_by_name_and_shoe_size!' (?:for|on) Country/)

       expected NoMethodError with message matching /undefined method `find_by_name_and_shoe_size!' (?:for|on) Country/, got #<NoMethodError: undefined method `find_by_name_and_shoe_size!' for class Country> with backtrace:
         # ./lib/active_hash/base.rb:227:in `method_missing'
         # ./spec/active_hash/base_spec.rb:959:in `block (6 levels) in <top (required)>'
         # ./spec/active_hash/base_spec.rb:958:in `block (5 levels) in <top (required)>'
     # ./spec/active_hash/base_spec.rb:958:in `block (5 levels) in <top (required)>'

Finished in 0.01382 seconds (files took 0.38411 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/active_hash/base_spec.rb:957 # ActiveHash Base custom finders find_by_<field_one>_and_<field_two>! for fields the class doesn't have raises a NoMethodError

Copy link
Collaborator

@flavorjones flavorjones left a comment

Choose a reason for hiding this comment

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

Thank you!

@flavorjones flavorjones merged commit cca9655 into active-hash:master Jan 4, 2024
16 checks passed
@m-nakamura145 m-nakamura145 deleted the support-ruby-3.3 branch January 4, 2024 21:56
kbrock added a commit to kbrock/active_hash that referenced this pull request Apr 29, 2024
- Support `has_many :through` associations active-hash#296 @flavorjones
- Rails 7.1 support active-hash#291 @y-yagi

- Rails 7.1: fix sqlite3 issue active-hash#303 @flavorjones
- Rails 7.1.3: add missing `has_query_constraints?` active-hash#300 @flavorjones
- `Array#pluck` supports methods active-hash#299 @iberianpig
- Prefer `safe_constantize` over `constantize` active-hash#297 @flavorjones
- Treat `nil` and `blank?` as different values active-hash#295 @kbrock
- Fix `#where` for string keys active-hash#292 @usernam3
kbrock added a commit to kbrock/active_hash that referenced this pull request Apr 29, 2024
- Ruby 3.3 support active-hash#298 @m-nakamura145
- Support `has_many :through` associations active-hash#296 @flavorjones
- Rails 7.1 support active-hash#291 @y-yagi

- Rails 7.1: fix sqlite3 issue active-hash#303 @flavorjones
- Rails 7.1.3: add missing `has_query_constraints?` active-hash#300 @flavorjones
- `Array#pluck` supports methods active-hash#299 @iberianpig
- Prefer `safe_constantize` over `constantize` active-hash#297 @flavorjones
- Treat `nil` and `blank?` as different values active-hash#295 @kbrock
- Fix `#where` for string keys active-hash#292 @usernam3
@kbrock kbrock mentioned this pull request Apr 29, 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.

2 participants