Skip to content

Commit 6230807

Browse files
jturelkoicolleolleolle
authored
See if tests pass against Ruby 3.3 (#1677)
* See if tests pass against Ruby 3.3 * Remove yard-junk from lint CI step * Fix a test failure using Ruby 3.3.0dev This PR fixes the following test failure using Ruby 3.3.0dev: ```console $ ruby -v ruby 3.3.0dev (2023-08-14T15:48:39Z master 52837fcec2) [x86_64-darwin22] $ bundle exec rspec spec/faraday_spec.rb Randomized with seed 57031 Faraday has a version number proxies to default_connection uses method_missing on Faraday if there is no proxyable method (FAILED - 1) proxies methods that exist on the default_connection proxied methods can be accessed Failures: 1) Faraday proxies to default_connection uses method_missing on Faraday if there is no proxyable method Failure/Error: expect { Faraday.this_method_does_not_exist }.to raise_error( NoMethodError, expected_message ) expected NoMethodError with "undefined method `this_method_does_not_exist' for Faraday:Module", got #<NoMethodError: undefined method `this_method_does_not_exist' for module Faraday> with backtrace: # ./lib/faraday.rb:147:in `method_missing' # ./spec/faraday_spec.rb:27:in `block (4 levels) in <top (required)>' # ./spec/faraday_spec.rb:27:in `block (3 levels) in <top (required)>' # ./spec/faraday_spec.rb:27:in `block (3 levels) in <top (required)>' ``` That error message has been changed by ruby/ruby@e7b8d32e in Ruby 3.3.0dev. cf. https://bugs.ruby-lang.org/issues/18285 So the test error message is changed: Ruby 3.2 or lower: ``` undefined method `this_method_does_not_exist' for Faraday:Module ``` Ruby 3.3.0dev: ``` NoMethodError: undefined method `this_method_does_not_exist' for module Faraday ``` (cherry picked from commit 7ce6865) * Format code with less indent (cherry picked from commit 230fa1b) --------- Co-authored-by: Koichi ITO <koic.ito@gmail.com> Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
1 parent 5c1d68a commit 6230807

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,14 @@ jobs:
3030
bundle install
3131
bundle exec rubocop --format progress
3232
33-
- name: Yard-Junk
34-
run: |
35-
gem install yard-junk --no-document
36-
yard-junk --path lib
37-
3833
build:
3934
needs: [linting]
4035
runs-on: ubuntu-latest
4136
name: build ${{ matrix.ruby }}
4237
strategy:
4338
fail-fast: false
4439
matrix:
45-
ruby: ['3.0', '3.1', '3.2']
40+
ruby: ['3.0', '3.1', '3.2', '3.3']
4641

4742
steps:
4843
- uses: actions/checkout@v4

spec/faraday_spec.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@
1818
end
1919

2020
it 'uses method_missing on Faraday if there is no proxyable method' do
21-
expect { Faraday.this_method_does_not_exist }.to raise_error(
22-
NoMethodError,
23-
"undefined method `this_method_does_not_exist' for Faraday:Module"
24-
)
21+
expected_message =
22+
if RUBY_VERSION >= '3.3'
23+
"undefined method `this_method_does_not_exist' for module Faraday"
24+
else
25+
"undefined method `this_method_does_not_exist' for Faraday:Module"
26+
end
27+
28+
expect { Faraday.this_method_does_not_exist }.to raise_error(NoMethodError, expected_message)
2529
end
2630

2731
it 'proxied methods can be accessed' do

0 commit comments

Comments
 (0)