diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 5e99cbf53..12372470c 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -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: | diff --git a/.github/workflows/edge.yml b/.github/workflows/edge.yml index c9d26044d..c73a44ad3 100644 --- a/.github/workflows/edge.yml +++ b/.github/workflows/edge.yml @@ -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' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a7710f2aa..14a663818 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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: diff --git a/spec/grape/api_spec.rb b/spec/grape/api_spec.rb index bd6398780..20193ccb3 100644 --- a/spec/grape/api_spec.rb +++ b/spec/grape/api_spec.rb @@ -2970,9 +2970,10 @@ def self.call(object, _env) subject.put :yaml do params[:tag] end - put '/yaml', 'a123', 'CONTENT_TYPE' => 'application/xml' + body = 'a123' + 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 diff --git a/spec/grape/endpoint_spec.rb b/spec/grape/endpoint_spec.rb index f51e58213..0674731fe 100644 --- a/spec/grape/endpoint_spec.rb +++ b/spec/grape/endpoint_spec.rb @@ -391,14 +391,16 @@ def app expect(last_response.body).to eq('Bobby T.') end else + let(:body) { 'Bobby T.' } + it 'converts XML bodies to params' do - post '/request_body', 'Bobby T.', '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', 'Bobby T.', '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 @@ -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 # 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 diff --git a/spec/grape/middleware/exception_spec.rb b/spec/grape/middleware/exception_spec.rb index b3fe18144..b209b726f 100644 --- a/spec/grape/middleware/exception_spec.rb +++ b/spec/grape/middleware/exception_spec.rb @@ -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=>"rain!"}') + response = Rack::Utils.escape_html({ custom_formatter: 'rain!' }.inspect) + expect(last_response.body).to eq(response) end end