Skip to content

Commit

Permalink
Add ruby 3.4 to CI (#2518)
Browse files Browse the repository at this point in the history
* Add ruby 3.4 to CI
Fix specs

* CHANGELOG.md

* Add mutex_m for rails 6.1 and 7.0 gemfiles
  • Loading branch information
ericproulx authored Dec 29, 2024
1 parent 7ec3e6d commit 3559681
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/danger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.4
bundler-cache: true
- name: Run Danger
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', ruby-head, truffleruby-head, jruby-head]
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4', ruby-head, truffleruby-head, jruby-head]
gemfile: [rails_edge, rack_edge]
exclude:
- ruby: '2.7'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
ruby-version: 3.4
bundler-cache: true
rubygems: latest

Expand All @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
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]
specs: ['spec --exclude-pattern=spec/integration/**/*_spec.rb']
include:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* [#2513](https://github.com/ruby-grape/grape/pull/2513): Optimize Grape::Path - [@ericproulx](https://github.com/ericproulx).
* [#2514](https://github.com/ruby-grape/grape/pull/2514): Add rails 8.0 to CI - [@ericproulx](https://github.com/ericproulx).
* [#2516](https://github.com/ruby-grape/grape/pull/2516): Dynamic registration for parsers, formatters, versioners - [@ericproulx](https://github.com/ericproulx).
* [#2518](https://github.com/ruby-grape/grape/pull/2518): Add ruby 3.4 to CI - [@ericproulx](https://github.com/ericproulx).
* Your contribution here.

#### Fixes
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_6_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

eval_gemfile '../Gemfile'

gem 'mutex_m'
gem 'rails', '~> 6.1'
gem 'tzinfo-data', require: false
1 change: 1 addition & 0 deletions gemfiles/rails_7_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

eval_gemfile '../Gemfile'

gem 'mutex_m'
gem 'rails', '~> 7.0.0'
gem 'tzinfo-data', require: false
5 changes: 3 additions & 2 deletions spec/grape/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2970,9 +2970,10 @@ def self.call(object, _env)
subject.put :yaml do
params[:tag]
end
put '/yaml', '<tag type="symbol">a123</tag>', 'CONTENT_TYPE' => 'application/xml'
body = '<tag type="symbol">a123</tag>'
put '/yaml', body, 'CONTENT_TYPE' => 'application/xml'
expect(last_response).to be_successful
expect(last_response.body).to eql '{"type"=>"symbol", "__content__"=>"a123"}'
expect(last_response.body).to eq(Grape::Xml.parse(body)['tag'].to_s)
end
end
end
Expand Down
13 changes: 8 additions & 5 deletions spec/grape/endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -391,14 +391,16 @@ def app
expect(last_response.body).to eq('Bobby T.')
end
else
let(:body) { '<user>Bobby T.</user>' }

it 'converts XML bodies to params' do
post '/request_body', '<user>Bobby T.</user>', 'CONTENT_TYPE' => 'application/xml'
expect(last_response.body).to eq('{"__content__"=>"Bobby T."}')
post '/request_body', body, 'CONTENT_TYPE' => 'application/xml'
expect(last_response.body).to eq(Grape::Xml.parse(body)['user'].to_s)
end

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

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

Expand Down
3 changes: 2 additions & 1 deletion spec/grape/middleware/exception_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ def call(_env)

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

Expand Down

0 comments on commit 3559681

Please sign in to comment.