diff --git a/spec/integration/scopes_spec.rb b/spec/integration/scopes_spec.rb index 6230ee54..f06fd4db 100644 --- a/spec/integration/scopes_spec.rb +++ b/spec/integration/scopes_spec.rb @@ -5,7 +5,7 @@ describe 'App' do FactoryGirl.create(:test, :number => '3.1', :queue => 'builds.common') add_endpoint '/foo' do - get '/hash', scope: [:foo, :bar] do + get '/:id/bar', scope: [:foo, :bar] do respond_with foo: 'bar' end @@ -18,20 +18,20 @@ describe 'App' do it 'checks if token has one of the required scopes' do token = Travis::Api::App::AccessToken.new(app_id: 1, user_id: 2, scopes: [:foo]).tap(&:save) - response = get '/foo/hash', {}, 'HTTP_ACCEPT' => 'application/json', 'HTTP_AUTHORIZATION' => "token #{token.token}" + response = get '/foo/1/bar', {}, 'HTTP_ACCEPT' => 'application/json; version=2', 'HTTP_AUTHORIZATION' => "token #{token.token}" response.should be_successful response.headers['X-Accepted-OAuth-Scopes'].should == 'foo' token = Travis::Api::App::AccessToken.new(app_id: 1, user_id: 2, scopes: [:bar]).tap(&:save) - response = get '/foo/hash', {}, 'HTTP_ACCEPT' => 'application/json', 'HTTP_AUTHORIZATION' => "token #{token.token}" + response = get '/foo/1/bar', {}, 'HTTP_ACCEPT' => 'application/json; version=2', 'HTTP_AUTHORIZATION' => "token #{token.token}" response.should be_successful response.headers['X-Accepted-OAuth-Scopes'].should == 'bar' token = Travis::Api::App::AccessToken.new(app_id: 1, user_id: 2, scopes: [:baz]).tap(&:save) - response = get '/foo/hash', {}, 'HTTP_ACCEPT' => 'application/json', 'HTTP_AUTHORIZATION' => "token #{token.token}" - response.status.should == 403 + response = get '/foo/1/bar', {}, 'HTTP_ACCEPT' => 'application/json; version=2', 'HTTP_AUTHORIZATION' => "token #{token.token}" + response.status.should == 404 end it 'checks if required_params match the from the request' do diff --git a/spec/unit/access_token_spec.rb b/spec/unit/access_token_spec.rb index cfdca57f..3cb8794b 100644 --- a/spec/unit/access_token_spec.rb +++ b/spec/unit/access_token_spec.rb @@ -25,7 +25,7 @@ describe Travis::Api::App::AccessToken do described_class.find_by_token(token.token).should_not be_nil - sleep 1.5 + sleep 2 described_class.find_by_token(token.token).should be_nil end