spec/grape/middleware/versioner_spec.rb in grape-0.0.0.alpha.2 vs spec/grape/middleware/versioner_spec.rb in grape-0.1.0
- old
+ new
@@ -24,6 +24,17 @@
it 'should ignore the version if it fails to match' do
subject.call('PATH_INFO' => '/awesome/radical').last.should be_nil
end
end
+
+ context 'with specified versions' do
+ before{ @options = {:versions => ['v1', 'v2']}}
+ it 'should throw an error if a non-allowed version is specified' do
+ catch(:error){subject.call('PATH_INFO' => '/v3/awesome')}[:status].should == 404
+ end
+
+ it 'should allow versions that have been specified' do
+ subject.call('PATH_INFO' => '/v1/asoasd').last.should == 'v1'
+ end
+ end
end
\ No newline at end of file