Skip to content

Commit bfc27b4

Browse files
committed
Add specs for Routing#routes
1 parent b6b214a commit bfc27b4

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

spec/grape/dsl/routing_spec.rb

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,24 @@ class Dummy
145145
end
146146
end
147147

148-
xdescribe '.routes' do
149-
it 'does some thing'
148+
describe '.routes' do
149+
let(:routes) { Object.new }
150+
151+
it 'returns value received from #prepare_routes' do
152+
expect(subject).to receive(:prepare_routes).and_return(routes)
153+
expect(subject.routes).to eq routes
154+
end
155+
156+
context 'when #routes was already called once' do
157+
before do
158+
allow(subject).to receive(:prepare_routes).and_return(routes)
159+
subject.routes
160+
end
161+
it 'it does not call prepare_routes again' do
162+
expect(subject).to_not receive(:prepare_routes)
163+
expect(subject.routes).to eq routes
164+
end
165+
end
150166
end
151167

152168
xdescribe '.route_param' do

0 commit comments

Comments
 (0)