debian-mirror-gitlab/spec/policies/group_deploy_keys_group_policy_spec.rb

26 lines
818 B
Ruby
Raw Normal View History

2020-10-24 23:57:45 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe GroupDeployKeysGroupPolicy do
subject { described_class.new(user, group_deploy_keys_group) }
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:group_deploy_key) { create(:group_deploy_key) }
2021-04-29 21:17:54 +05:30
2020-10-24 23:57:45 +05:30
let(:group_deploy_keys_group) { create(:group_deploy_keys_group, group: group, group_deploy_key: group_deploy_key) }
describe 'edit a group deploy key for a given group' do
it 'is allowed when the user is an owner of this group' do
group.add_owner(user)
expect(subject).to be_allowed(:update_group_deploy_key_for_group)
end
it 'is not allowed when the user is not an owner of this group' do
expect(subject).to be_disallowed(:update_group_deploy_key_for_group)
end
end
end