diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-05-19 12:58:45 -0700 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-06-05 05:32:26 -0700 |
commit | 23d37382dabe3f7c7f2e11df2731de8e939e0cab (patch) | |
tree | c0730c393fef5582dfdfdbbd41ad8340a5c5cd45 /spec/lib/gitlab/git_access_wiki_spec.rb | |
parent | 957edb13fdb21e21efbc68fc342209f4b53a66e4 (diff) | |
download | gitlab-ce-23d37382dabe3f7c7f2e11df2731de8e939e0cab.tar.gz |
Refactor to let GitAccess errors bubble up
No external behavior change.
This allows `GitHttpController` to set the HTTP status based on the type of error. Alternatively, we could have added an attribute to GitAccessStatus, but this pattern seemed appropriate.
Diffstat (limited to 'spec/lib/gitlab/git_access_wiki_spec.rb')
-rw-r--r-- | spec/lib/gitlab/git_access_wiki_spec.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/spec/lib/gitlab/git_access_wiki_spec.rb b/spec/lib/gitlab/git_access_wiki_spec.rb index 1ae293416e4..a1eb95750ba 100644 --- a/spec/lib/gitlab/git_access_wiki_spec.rb +++ b/spec/lib/gitlab/git_access_wiki_spec.rb @@ -20,7 +20,7 @@ describe Gitlab::GitAccessWiki, lib: true do subject { access.check('git-receive-pack', changes) } - it { expect(subject.allowed?).to be_truthy } + it { expect { subject }.not_to raise_error } end def changes @@ -36,7 +36,7 @@ describe Gitlab::GitAccessWiki, lib: true do context 'when wiki feature is enabled' do it 'give access to download wiki code' do - expect(subject.allowed?).to be_truthy + expect { subject }.not_to raise_error end end @@ -44,8 +44,7 @@ describe Gitlab::GitAccessWiki, lib: true do it 'does not give access to download wiki code' do project.project_feature.update_attribute(:wiki_access_level, ProjectFeature::DISABLED) - expect(subject.allowed?).to be_falsey - expect(subject.message).to match(/You are not allowed to download code/) + expect { subject }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'You are not allowed to download code from this project.') end end end |