Closed
Description
Regression from #1263
require 'spec_helper'
describe Grape::Endpoint do
subject { Class.new(Grape::API) }
def app
subject
end
before do
subject.namespace :api do
get ':id(/:ext)' do
[ params[:id], params[:ext] ].compact.join('/')
end
put ':id' do
params[:id]
end
end
end
context 'get' do
it 'responds without ext' do
get '/api/foo'
expect(last_response.status).to eq 200
expect(last_response.body).to eq 'foo'
end
it 'responds with ext' do
get '/api/foo/bar'
expect(last_response.status).to eq 200
expect(last_response.body).to eq 'foo/bar'
end
end
context 'put' do
it 'responds' do
put '/api/foo'
expect(last_response.status).to eq 200
expect(last_response.body).to eq 'foo'
end
end
end
Passes in 0.14.0, fails on HEAD (0.15.0)
Grape::Endpoint
get
responds without ext (FAILED - 1)
responds with ext
put
responds (FAILED - 2)
Failures:
1) Grape::Endpoint get responds without ext
Failure/Error: expect(last_response.status).to eq 200
expected: 200
got: 405
(compared using ==)
# ./spec/grape/integration/methods_with_options_spec.rb:25:in `block (3 levels) in <top (required)>'
2) Grape::Endpoint put responds
Failure/Error: expect(last_response.status).to eq 200
expected: 200
got: 405
(compared using ==)
# ./spec/grape/integration/methods_with_options_spec.rb:39:in `block (3 levels) in <top (required)>'
Finished in 0.16979 seconds (files took 0.67914 seconds to load)
3 examples, 2 failures
Failed examples:
rspec ./spec/grape/integration/methods_with_options_spec.rb:23 # Grape::Endpoint get responds without ext
rspec ./spec/grape/integration/methods_with_options_spec.rb:37 # Grape::Endpoint put responds