grape 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of grape might be problematic. Click here for more details.

Files changed (62) hide show
  1. checksums.yaml +5 -13
  2. data/.rubocop.yml +6 -6
  3. data/.travis.yml +11 -2
  4. data/CHANGELOG.md +23 -1
  5. data/Gemfile +11 -10
  6. data/Guardfile +5 -6
  7. data/README.md +194 -13
  8. data/UPGRADING.md +3 -3
  9. data/grape.gemspec +1 -1
  10. data/grape.png +0 -0
  11. data/lib/grape/api.rb +21 -13
  12. data/lib/grape/endpoint.rb +31 -13
  13. data/lib/grape/exceptions/validation.rb +2 -2
  14. data/lib/grape/locale/en.yml +2 -0
  15. data/lib/grape/middleware/auth/oauth2.rb +69 -65
  16. data/lib/grape/middleware/error.rb +4 -2
  17. data/lib/grape/middleware/formatter.rb +2 -2
  18. data/lib/grape/middleware/versioner/accept_version_header.rb +1 -1
  19. data/lib/grape/middleware/versioner/header.rb +3 -3
  20. data/lib/grape/util/hash_stack.rb +1 -1
  21. data/lib/grape/validations.rb +22 -8
  22. data/lib/grape/validations/default.rb +1 -1
  23. data/lib/grape/validations/exactly_one_of.rb +26 -0
  24. data/lib/grape/validations/mutual_exclusion.rb +25 -0
  25. data/lib/grape/validations/presence.rb +1 -1
  26. data/lib/grape/validations/regexp.rb +2 -1
  27. data/lib/grape/validations/values.rb +7 -1
  28. data/lib/grape/version.rb +1 -1
  29. data/spec/grape/api_spec.rb +390 -333
  30. data/spec/grape/endpoint_spec.rb +129 -99
  31. data/spec/grape/entity_spec.rb +47 -27
  32. data/spec/grape/exceptions/invalid_formatter_spec.rb +1 -1
  33. data/spec/grape/exceptions/invalid_versioner_option_spec.rb +1 -1
  34. data/spec/grape/exceptions/missing_mime_type_spec.rb +2 -2
  35. data/spec/grape/exceptions/missing_option_spec.rb +1 -1
  36. data/spec/grape/exceptions/unknown_options_spec.rb +1 -1
  37. data/spec/grape/exceptions/unknown_validator_spec.rb +1 -1
  38. data/spec/grape/middleware/auth/basic_spec.rb +3 -3
  39. data/spec/grape/middleware/auth/digest_spec.rb +4 -4
  40. data/spec/grape/middleware/auth/oauth2_spec.rb +11 -11
  41. data/spec/grape/middleware/base_spec.rb +9 -9
  42. data/spec/grape/middleware/error_spec.rb +4 -4
  43. data/spec/grape/middleware/exception_spec.rb +17 -17
  44. data/spec/grape/middleware/formatter_spec.rb +38 -38
  45. data/spec/grape/middleware/versioner/accept_version_header_spec.rb +11 -11
  46. data/spec/grape/middleware/versioner/header_spec.rb +39 -39
  47. data/spec/grape/middleware/versioner/param_spec.rb +10 -10
  48. data/spec/grape/middleware/versioner/path_spec.rb +7 -7
  49. data/spec/grape/middleware/versioner_spec.rb +4 -4
  50. data/spec/grape/path_spec.rb +6 -6
  51. data/spec/grape/util/hash_stack_spec.rb +22 -22
  52. data/spec/grape/validations/coerce_spec.rb +34 -34
  53. data/spec/grape/validations/default_spec.rb +16 -16
  54. data/spec/grape/validations/exactly_one_of_spec.rb +71 -0
  55. data/spec/grape/validations/mutual_exclusion_spec.rb +61 -0
  56. data/spec/grape/validations/presence_spec.rb +34 -34
  57. data/spec/grape/validations/regexp_spec.rb +11 -4
  58. data/spec/grape/validations/values_spec.rb +34 -20
  59. data/spec/grape/validations_spec.rb +300 -147
  60. data/spec/shared/versioning_examples.rb +18 -18
  61. data/spec/spec_helper.rb +2 -1
  62. metadata +81 -38
@@ -7,30 +7,30 @@ describe Grape::Middleware::Versioner::Param do
7
7
 
8
8
  it 'sets the API version based on the default param (apiver)' do
