-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1255 from travis-ci/bugfix_cycle_12
Bugfix cycle 12
- Loading branch information
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
describe Travis::API::V3::Router, set_app: true do | ||
describe '#call' do | ||
let(:env) do | ||
{ | ||
'PATH_INFO' => '/', | ||
'rack.request.query_hash' => {}, | ||
} | ||
end | ||
|
||
context 'when user has no perms' do | ||
before { env['HTTP_AUTHORIZATION'] = 'Token 123' } | ||
|
||
it 'returns a 403 error' do | ||
expect(subject.call(env).first).to eq(403) | ||
end | ||
end | ||
|
||
context 'when user has perms' do | ||
before { env['rack.request.query_hash']['log.token'] = '123' } | ||
|
||
it 'returns a 200 response' do | ||
expect(subject.call(env).first).to eq(200) | ||
end | ||
end | ||
end | ||
end |