2019-07-25 01:21:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-10 10:13:05 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 05:08:32 -04:00
|
|
|
RSpec.describe Gitlab::BuildAccess do
|
2018-05-10 10:13:05 -04:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project) }
|
|
|
|
|
|
|
|
describe '#can_do_action' do
|
2020-07-21 14:09:45 -04:00
|
|
|
subject { described_class.new(user, container: project).can_do_action?(:download_code) }
|
2018-05-10 10:13:05 -04:00
|
|
|
|
|
|
|
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
|