9
9
  env = Rack::MockRequest.env_for("/awesome", params: { "apiver" => "v1" })
10
- subject.call(env)[1]["api.version"].should == 'v1'
10
+ expect(subject.call(env)[1]["api.version"]).to eq('v1')
11
11
  end
12
12
 
13
- it 'cuts (only) the version out of the params', focus: true do
13
+ it 'cuts (only) the version out of the params' do
14
14
  env = Rack::MockRequest.env_for("/awesome", params: { "apiver" => "v1", "other_param" => "5" })
15
15
  env['rack.request.query_hash'] = Rack::Utils.parse_nested_query(env['QUERY_STRING'])
16
- subject.call(env)[1]['rack.request.query_hash']["apiver"].should be_nil
17
- subject.call(env)[1]['rack.request.query_hash']["other_param"].should == "5"
16
+ expect(subject.call(env)[1]['rack.request.query_hash']["apiver"]).to be_nil
17
+ expect(subject.call(env)[1]['rack.request.query_hash']["other_param"]).to eq("5")
18
18
  end
19
19
 
20
20
  it 'provides a nil version if no version is given' do
21
21
  env = Rack::MockRequest.env_for("/")
22
- subject.call(env).last.should be_nil
22
+ expect(subject.call(env).last).to be_nil
23
23
  end
24
24
 
25
25
  context 'with specified parameter name' do
26
26
  before { @options = { parameter: 'v' } }
27
27
  it 'sets the API version based on the custom parameter name' do
28
28
  env = Rack::MockRequest.env_for("/awesome", params: { "v" => "v1" })
29
- subject.call(env)[1]["api.version"].should == "v1"
29
+ expect(subject.call(env)[1]["api.version"]).to eq("v1")
30
30
  end
31
31
  it 'does not set the API version based on the default param' do
32
32
  env = Rack::MockRequest.env_for("/awesome", params: { "apiver" => "v1" })
33
- subject.call(env)[1]["api.version"].should be_nil
33
+ expect(subject.call(env)[1]["api.version"]).to be_nil
34
34
  end
35
35
  end
36
36
 
@@ -38,11 +38,11 @@ describe Grape::Middleware::Versioner::Param do
38
38
  before { @options = { versions: ['v1', 'v2'] } }
39
39
  it 'throws an error if a non-allowed version is specified' do
40
40
  env = Rack::MockRequest.env_for("/awesome", params: { "apiver" => "v3" })
41
- catch(:error) { subject.call(env) }[:status].should == 404
41
+ expect(catch(:error) { subject.call(env) }[:status]).to eq(404)
42
42
  end
43
43
  it 'allows versions that have been specified' do
44
44
  env = Rack::MockRequest.env_for("/awesome", params: { "apiver" => "v1" })
45
- subject.call(env)[1]["api.version"].should == 'v1'
45
+ expect(subject.call(env)[1]["api.version"]).to eq('v1')
46
46
  end
47
47
  end
48
48
 
@@ -52,7 +52,7 @@ describe Grape::Middleware::Versioner::Param do
52
52
  version_options: { using: :header }
53
53
  }
54
54
  env = Rack::MockRequest.env_for("/awesome", params: {})
55
- subject.call(env).first.should == 200
55
+ expect(subject.call(env).first).to eq(200)
56
56
  end
57
57
 
58
58
  end
@@ -5,25 +5,25 @@ describe Grape::Middleware::Versioner::Path do
5
5
  subject { Grape::Middleware::Versioner::Path.new(app, @options || {}) }
6
6
 
7
7
  it 'sets the API version based on the first path' do
8
- subject.call('PATH_INFO' => '/v1/awesome').last.should == 'v1'
8
+ expect(subject.call('PATH_INFO' => '/v1/awesome').last).to eq('v1')
9
9
  end
10
10
 
11
11
  it 'does not cut the version out of the path' do
12
- subject.call('PATH_INFO' => '/v1/awesome')[1]['PATH_INFO'].should == '/v1/awesome'
12
+ expect(subject.call('PATH_INFO' => '/v1/awesome')[1]['PATH_INFO']).to eq('/v1/awesome')
13
13
  end
14
14
 
15
15
  it 'provides a nil version if no path is given' do
16
- subject.call('PATH_INFO' => '/').last.should be_nil
16
+ expect(subject.call('PATH_INFO' => '/').last).to be_nil
17
17
  end
18
18
 
19
19
  context 'with a pattern' do
20
20
  before { @options = { pattern: /v./i } }
