Commit a387ff7b authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix specs after renaming authentication_capabilities

parent e941365f
...@@ -29,17 +29,17 @@ module LfsHelper ...@@ -29,17 +29,17 @@ module LfsHelper
end end
def user_can_download_code? 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 end
def build_can_download_code? 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 end
def lfs_upload_access? def lfs_upload_access?
return false unless project.lfs_enabled? 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 end
def render_lfs_forbidden def render_lfs_forbidden
......
...@@ -26,8 +26,9 @@ describe Gitlab::Auth, lib: true do ...@@ -26,8 +26,9 @@ describe Gitlab::Auth, lib: true do
end end
end end
context 'for non-running build' do (HasStatus::AVAILABLE_STATUSES - [:running]).each do |build_status|
let!(:build) { create(:ci_build, :pending) } context "for #{build_status} build" do
let!(:build) { create(:ci_build, status: build_status) }
let(:project) { build.project } let(:project) { build.project }
before do before do
...@@ -35,7 +36,8 @@ describe Gitlab::Auth, lib: true do ...@@ -35,7 +36,8 @@ describe Gitlab::Auth, lib: true do
end end
it 'denies authentication' do it 'denies authentication' do
expect(subject).to eq(Gitlab::Auth::Result.new) expect(subject).not_to eq(Gitlab::Auth::Result.new)
end
end end
end end
end end
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::GitAccessWiki, lib: true do 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(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:authentication_abilities) do let(:authentication_abilities) do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment