sinatra-param 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,7 +18,7 @@ module Sinatra
18
18
  error = {message: error}.to_json
19
19
  end
20
20
 
21
- halt 406, error
21
+ halt 400, error
22
22
  end
23
23
  end
24
24
 
@@ -34,7 +34,7 @@ module Sinatra
34
34
  error = {message: error}.to_json
35
35
  end
36
36
 
37
- halt 406, error
37
+ halt 400, error
38
38
  end
39
39
  end
40
40
  end
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module Param
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
5
5
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe 'Parameter Sets' do
4
4
  describe 'one_of' do
5
- it 'returns 406 on requests that contain more than one mutually exclusive parameter' do
5
+ it 'returns 400 on requests that contain more than one mutually exclusive parameter' do
6
6
  params = [
7
7
  {a: 1, b: 2},
8
8
  {b: 2, c: 3},
@@ -10,7 +10,7 @@ describe 'Parameter Sets' do
10
10
  ]
11
11
  params.each do |param|
12
12
  get('/choice', param) do |response|
13
- response.status.should == 406
13
+ response.status.should == 400
14
14
  JSON.parse(response.body)['message'].should =~ /mutually exclusive/
15
15
  end
16
16
  end
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe 'Parameter Validations' do
4
4
  describe 'required' do
5
- it 'returns 406 on requests without required fields' do
5
+ it 'returns 400 on requests without required fields' do
6
6
  get('/validation/required') do |response|
7
- response.status.should eq(406)
7
+ response.status.should eq(400)
8
8
  JSON.parse(response.body)['message'].should eq('Invalid parameter, arg')
9
9
  end
10
10
  end
@@ -17,30 +17,30 @@ describe 'Parameter Validations' do
17
17
  end
18
18
 
19
19
  describe 'blank' do
20
- it 'returns 406 on requests when string is blank' do
20
+ it 'returns 400 on requests when string is blank' do
21
21
  get('/validation/blank/string', arg: '') do |response|
22
- response.status.should eq(406)
22
+ response.status.should eq(400)
23
23
  JSON.parse(response.body)['message'].should eq('Invalid parameter, arg')
24
24
  end
25
25
  end
26
26
 
27
- it 'returns 406 on requests when array is blank' do
27
+ it 'returns 400 on requests when array is blank' do
28
28
  get('/validation/blank/array', arg: '') do |response|
29
- response.status.should eq(406)
29
+ response.status.should eq(400)
30
30
  JSON.parse(response.body)['message'].should eq('Invalid parameter, arg')
31
31
  end
32
32
  end
33
33
 
34
- it 'returns 406 on requests when hash is blank' do
34
+ it 'returns 400 on requests when hash is blank' do
35
35
  get('/validation/blank/hash', arg: '') do |response|
36
- response.status.should eq(406)
36
+ response.status.should eq(400)
37
37
  JSON.parse(response.body)['message'].should eq('Invalid parameter, arg')
38
38
  end
39
39
  end
40
40
 
41
- it 'returns 406 on requests when hash is blank' do
41
+ it 'returns 400 on requests when hash is blank' do
42
42
  get('/validation/blank/other', arg: '') do |response|
43
- response.status.should eq(406)
43
+ response.status.should eq(400)
44
44
  JSON.parse(response.body)['message'].should eq('Invalid parameter, arg')
45
45
  end
46
46
  end
@@ -53,9 +53,9 @@ describe 'Parameter Validations' do
53
53
  end
54
54
 
55
55
  describe 'is' do
56
- it 'returns 406 on requests when value is other than defined' do
56
+ it 'returns 400 on requests when value is other than defined' do
57
57
  get('/validation/is', arg: 'bar') do |response|
58
- response.status.should eq(406)
58
+ response.status.should eq(400)
59
59
  JSON.parse(response.body)['message'].should eq('Invalid parameter, arg')
60
60
  end
61
61
  end
@@ -68,9 +68,9 @@ describe 'Parameter Validations' do
68
68
  end
69
69
 
70
70
  describe 'in' do
71
- it 'returns 406 on requests with a value not in the set' do
71
+ it 'returns 400 on requests with a value not in the set' do
72
72
  get('/validation/in', arg: 'MISC') do |response|
73
- response.status.should eq(406)
73
+ response.status.should eq(400)
74
74
  JSON.parse(response.body)['message'].should eq('Invalid parameter, arg')
75
75
  end
76
76
  end
@@ -83,9 +83,9 @@ describe 'Parameter Validations' do
83
83
  end
84
84
 
85
85
  describe 'within' do
86
- it 'returns 406 on requests with a value outside the range' do
86
+ it 'returns 400 on requests with a value outside the range' do
87
87
  get('/validation/within', arg: 20) do |response|