21
21
  it 'sets the version if it matches' do
22
- subject.call('PATH_INFO' => '/v1/awesome').last.should == 'v1'
22
+ expect(subject.call('PATH_INFO' => '/v1/awesome').last).to eq('v1')
23
23
  end
24
24
 
25
25
  it 'ignores the version if it fails to match' do
26
- subject.call('PATH_INFO' => '/awesome/radical').last.should be_nil
26
+ expect(subject.call('PATH_INFO' => '/awesome/radical').last).to be_nil
27
27
  end
28
28
  end
29
29
 
@@ -32,11 +32,11 @@ describe Grape::Middleware::Versioner::Path do
32
32
  before { @options = { versions: versions } }
33
33
 
34
34
  it 'throws an error if a non-allowed version is specified' do
35
- catch(:error) { subject.call('PATH_INFO' => '/v3/awesome') }[:status].should == 404
35
+ expect(catch(:error) { subject.call('PATH_INFO' => '/v3/awesome') }[:status]).to eq(404)
36
36
  end
37
37
 
38
38
  it 'allows versions that have been specified' do
39
- subject.call('PATH_INFO' => '/v1/asoasd').last.should == 'v1'
39
+ expect(subject.call('PATH_INFO' => '/v1/asoasd').last).to eq('v1')
40
40
  end
41
41
  end
42
42
  end
@@ -5,18 +5,18 @@ describe Grape::Middleware::Versioner do
5
5
  let(:klass) { Grape::Middleware::Versioner }
6
6
 
7
7
  it 'recognizes :path' do
8
- klass.using(:path).should == Grape::Middleware::Versioner::Path
8
+ expect(klass.using(:path)).to eq(Grape::Middleware::Versioner::Path)
9
9
  end
10
10
 
11
11
  it 'recognizes :header' do
12
- klass.using(:header).should == Grape::Middleware::Versioner::Header
12
+ expect(klass.using(:header)).to eq(Grape::Middleware::Versioner::Header)
13
13
  end
14
14
 
15
15
  it 'recognizes :param' do
16
- klass.using(:param).should == Grape::Middleware::Versioner::Param
16
+ expect(klass.using(:param)).to eq(Grape::Middleware::Versioner::Param)
17
17
  end
18
18
 
19
19
  it 'recognizes :accept_version_header' do
20
- klass.using(:accept_version_header).should == Grape::Middleware::Versioner::AcceptVersionHeader
20
+ expect(klass.using(:accept_version_header)).to eq(Grape::Middleware::Versioner::AcceptVersionHeader)
21
21
  end
22
22
  end
@@ -185,7 +185,7 @@ module Grape
185
185
  context "when path versioning is used" do
186
186
  it "includes a '/'" do
187
187
  path = Path.new(nil, nil, {})
188
- path.stub(:uses_path_versioning?) { true }
188
+ allow(path).to receive(:uses_path_versioning?) { true }
189
189
 
190
190
  expect(path.suffix).to eql('(/.:format)')
191
191
  end
@@ -194,21 +194,21 @@ module Grape
194
194
  context "when path versioning is not used" do
195
195
  it "does not include a '/' when the path has a namespace" do
196
196
  path = Path.new(nil, 'namespace', {})
197
- path.stub(:uses_path_versioning?) { true }
197
+ allow(path).to receive(:uses_path_versioning?) { true }
198
198
 
199
199
  expect(path.suffix).to eql('(.:format)')
200
200
  end
201
201
 
202
202
  it "does not include a '/' when the path has a path" do
203
203
  path = Path.new('/path', nil, {})
204
- path.stub(:uses_path_versioning?) { true }
204
+ allow(path).to receive(:uses_path_versioning?) { true }
205
205
 
206
206
  expect(path.suffix).to eql('(.:format)')
207
207
  end
208
208
 
209
209
  it "includes a '/' otherwise" do
210
210
  path = Path.new(nil, nil, {})
211
- path.stub(:uses_path_versioning?) { true }
211
+ allow(path).to receive(:uses_path_versioning?) { true }
212
212
 
213
213
  expect(path.suffix).to eql('(/.:format)')
214
214
  end
@@ -218,8 +218,8 @@ module Grape
218
218
  describe "#path_with_suffix" do
219
219
  it "combines the path and suffix" do
220
220
  path = Path.new(nil, nil, {})
