debian-mirror-gitlab/spec/models/exported_protected_branch_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
794 B
Ruby
Raw Normal View History

2021-02-22 17:27:13 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe ExportedProtectedBranch do
describe 'Associations' do
it { is_expected.to have_many(:push_access_levels) }
end
describe '.push_access_levels' do
it 'returns the correct push access levels' do
exported_branch = create(:exported_protected_branch, :developers_can_push)
deploy_key = create(:deploy_key)
2023-01-13 00:05:48 +05:30
create(:deploy_keys_project, :write_access, project: exported_branch.project, deploy_key: deploy_key)
2021-02-22 17:27:13 +05:30
create(:protected_branch_push_access_level, protected_branch: exported_branch, deploy_key: deploy_key)
dev_push_access_level = exported_branch.push_access_levels.first
expect(exported_branch.push_access_levels).to contain_exactly(dev_push_access_level)
end
end
end