From 6b03904f51ea60c16af004011016b5b64db5f0cb Mon Sep 17 00:00:00 2001 From: Dmitriy Nesteryuk Date: Tue, 1 Oct 2019 22:07:46 +0300 Subject: [PATCH] upgrade rack-test to 1.1.0 --- Gemfile | 2 +- gemfiles/multi_json.gemfile | 2 +- gemfiles/multi_xml.gemfile | 2 +- gemfiles/rack_edge.gemfile | 2 +- gemfiles/rails_3.gemfile | 2 +- gemfiles/rails_4.gemfile | 2 +- gemfiles/rails_5.gemfile | 2 +- gemfiles/rails_edge.gemfile | 2 +- spec/grape/validations/validators/coerce_spec.rb | 4 ++-- spec/grape/validations_spec.rb | 14 ++++++++++++-- 10 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 2881582d82..b088fc7934 100644 --- a/Gemfile +++ b/Gemfile @@ -27,7 +27,7 @@ group :test do gem 'maruku' gem 'mime-types' gem 'rack-jsonp', require: 'rack/jsonp' - gem 'rack-test', '~> 0.6.3' + gem 'rack-test', '~> 1.1.0' gem 'rspec', '~> 3.0' gem 'ruby-grape-danger', '~> 0.1.0', require: false end diff --git a/gemfiles/multi_json.gemfile b/gemfiles/multi_json.gemfile index 4ab020140a..a8b1573a21 100644 --- a/gemfiles/multi_json.gemfile +++ b/gemfiles/multi_json.gemfile @@ -27,7 +27,7 @@ group :test do gem 'maruku' gem 'mime-types' gem 'rack-jsonp', require: 'rack/jsonp' - gem 'rack-test', '~> 0.6.3' + gem 'rack-test', '~> 1.1.0' gem 'rspec', '~> 3.0' gem 'ruby-grape-danger', '~> 0.1.0', require: false end diff --git a/gemfiles/multi_xml.gemfile b/gemfiles/multi_xml.gemfile index c093022a6d..4ade375c4d 100644 --- a/gemfiles/multi_xml.gemfile +++ b/gemfiles/multi_xml.gemfile @@ -27,7 +27,7 @@ group :test do gem 'maruku' gem 'mime-types' gem 'rack-jsonp', require: 'rack/jsonp' - gem 'rack-test', '~> 0.6.3' + gem 'rack-test', '~> 1.1.0' gem 'rspec', '~> 3.0' gem 'ruby-grape-danger', '~> 0.1.0', require: false end diff --git a/gemfiles/rack_edge.gemfile b/gemfiles/rack_edge.gemfile index eb276ec2b1..4065843b59 100644 --- a/gemfiles/rack_edge.gemfile +++ b/gemfiles/rack_edge.gemfile @@ -27,7 +27,7 @@ group :test do gem 'maruku' gem 'mime-types' gem 'rack-jsonp', require: 'rack/jsonp' - gem 'rack-test', '~> 0.6.3' + gem 'rack-test', '~> 1.1.0' gem 'rspec', '~> 3.0' gem 'ruby-grape-danger', '~> 0.1.0', require: false end diff --git a/gemfiles/rails_3.gemfile b/gemfiles/rails_3.gemfile index c6445ee6ac..0ac3c18e80 100644 --- a/gemfiles/rails_3.gemfile +++ b/gemfiles/rails_3.gemfile @@ -28,7 +28,7 @@ group :test do gem 'maruku' gem 'mime-types' gem 'rack-jsonp', require: 'rack/jsonp' - gem 'rack-test', '~> 0.6.3' + gem 'rack-test', '~> 1.1.0' gem 'rspec', '~> 3.0' gem 'ruby-grape-danger', '~> 0.1.0', require: false end diff --git a/gemfiles/rails_4.gemfile b/gemfiles/rails_4.gemfile index 2f331cb868..24c711230f 100644 --- a/gemfiles/rails_4.gemfile +++ b/gemfiles/rails_4.gemfile @@ -27,7 +27,7 @@ group :test do gem 'maruku' gem 'mime-types' gem 'rack-jsonp', require: 'rack/jsonp' - gem 'rack-test', '~> 0.6.3' + gem 'rack-test', '~> 1.1.0' gem 'rspec', '~> 3.0' gem 'ruby-grape-danger', '~> 0.1.0', require: false end diff --git a/gemfiles/rails_5.gemfile b/gemfiles/rails_5.gemfile index c8c38fbb44..80f19f16a1 100644 --- a/gemfiles/rails_5.gemfile +++ b/gemfiles/rails_5.gemfile @@ -27,7 +27,7 @@ group :test do gem 'maruku' gem 'mime-types' gem 'rack-jsonp', require: 'rack/jsonp' - gem 'rack-test', '~> 0.6.3' + gem 'rack-test', '~> 1.1.0' gem 'rspec', '~> 3.0' gem 'ruby-grape-danger', '~> 0.1.0', require: false end diff --git a/gemfiles/rails_edge.gemfile b/gemfiles/rails_edge.gemfile index 56ecdf5f0d..369f50e80f 100644 --- a/gemfiles/rails_edge.gemfile +++ b/gemfiles/rails_edge.gemfile @@ -27,7 +27,7 @@ group :test do gem 'maruku' gem 'mime-types' gem 'rack-jsonp', require: 'rack/jsonp' - gem 'rack-test', '~> 0.6.3' + gem 'rack-test', '~> 1.1.0' gem 'rspec', '~> 3.0' gem 'ruby-grape-danger', '~> 0.1.0', require: false end diff --git a/spec/grape/validations/validators/coerce_spec.rb b/spec/grape/validations/validators/coerce_spec.rb index bf4a5cc8ad..3cf65ace4f 100644 --- a/spec/grape/validations/validators/coerce_spec.rb +++ b/spec/grape/validations/validators/coerce_spec.rb @@ -576,7 +576,7 @@ def self.parsed?(value) expect(last_response.status).to eq(200) expect(last_response.body).to eq('arrays work') - get '/', splines: [{ x: 2, ints: [] }, { x: 3, ints: [4], obj: { y: 'quack' } }] + get '/', splines: [{ x: 2, ints: [5] }, { x: 3, ints: [4], obj: { y: 'quack' } }] expect(last_response.status).to eq(200) expect(last_response.body).to eq('arrays work') @@ -592,7 +592,7 @@ def self.parsed?(value) expect(last_response.status).to eq(400) expect(last_response.body).to eq('splines[x] does not have a valid value') - get '/', splines: [{ x: 1, ints: [] }, { x: 4, ints: [] }] + get '/', splines: [{ x: 1, ints: [5] }, { x: 4, ints: [6] }] expect(last_response.status).to eq(400) expect(last_response.body).to eq('splines[x] does not have a valid value') end diff --git a/spec/grape/validations_spec.rb b/spec/grape/validations_spec.rb index 90e04bafe4..0a32178484 100644 --- a/spec/grape/validations_spec.rb +++ b/spec/grape/validations_spec.rb @@ -540,7 +540,10 @@ def validate_param!(attr_name, params) ] expect(last_response.status).to eq(400) - expect(last_response.body).to eq('children[0][parents] is missing, children[1][parents] is missing') + expect(last_response.body).to eq( + 'children[0][parents][0][name] is missing, ' \ + 'children[1][parents][0][name] is missing' + ) end it 'safely handles empty arrays and blank parameters' do @@ -548,7 +551,14 @@ def validate_param!(attr_name, params) # should actually return 200, since an empty array is valid. get '/within_array', children: [] expect(last_response.status).to eq(400) - expect(last_response.body).to eq('children is missing') + expect(last_response.body).to eq( + 'children[0][name] is missing, ' \ + 'children[0][parents] is missing, ' \ + 'children[0][parents] is invalid, ' \ + 'children[0][parents][0][name] is missing, ' \ + 'children[0][parents][0][name] is empty' + ) + get '/within_array', children: [name: 'Jay'] expect(last_response.status).to eq(400) expect(last_response.body).to eq('children[0][parents] is missing')