221
- path.stub(:path) { '/the/path' }
222
- path.stub(:suffix) { 'suffix' }
221
+ allow(path).to receive(:path) { '/the/path' }
222
+ allow(path).to receive(:suffix) { 'suffix' }
223
223
 
224
224
  expect(path.path_with_suffix).to eql('/the/pathsuffix')
225
225
  end
@@ -6,11 +6,11 @@ describe Grape::Util::HashStack do
6
6
  it 'finds the first available key' do
7
7
  subject[:abc] = 123
8
8
  subject.push(abc: 345)
9
- subject.get(:abc).should == 345
9
+ expect(subject.get(:abc)).to eq(345)
10
10
  end
11
11
 
12
12
  it 'is nil if the key has not been set' do
13
- subject[:abc].should be_nil
13
+ expect(subject[:abc]).to be_nil
14
14
  end
15
15
  end
16
16
 
@@ -18,7 +18,7 @@ describe Grape::Util::HashStack do
18
18
  it 'sets a value on the highest frame' do
19
19
  subject.push
20
20
  subject.set(:abc, 123)
21
- subject.stack.last[:abc].should == 123
21
+ expect(subject.stack.last[:abc]).to eq(123)
22
22
  end
23
23
  end
24
24
 
@@ -27,96 +27,96 @@ describe Grape::Util::HashStack do
27
27
  subject[:abc] = []
28
28
  subject.imbue :abc, [123]
29
29
  subject.imbue :abc, [456]
30
- subject[:abc].should == [123, 456]
30
+ expect(subject[:abc]).to eq([123, 456])
31
31
  end
32
32
 
33
33
  it 'merges a hash that is passed' do
34
34
  subject[:abc] = { foo: 'bar' }
35
35
  subject.imbue :abc, baz: 'wich'
36
- subject[:abc].should == { foo: 'bar', baz: 'wich' }
36
+ expect(subject[:abc]).to eq(foo: 'bar', baz: 'wich')
37
37
  end
38
38
 
39
39
  it 'sets the value if not a hash or array' do
40
40
  subject.imbue :abc, 123
41
- subject[:abc].should == 123
41
+ expect(subject[:abc]).to eq(123)
42
42
  end
43
43
 
44
44
  it 'is able to imbue an array without explicit setting' do
45
45
  subject.imbue :arr, [1]
46
46
  subject.imbue :arr, [2]
47
- subject[:arr].should == [1, 2]
47
+ expect(subject[:arr]).to eq([1, 2])
48
48
  end
49
49
 
50
50
  it 'is able to imbue a hash without explicit setting' do
51
51
  subject.imbue :hash, foo: 'bar'
52
52
  subject.imbue :hash, baz: 'wich'
53
- subject[:hash].should == { foo: 'bar', baz: 'wich' }
53
+ expect(subject[:hash]).to eq(foo: 'bar', baz: 'wich')
54
54
  end
55
55
  end
56
56
 
57
57
  describe '#push' do
58
58
  it 'returns a HashStack' do
59
- subject.push(Grape::Util::HashStack.new).should be_kind_of(Grape::Util::HashStack)
59
+ expect(subject.push(Grape::Util::HashStack.new)).to be_kind_of(Grape::Util::HashStack)
60
60
  end
61
61
 
62
62
  it 'places the passed value on the top of the stack' do
63
63
  subject.push(abc: 123)
64
- subject.stack.should == [{}, { abc: 123 }]
64
+ expect(subject.stack).to eq([{}, { abc: 123 }])
65
65
  end
66
66
 
67
67
  it 'pushes an empty hash by default' do
68
68
  subject[:abc] = 123
69
69
  subject.push
70
- subject.stack.should == [{ abc: 123 }, {}]
70
+ expect(subject.stack).to eq([{ abc: 123 }, {}])
71
71
  end
72
72
  end
73
73
 
74
74
  describe '#pop' do
75
75
  it 'removes and return the top frame' do
76
76
  subject.push(abc: 123)
77
- subject.pop.should == { abc: 123 }
78
- subject.stack.size.should == 1
77
+ expect(subject.pop).to eq(abc: 123)
78
+ expect(subject.stack.size).to eq(1)
79
79
  end
80
80
  end
81
81
 
82
82
  describe '#peek' do
83
83
  it 'returns the top frame without removing it' do
84
84
  subject.push(abc: 123)
85
- subject.peek.should == { abc: 123 }
86
- subject.stack.size.should == 2
85
+ expect(subject.peek).to eq(abc: 123)
86
+ expect(subject.stack.size).to eq(2)
87
87
  end
