spec/grape/dsl/routing_spec.rb in grape-1.6.0 vs spec/grape/dsl/routing_spec.rb in grape-1.6.1
- old
+ new
@@ -10,10 +10,11 @@
end
end
describe Routing do
subject { Class.new(RoutingSpec::Dummy) }
+
let(:proc) { -> {} }
let(:options) { { a: :b } }
let(:path) { '/dummy' }
describe '.version' do
@@ -107,11 +108,11 @@
end
it 'does not duplicate identical endpoints' do
subject.route(:any)
expect { subject.route(:any) }
- .to_not change(subject.endpoints, :count)
+ .not_to change(subject.endpoints, :count)
end
it 'generates correct endpoint options' do
allow(subject).to receive(:route_setting).with(:description).and_return(fiz: 'baz')
allow(subject).to receive(:namespace_stackable_with_hash).and_return(nuz: 'naz')
@@ -231,35 +232,37 @@
context 'when #routes was already called once' do
before do
allow(subject).to receive(:prepare_routes).and_return(routes)
subject.routes
end
- it 'it does not call prepare_routes again' do
- expect(subject).to_not receive(:prepare_routes)
+
+ it 'does not call prepare_routes again' do
+ expect(subject).not_to receive(:prepare_routes)
expect(subject.routes).to eq routes
end
end
end
describe '.route_param' do
+ let!(:options) { { requirements: regex } }
+ let(:regex) { /(.*)/ }
+
it 'calls #namespace with given params' do
expect(subject).to receive(:namespace).with(':foo', {}).and_yield
subject.route_param('foo', {}, &proc {})
end
- let(:regex) { /(.*)/ }
- let!(:options) { { requirements: regex } }
it 'nests requirements option under param name' do
expect(subject).to receive(:namespace) do |_param, options|
expect(options[:requirements][:foo]).to eq regex
end
subject.route_param('foo', options, &proc {})
end
it 'does not modify options parameter' do
allow(subject).to receive(:namespace)
expect { subject.route_param('foo', options, &proc {}) }
- .to_not change { options }
+ .not_to change { options }
end
end
describe '.versions' do
it 'returns last defined version' do