Skip to content

Commit e38ee98

Browse files
committed
Add ruby 3.4 to CI
Fix specs
1 parent 7ec3e6d commit e38ee98

File tree

6 files changed

+17
-12
lines changed

6 files changed

+17
-12
lines changed

.github/workflows/danger.yml

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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:

spec/grape/api_spec.rb

Lines changed: 3 additions & 2 deletions
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

Lines changed: 8 additions & 5 deletions
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

Lines changed: 2 additions & 1 deletion
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)