88
88
  end
89
89
 
90
90
  describe '#prepend' do
91
91
  it 'returns a HashStack' do
92
- subject.prepend(Grape::Util::HashStack.new).should be_kind_of(Grape::Util::HashStack)
92
+ expect(subject.prepend(Grape::Util::HashStack.new)).to be_kind_of(Grape::Util::HashStack)
93
93
  end
94
94
 
95
95
  it "prepends a HashStack's stack onto its own stack" do
96
96
  other = Grape::Util::HashStack.new.push(abc: 123)
97
- subject.prepend(other).stack.should == [{}, { abc: 123 }, {}]
97
+ expect(subject.prepend(other).stack).to eq([{}, { abc: 123 }, {}])
98
98
  end
99
99
  end
100
100
 
101
101
  describe '#concat' do
102
102
  it 'returns a HashStack' do
103
- subject.concat(Grape::Util::HashStack.new).should be_kind_of(Grape::Util::HashStack)
103
+ expect(subject.concat(Grape::Util::HashStack.new)).to be_kind_of(Grape::Util::HashStack)
104
104
  end
105
105
 
106
106
  it "appends a HashStack's stack onto its own stack" do
107
107
  other = Grape::Util::HashStack.new.push(abc: 123)
108
- subject.concat(other).stack.should == [{}, {}, { abc: 123 }]
108
+ expect(subject.concat(other).stack).to eq([{}, {}, { abc: 123 }])
109
109
  end
110
110
  end
111
111
 
112
112
  describe '#update' do
113
113
  it 'merges! into the top frame' do
114
114
  subject.update(abc: 123)
115
- subject.stack.should == [{ abc: 123 }]
115
+ expect(subject.stack).to eq([{ abc: 123 }])
116
116
  end
117
117
 
118
118
  it 'returns a HashStack' do
119
- subject.update(abc: 123).should be_kind_of(Grape::Util::HashStack)
119
+ expect(subject.update(abc: 123)).to be_kind_of(Grape::Util::HashStack)
120
120
  end
121
121
  end
122
122
 
@@ -126,7 +126,7 @@ describe Grape::Util::HashStack do
126
126
  subject.push def: 234
127
127
  clone = subject.clone
128
128
  clone[:def] = 345
129
- subject[:def].should == 234
129
+ expect(subject[:def]).to eq(234)
130
130
  end
131
131
  end
132
132
  end
@@ -30,8 +30,8 @@ describe Grape::Validations::CoerceValidator do
30
30
  end
31
31
 
32
32
  get '/single', age: '43a'
33
- last_response.status.should == 400
34
- last_response.body.should == '年龄格式不正确'
33
+ expect(last_response.status).to eq(400)
34
+ expect(last_response.body).to eq('年龄格式不正确')
35
35
  end
36
36
 
37
37
  it 'gives an english fallback error when default locale message is blank' do
@@ -44,8 +44,8 @@ describe Grape::Validations::CoerceValidator do
44
44
  end
45
45
 
46
46
  get '/single', age: '43a'
47
- last_response.status.should == 400
48
- last_response.body.should == 'age is invalid'
47
+ expect(last_response.status).to eq(400)
48
+ expect(last_response.body).to eq('age is invalid')
49
49
  end
50
50
 
51
51
  end
@@ -59,12 +59,12 @@ describe Grape::Validations::CoerceValidator do
59
59
  end
60
60
 
61
61
  get '/single', int: '43a'
62
- last_response.status.should == 400
63
- last_response.body.should == 'int is invalid'
62
+ expect(last_response.status).to eq(400)
63
+ expect(last_response.body).to eq('int is invalid')
64
64
 
65
65
  get '/single', int: '43'
66
- last_response.status.should == 200
67
- last_response.body.should == 'int works'
66
+ expect(last_response.status).to eq(200)
67
+ expect(last_response.body).to eq('int works')
68
68
  end
69
69
 
70
70
  it 'error on malformed input (Array)' do
@@ -76,12 +76,12 @@ describe Grape::Validations::CoerceValidator do
76
76
  end
77
77
 
78
78
  get 'array', ids: ['1', '2', 'az']
79
- last_response.status.should == 400
80
- last_response.body.should == 'ids is invalid'
79
+ expect(last_response.status).to eq(400)
80
+ expect(last_response.body).to eq('ids is invalid')
81
81
 
