2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::BuildAccess do
|
2018-10-15 14:42:47 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project) }
|
|
|
|
|
|
|
|
describe '#can_do_action' do
|
2020-10-24 23:57:45 +05:30
|
|
|
subject { described_class.new(user, container: project).can_do_action?(:download_code) }
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
context 'when the user can do an action on the project but cannot access git' do
|
|
|
|
before do
|
|
|
|
user.block!
|
|
|
|
project.add_developer(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be(true) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when the user cannot do an action on the project' do
|
|
|
|
it { is_expected.to be(false) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|