diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-11-29 17:31:42 -0200 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-11-30 16:02:25 -0200 |
commit | e7d794770afeac37b8e2fe53d7f86c9e418e870a (patch) | |
tree | 161140e9dd74c4a5ccf9a1a430fdb37b519ed3af /spec/lib/gitlab/git_access_wiki_spec.rb | |
parent | 42c332689deb2fcbb3eb71d5134d583f4518b65f (diff) | |
download | gitlab-ce-e7d794770afeac37b8e2fe53d7f86c9e418e870a.tar.gz |
Improve Gitlab::GitAccessWiki spec with download access checks
Diffstat (limited to 'spec/lib/gitlab/git_access_wiki_spec.rb')
-rw-r--r-- | spec/lib/gitlab/git_access_wiki_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git_access_wiki_spec.rb b/spec/lib/gitlab/git_access_wiki_spec.rb index 576aa5c366f..578db51631e 100644 --- a/spec/lib/gitlab/git_access_wiki_spec.rb +++ b/spec/lib/gitlab/git_access_wiki_spec.rb @@ -26,4 +26,29 @@ describe Gitlab::GitAccessWiki, lib: true do def changes ['6f6d7e7ed 570e7b2ab refs/heads/master'] end + + describe '#download_access_check' do + subject { access.check('git-upload-pack', '_any') } + + before do + project.team << [user, :developer] + end + + context 'when wiki feature is enabled' do + it 'give access to download wiki code' do + project.project_feature.update_attribute(:wiki_access_level, ProjectFeature::ENABLED) + + expect(subject.allowed?).to be_truthy + end + end + + context 'when wiki feature is disabled' 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/) + end + end + end end |