spec/parameter_exclusivity_spec.rb in sinatra-param-1.3.1 vs spec/parameter_exclusivity_spec.rb in sinatra-param-1.4.0
- old
+ new
@@ -8,23 +8,23 @@
{b: 2, c: 3},
{a: 1, b: 2, c: 3}
]
params.each do |param|
- get('/choice/3', param) do |response|
+ get('/one_of/3', param) do |response|
expect(response.status).to eql 400
- expect(JSON.parse(response.body)['message']).to match(/mutually exclusive/)
+ expect(JSON.parse(response.body)['message']).to match(/^Invalid parameters/)
end
end
end
it 'returns 400 on requests that contain more than one mutually exclusive parameter' do
params = {a: 1, b: 2}
- get('/choice/2', params) do |response|
+ get('/one_of/2', params) do |response|
expect(response.status).to eql 400
- expect(JSON.parse(response.body)['message']).to match(/mutually exclusive/)
+ expect(JSON.parse(response.body)['message']).to match(/^Invalid parameters/)
end
end
it 'returns successfully for requests that have one parameter' do
params = [
@@ -33,20 +33,20 @@
{c: 3}
]
(1..3).each do |n|
params.each do |param|
- get("/choice/#{n}", param) do |response|
+ get("/one_of/#{n}", param) do |response|
expect(response.status).to eql 200
expect(JSON.parse(response.body)['message']).to match(/OK/)
end
end
end
end
it 'returns successfully for requests that have no parameter' do
(1..3).each do |n|
- get("/choice/#{n}") do |response|
+ get("/one_of/#{n}") do |response|
expect(response.status).to eql 200
expect(JSON.parse(response.body)['message']).to match(/OK/)
end
end
end