summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/git_access_wiki_spec.rb
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2017-05-19 12:58:45 -0700
committerMichael Kozono <mkozono@gmail.com>2017-06-05 05:32:26 -0700
commit23d37382dabe3f7c7f2e11df2731de8e939e0cab (patch)
treec0730c393fef5582dfdfdbbd41ad8340a5c5cd45 /spec/lib/gitlab/git_access_wiki_spec.rb
parent957edb13fdb21e21efbc68fc342209f4b53a66e4 (diff)
downloadgitlab-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.rb7
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