Skip to content
  • Sponsor ruby-grape/grape

  • Notifications You must be signed in to change notification settings
  • Fork 1.2k
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3559681

Browse files
authoredDec 29, 2024
Add ruby 3.4 to CI (#2518)
* Add ruby 3.4 to CI Fix specs * CHANGELOG.md * Add mutex_m for rails 6.1 and 7.0 gemfiles
1 parent 7ec3e6d commit 3559681

File tree

9 files changed

+20
-12
lines changed

9 files changed

+20
-12
lines changed
 

‎.github/workflows/danger.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Set up Ruby
1313
uses: ruby/setup-ruby@v1
1414
with:
15-
ruby-version: 2.7
15+
ruby-version: 3.4
1616
bundler-cache: true
1717
- name: Run Danger
1818
run: |

‎.github/workflows/edge.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
strategy:
77
fail-fast: false
88
matrix:
9-
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', ruby-head, truffleruby-head, jruby-head]
9+
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4', ruby-head, truffleruby-head, jruby-head]
1010
gemfile: [rails_edge, rack_edge]
1111
exclude:
1212
- ruby: '2.7'

‎.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Set up Ruby
1313
uses: ruby/setup-ruby@v1
1414
with:
15-
ruby-version: 3.3
15+
ruby-version: 3.4
1616
bundler-cache: true
1717
rubygems: latest
1818

@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
26+
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
2727
gemfile: [Gemfile, gemfiles/rack_2_0.gemfile, gemfiles/rack_3_0.gemfile, gemfiles/rack_3_1.gemfile, gemfiles/rails_6_1.gemfile, gemfiles/rails_7_0.gemfile, gemfiles/rails_7_1.gemfile, gemfiles/rails_7_2.gemfile, gemfiles/rails_8_0.gemfile]
2828
specs: ['spec --exclude-pattern=spec/integration/**/*_spec.rb']
2929
include:

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* [#2513](https://github.com/ruby-grape/grape/pull/2513): Optimize Grape::Path - [@ericproulx](https://github.com/ericproulx).
1111
* [#2514](https://github.com/ruby-grape/grape/pull/2514): Add rails 8.0 to CI - [@ericproulx](https://github.com/ericproulx).
1212
* [#2516](https://github.com/ruby-grape/grape/pull/2516): Dynamic registration for parsers, formatters, versioners - [@ericproulx](https://github.com/ericproulx).
13+
* [#2518](https://github.com/ruby-grape/grape/pull/2518): Add ruby 3.4 to CI - [@ericproulx](https://github.com/ericproulx).
1314
* Your contribution here.
1415

1516
#### Fixes

‎gemfiles/rails_6_1.gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
eval_gemfile '../Gemfile'
44

5+
gem 'mutex_m'
56
gem 'rails', '~> 6.1'
67
gem 'tzinfo-data', require: false

‎gemfiles/rails_7_0.gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
eval_gemfile '../Gemfile'
44

5+
gem 'mutex_m'
56
gem 'rails', '~> 7.0.0'
67
gem 'tzinfo-data', require: false

‎spec/grape/api_spec.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -2970,9 +2970,10 @@ def self.call(object, _env)
29702970
subject.put :yaml do
29712971
params[:tag]
29722972
end
2973-
put '/yaml', '<tag type="symbol">a123</tag>', 'CONTENT_TYPE' => 'application/xml'
2973+
body = '<tag type="symbol">a123</tag>'
2974+
put '/yaml', body, 'CONTENT_TYPE' => 'application/xml'
29742975
expect(last_response).to be_successful
2975-
expect(last_response.body).to eql '{"type"=>"symbol", "__content__"=>"a123"}'
2976+
expect(last_response.body).to eq(Grape::Xml.parse(body)['tag'].to_s)
29762977
end
29772978
end
29782979
end

‎spec/grape/endpoint_spec.rb

+8-5
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,16 @@ def app
391391
expect(last_response.body).to eq('Bobby T.')
392392
end
393393
else
394+
let(:body) { '<user>Bobby T.</user>' }
395+
394396
it 'converts XML bodies to params' do
395-
post '/request_body', '<user>Bobby T.</user>', 'CONTENT_TYPE' => 'application/xml'
396-
expect(last_response.body).to eq('{"__content__"=>"Bobby T."}')
397+
post '/request_body', body, 'CONTENT_TYPE' => 'application/xml'
398+
expect(last_response.body).to eq(Grape::Xml.parse(body)['user'].to_s)
397399
end
398400

399401
it 'converts XML bodies to params' do
400-
put '/request_body', '<user>Bobby T.</user>', 'CONTENT_TYPE' => 'application/xml'
401-
expect(last_response.body).to eq('{"__content__"=>"Bobby T."}')
402+
put '/request_body', body, 'CONTENT_TYPE' => 'application/xml'
403+
expect(last_response.body).to eq(Grape::Xml.parse(body)['user'].to_s)
402404
end
403405
end
404406

@@ -685,7 +687,8 @@ def app
685687
if Gem::Version.new(RUBY_VERSION).release <= Gem::Version.new('3.2')
686688
%r{undefined local variable or method `undefined_helper' for #<Class:0x[0-9a-fA-F]+> in '/hey' endpoint}
687689
else
688-
/undefined local variable or method `undefined_helper' for/
690+
opening_quote = Gem::Version.new(RUBY_VERSION).release >= Gem::Version.new('3.4') ? "'" : '`'
691+
/undefined local variable or method #{opening_quote}undefined_helper' for/
689692
end
690693
end
691694

‎spec/grape/middleware/exception_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ def call(_env)
220220

221221
it 'is possible to specify a custom formatter' do
222222
get '/'
223-
expect(last_response.body).to eq('{:custom_formatter=&gt;&quot;rain!&quot;}')
223+
response = Rack::Utils.escape_html({ custom_formatter: 'rain!' }.inspect)
224+
expect(last_response.body).to eq(response)
224225
end
225226
end
226227

0 commit comments

Comments
 (0)
Failed to load comments.