82
82
  get 'array', ids: ['1', '2', '890']
83
- last_response.status.should == 200
84
- last_response.body.should == 'array int works'
83
+ expect(last_response.status).to eq(200)
84
+ expect(last_response.body).to eq('array int works')
85
85
  end
86
86
 
87
87
  context 'complex objects' do
@@ -102,12 +102,12 @@ describe Grape::Validations::CoerceValidator do
102
102
  end
103
103
 
104
104
  get '/user', user: "32"
105
- last_response.status.should == 400
106
- last_response.body.should == 'user is invalid'
105
+ expect(last_response.status).to eq(400)
106
+ expect(last_response.body).to eq('user is invalid')
107
107
 
108
108
  get '/user', user: { id: 32, name: 'Bob' }
109
- last_response.status.should == 200
110
- last_response.body.should == 'complex works'
109
+ expect(last_response.status).to eq(200)
110
+ expect(last_response.body).to eq('complex works')
111
111
  end
112
112
  end
113
113
 
@@ -121,8 +121,8 @@ describe Grape::Validations::CoerceValidator do
121
121
  end
122
122
 
123
123
  get '/int', int: "45"
124
- last_response.status.should == 200
125
- last_response.body.should == 'Fixnum'
124
+ expect(last_response.status).to eq(200)
125
+ expect(last_response.body).to eq('Fixnum')
126
126
  end
127
127
 
128
128
  it 'Array of Integers' do
@@ -134,8 +134,8 @@ describe Grape::Validations::CoerceValidator do
134
134
  end
135
135
 
136
136
  get '/array', arry: ['1', '2', '3']
137
- last_response.status.should == 200
138
- last_response.body.should == 'Fixnum'
137
+ expect(last_response.status).to eq(200)
138
+ expect(last_response.body).to eq('Fixnum')
139
139
  end
140
140
 
141
141
  it 'Array of Bools' do
@@ -147,8 +147,8 @@ describe Grape::Validations::CoerceValidator do
147
147
  end
148
148
 
149
149
  get 'array', arry: [1, 0]
150
- last_response.status.should == 200
151
- last_response.body.should == 'TrueClass'
150
+ expect(last_response.status).to eq(200)
151
+ expect(last_response.body).to eq('TrueClass')
152
152
  end
153
153
 
154
154
  it 'Bool' do
@@ -160,20 +160,20 @@ describe Grape::Validations::CoerceValidator do
160
160
  end
161
161
 
162
162
  get '/bool', bool: 1
163
- last_response.status.should == 200
164
- last_response.body.should == 'TrueClass'
163
+ expect(last_response.status).to eq(200)
164
+ expect(last_response.body).to eq('TrueClass')
165
165
 
166
166
  get '/bool', bool: 0
167
- last_response.status.should == 200
168
- last_response.body.should == 'FalseClass'
167
+ expect(last_response.status).to eq(200)
168
+ expect(last_response.body).to eq('FalseClass')
169
169
 
170
170
  get '/bool', bool: 'false'
171
- last_response.status.should == 200
172
- last_response.body.should == 'FalseClass'
171
+ expect(last_response.status).to eq(200)
172
+ expect(last_response.body).to eq('FalseClass')
173
173
 
174
174
  get '/bool', bool: 'true'
175
- last_response.status.should == 200
176
- last_response.body.should == 'TrueClass'
175
+ expect(last_response.status).to eq(200)
176
+ expect(last_response.body).to eq('TrueClass')
177
177
  end
178
178
 
179
179
  it 'file' do
@@ -185,8 +185,8 @@ describe Grape::Validations::CoerceValidator do
185
185
  end
186
186
 
187
187
  post '/upload', file: Rack::Test::UploadedFile.new(__FILE__)
188
- last_response.status.should == 201
189
- last_response.body.should == File.basename(__FILE__).to_s
188
+ expect(last_response.status).to eq(201)
189
+ expect(last_response.body).to eq(File.basename(__FILE__).to_s)
190
190
  end
191
191
 
192
192
  it 'Nests integers' do
@@ -200,8 +200,8 @@ describe Grape::Validations::CoerceValidator do
200
200
  end
201
201
 
202
202
  get '/int', integers: { int: "45" }
203
- last_response.status.should == 200
204
- last_response.body.should == 'Fixnum'
203
+ expect(last_response.status).to eq(200)
204
+ expect(last_response.body).to eq('Fixnum')
205
205
  end
206
206
  end
207
207
  end