Skip to content

Commit

Permalink
[ISSUE-2350] Implement failing spec for recognize_path
Browse files Browse the repository at this point in the history
  • Loading branch information
glebsonik committed Sep 28, 2023
1 parent d390315 commit 7f62ea0
Showing 1 changed file with 27 additions and 0 deletions.
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

0 comments on commit 7f62ea0

Please sign in to comment.