Commit a387ff7b authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix specs after renaming authentication_capabilities

parent e941365f
......@@ -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
......
......@@ -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
......
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
......
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