summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-09-16 11:06:31 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-09-16 11:12:22 +0200
commita387ff7ba85dc75608ae5347aa405ea30b4e8c8c (patch)
tree7121d96944f5a45073e80cc239123c03b4c1ccbb
parente941365f3be88cebd57e9b08ba8702c1b688cb94 (diff)
downloadgitlab-ce-a387ff7ba85dc75608ae5347aa405ea30b4e8c8c.tar.gz
Fix specs after renaming authentication_capabilities
-rw-r--r--app/helpers/lfs_helper.rb6
-rw-r--r--spec/lib/gitlab/auth_spec.rb22
-rw-r--r--spec/lib/gitlab/git_access_wiki_spec.rb2
3 files changed, 16 insertions, 14 deletions
diff --git a/app/helpers/lfs_helper.rb b/app/helpers/lfs_helper.rb
index 0d6b72ff746..018ca7d7bba 100644
--- a/app/helpers/lfs_helper.rb
+++ b/app/helpers/lfs_helper.rb
@@ -29,17 +29,17 @@ module LfsHelper
end
def user_can_download_code?
- has_capability?(:download_code) && user && user.can?(:download_code, project)
+ has_authentication_ability?(:download_code) && can?(user, :download_code, project)
end
def build_can_download_code?
- has_capability?(:build_download_code) && user && user.can?(:build_download_code, project)
+ has_authentication_ability?(:build_download_code) && can?(user, :build_download_code, project)
end
def lfs_upload_access?
return false unless project.lfs_enabled?
- has_capability?(:push_code) && user && user.can?(:push_code, project)
+ has_authentication_ability?(:push_code) && can?(user, :push_code, project)
end
def render_lfs_forbidden
diff --git a/spec/lib/gitlab/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb
index 744282b2afa..d3707005a0e 100644
--- a/spec/lib/gitlab/auth_spec.rb
+++ b/spec/lib/gitlab/auth_spec.rb
@@ -26,16 +26,18 @@ describe Gitlab::Auth, lib: true do
end
end
- context 'for non-running build' do
- let!(:build) { create(:ci_build, :pending) }
- let(:project) { build.project }
-
- before do
- expect(gl_auth).to receive(:rate_limit!).with('ip', success: false, login: 'gitlab-ci-token')
- end
-
- it 'denies authentication' do
- expect(subject).to eq(Gitlab::Auth::Result.new)
+ (HasStatus::AVAILABLE_STATUSES - [:running]).each do |build_status|
+ context "for #{build_status} build" do
+ let!(:build) { create(:ci_build, status: build_status) }
+ let(:project) { build.project }
+
+ before do
+ expect(gl_auth).to receive(:rate_limit!).with('ip', success: false, login: 'gitlab-ci-token')
+ end
+
+ it 'denies authentication' do
+ expect(subject).not_to eq(Gitlab::Auth::Result.new)
+ end
end
end
end
diff --git a/spec/lib/gitlab/git_access_wiki_spec.rb b/spec/lib/gitlab/git_access_wiki_spec.rb
index d05f0beb080..576cda595bb 100644
--- a/spec/lib/gitlab/git_access_wiki_spec.rb
+++ b/spec/lib/gitlab/git_access_wiki_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Gitlab::GitAccessWiki, lib: true do
- let(:access) { Gitlab::GitAccessWiki.new(user, project, 'web', authentication_abilities) }
+ let(:access) { Gitlab::GitAccessWiki.new(user, project, 'web', authentication_abilities: authentication_abilities) }
let(:project) { create(:project) }
let(:user) { create(:user) }
let(:authentication_abilities) do