2022-07-23 23:45:48 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe 'Projects > Settings > Repository > Branch rules settings', feature_category: :projects do
|
2022-07-23 23:45:48 +05:30
|
|
|
let(:project) { create(:project_empty_repo) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:role) { :developer }
|
|
|
|
|
|
|
|
subject(:request) { visit project_settings_repository_branch_rules_path(project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.add_role(user, role)
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'for developer' do
|
|
|
|
let(:role) { :developer }
|
|
|
|
|
|
|
|
it 'is not allowed to view' do
|
|
|
|
request
|
|
|
|
|
|
|
|
expect(page).to have_gitlab_http_status(:not_found)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'for maintainer' do
|
|
|
|
let(:role) { :maintainer }
|
|
|
|
|
|
|
|
context 'Branch rules', :js do
|
|
|
|
it 'renders branch rules page' do
|
|
|
|
request
|
|
|
|
|
|
|
|
expect(page).to have_content('Branch rules')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'branch_rules feature flag disabled' do
|
|
|
|
it 'does not render branch rules content' do
|
|
|
|
stub_feature_flags(branch_rules: false)
|
|
|
|
request
|
|
|
|
|
|
|
|
expect(page).to have_gitlab_http_status(:not_found)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|