spec/unit/pacto/stubs/uri_pattern_spec.rb in pacto-0.4.0.rc1 vs spec/unit/pacto/stubs/uri_pattern_spec.rb in pacto-0.4.0.rc2

- old
+ new

@@ -19,25 +19,24 @@ request = Fabricate(:request_clause, host: 'myhost.com', path: '/stuff') uri_pattern = UriPattern.for(request) expect(uri_pattern.pattern).to eql('{scheme}://myhost.com/stuff{?anyvars*}') end - it 'convers segments preceded by : into variables', :deprecated do - request = Fabricate(:request_clause, host: 'myhost.com', path: '/:id') - uri_pattern = UriPattern.for(request) - expect(uri_pattern.keys).to include('id') - expect(uri_pattern.pattern).to_not include(':id') + it 'fails if segment uses : syntax' do + expect do + Fabricate(:request_clause, host: 'myhost.com', path: '/:id') + end.to raise_error(/old syntax no longer supported/) end it 'creates a regex that does not allow additional path elements' do - request = Fabricate(:request_clause, host: 'myhost.com', path: '/:id') + request = Fabricate(:request_clause, host: 'myhost.com', path: '/{id}') pattern = UriPattern.for(request) expect(pattern).to match('http://myhost.com/foo') expect(pattern).to_not match('http://myhost.com/foo/bar') end - it 'creates a regex that does allow query parameters', :deprecated do - request = Fabricate(:request_clause, host: 'myhost.com', path: '/:id') + it 'creates a regex that does allow query parameters' do + request = Fabricate(:request_clause, host: 'myhost.com', path: '/{id}') pattern = UriPattern.for(request) expect(pattern.match('http://myhost.com/foo?a=b')). to be_truthy expect(pattern.match('http://myhost.com/foo?a=b&c=d')).to be_truthy end end