Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE-2350] recognize_path incorrectly incorrectly recognizes path #2352

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions spec/grape/api/recognize_path_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,32 @@
subject.get {}
expect(subject.recognize_path('/bar/1234')).to be_nil
end

context 'given parametrized route and static route' do
subject do
Class.new(described_class) do
resource :books do
route_param :id, type: Integer do
# GET /books/:id
get do
'book by id'
end
end

resource :share do
# POST /books/share
post do
'books share'
end
end
end
end
end

it 'recognizes it as static' do
actual = subject.recognize_path('/books/share').routes[0].origin
expect(actual).to eq('/books/share')
end
end
end
end