88
- response.status.should eq(406)
88
+ response.status.should eq(400)
89
89
  JSON.parse(response.body)['message'].should eq('Invalid parameter, arg')
90
90
  end
91
91
  end
@@ -98,9 +98,9 @@ describe 'Parameter Validations' do
98
98
  end
99
99
 
100
100
  describe 'range' do
101
- it 'returns 406 on requests with a value outside the range' do
101
+ it 'returns 400 on requests with a value outside the range' do
102
102
  get('/validation/range', arg: 20) do |response|
103
- response.status.should eq(406)
103
+ response.status.should eq(400)
104
104
  JSON.parse(response.body)['message'].should eq('Invalid parameter, arg')
105
105
  end
106
106
  end
@@ -113,9 +113,9 @@ describe 'Parameter Validations' do
113
113
  end
114
114
 
115
115
  describe 'min' do
116
- it 'returns 406 on requests with a value smaller than min' do
116
+ it 'returns 400 on requests with a value smaller than min' do
117
117
  get('/validation/min', arg: 5) do |response|
118
- response.status.should eq(406)
118
+ response.status.should eq(400)
119
119
  JSON.parse(response.body)['message'].should eq('Invalid parameter, arg')
120
120
  end
121
121
  end
@@ -128,9 +128,9 @@ describe 'Parameter Validations' do
128
128
  end
129
129
 
130
130
  describe 'max' do
131
- it 'returns 406 on requests with a value larger than max' do
131
+ it 'returns 400 on requests with a value larger than max' do
132
132
  get('/validation/max', arg: 100) do |response|
133
- response.status.should eq(406)
133
+ response.status.should eq(400)
134
134
  JSON.parse(response.body)['message'].should eq('Invalid parameter, arg')
135
135
  end
136
136
  end
@@ -143,9 +143,9 @@ describe 'Parameter Validations' do
143
143
  end
144
144
 
145
145
  describe 'min_length' do
146
- it 'returns 406 on requests with a string shorter than min_length' do
146
+ it 'returns 400 on requests with a string shorter than min_length' do
147
147
  get('/validation/min_length', arg: 'hi') do |response|
148
- response.status.should eq(406)
148
+ response.status.should eq(400)
149
149
  JSON.parse(response.body)['message'].should eq('Invalid parameter, arg')
150
150
  end
151
151
  end
@@ -158,9 +158,9 @@ describe 'Parameter Validations' do
158
158
  end
159
159
 
160
160
  describe 'max_length' do
161
- it 'returns 406 on requests with a string longer than max_length' do
161
+ it 'returns 400 on requests with a string longer than max_length' do
162
162
  get('/validation/max_length', arg: 'reallylongstringlongerthanmax') do |response|
163
- response.status.should eq(406)
163
+ response.status.should eq(400)
164
164
  JSON.parse(response.body)['message'].should eq('Invalid parameter, arg')
165
165
  end
166
166
  end
metadata CHANGED
@@ -1,38 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-param
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
5
- prerelease:
4
+ version: 0.1.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mattt Thompson
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-21 00:00:00.000000000 Z
11
+ date: 2013-04-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: sinatra
16
- requirement: &70339153513320 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.3'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70339153513320
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: simplecov
27
- requirement: &70339153510080 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ! '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *70339153510080
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  description: Parameter Contracts for Sinatra
37
42
  email: m@mattt.me
38
43
  executables: []
@@ -101,33 +106,26 @@ files:
101
106
  - spec/spec_helper.rb
102
107
  homepage: http://github.com/mattt/sinatra-param
103
108
  licenses: []
109
+ metadata: {}
104
110
  post_install_message:
105
111
  rdoc_options: []
106
112
  require_paths:
107
113
  - lib
108
114
  required_ruby_version: !ruby/object:Gem::Requirement
109
- none: false
110
115
  requirements:
111
116
  - - ! '>='
112
117
  - !ruby/object:Gem::Version
113
118
  version: '0'
114
- segments:
115
- - 0
116
- hash: 1586099901428040771
117
119
  required_rubygems_version: !ruby/object:Gem::Requirement
118
- none: false
119
120
  requirements:
120
121
  - - ! '>='
121
122
  - !ruby/object:Gem::Version
122
123
  version: '0'
123
- segments:
124
- - 0
125
- hash: 1586099901428040771
126
124
  requirements: []
127
125
  rubyforge_project:
128
- rubygems_version: 1.8.15
126
+ rubygems_version: 2.0.3
129
127
  signing_key:
130
- specification_version: 3
128
+ specification_version: 4
131
129
  summary: sinatra-param
132
130
  test_files:
133
131
  - spec/dummy/app.rb