Commit 5722d893 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '6114-move-some-features-projects-specs-ee' into 'master'

Resolve "Extract EE specific files/lines for some projects features specs"

Closes #6114

See merge request gitlab-org/gitlab-ee!5802
parents f1adf825 fef9955e
require 'spec_helper'
describe 'Project active tab' do
let(:user) { create :user }
let(:project) { create(:project, :repository) }
before do
project.add_master(user)
sign_in(user)
end
def click_tab(title)
page.within '.sidebar-top-level-items > .active' do
click_link(title)
end
end
shared_examples 'page has active tab' do |title|
it "activates #{title} tab" do
expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
expect(find('.sidebar-top-level-items > li.active')).to have_content(title)
end
end
shared_examples 'page has active sub tab' do |title|
it "activates #{title} sub tab" do
expect(page).to have_selector('.sidebar-sub-level-items > li.active:not(.fly-out-top-item)', count: 1)
expect(find('.sidebar-sub-level-items > li.active:not(.fly-out-top-item)'))
.to have_content(title)
end
end
context 'on project Home' do
before do
visit project_path(project)
end
it_behaves_like 'page has active tab', 'Overview'
context 'on project Home/Activity' do
before do
click_tab('Activity')
end
it_behaves_like 'page has active tab', 'Overview'
end
end
end
require 'spec_helper'
require 'tempfile'
feature 'Jobs', :clean_gitlab_redis_shared_state do
let(:user) { create(:user) }
let(:user_access_level) { :developer }
let(:pipeline) { create(:ci_pipeline, project: project) }
let(:job) { create(:ci_build, :trace_live, pipeline: pipeline) }
before do
project.add_role(user, user_access_level)
sign_in(user)
end
describe "GET /:project/jobs/:id" do
context 'job project is over shared runners limit' do
let(:group) { create(:group, :with_used_build_minutes_limit) }
let(:project) { create(:project, :repository, namespace: group, shared_runners_enabled: true) }
it 'displays a warning message' do
visit project_job_path(project, job)
expect(page).to have_content('You have used all your shared Runners pipeline minutes.')
end
end
end
end
require 'spec_helper'
feature 'Projects > Members > Member leaves project' do
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
background do
project.add_developer(user)
sign_in(user)
visit project_path(project)
end
context 'when the user has been specifically allowed to access a protected branch' do
let(:other_user) { create(:user) }
let!(:matching_protected_branch) { create(:protected_branch, authorize_user_to_push: user, authorize_user_to_merge: user, project: project) }
let!(:non_matching_protected_branch) { create(:protected_branch, authorize_user_to_push: other_user, authorize_user_to_merge: other_user, project: project) }
context 'user leaves project' do
scenario "removes the user's branch permissions" do
click_link 'Leave project'
expect(current_path).to eq(dashboard_projects_path)
expect(matching_protected_branch.push_access_levels.where(user: user)).not_to exist
expect(matching_protected_branch.merge_access_levels.where(user: user)).not_to exist
expect(non_matching_protected_branch.push_access_levels.where(user: other_user)).to exist
expect(non_matching_protected_branch.merge_access_levels.where(user: other_user)).to exist
end
end
end
end
require 'rails_helper'
feature 'Projects > Show > Developer views empty project instructions' do
let(:project) { create(:project, :empty_repo) }
let(:developer) { create(:user) }
background do
project.add_developer(developer)
sign_in(developer)
end
context 'with Kerberos enabled' do
background do
allow(Gitlab.config.kerberos).to receive(:enabled).and_return(true)
end
scenario 'defaults to KRB5' do
visit project_path(project)
expect(page).to have_content("git clone #{project.kerberos_url_to_repo}")
end
end
end
require 'spec_helper'
describe 'Projects > User sees sidebar' do
let(:user) { create(:user) }
let(:project) { create(:project, :private, public_builds: false, namespace: user.namespace) }
context 'as guest' do
let(:guest) { create(:user) }
before do
project.add_guest(guest)
sign_in(guest)
end
it 'shows allowed tabs only' do
visit project_path(project)
within('.nav-sidebar') do
expect(page).to have_content 'Overview'
end
end
end
end
......@@ -370,17 +370,6 @@ feature 'Jobs', :clean_gitlab_redis_shared_state do
end
end
context 'job project is over shared runners limit' do
let(:group) { create(:group, :with_used_build_minutes_limit) }
let(:project) { create(:project, :repository, namespace: group, shared_runners_enabled: true) }
it 'displays a warning message' do
visit project_job_path(project, job)
expect(page).to have_content('You have used all your shared Runners pipeline minutes.')
end
end
context 'Playable manual action' do
let(:job) { create(:ci_build, :playable, pipeline: pipeline) }
......
......@@ -16,22 +16,4 @@ feature 'Projects > Members > Member leaves project' do
expect(current_path).to eq(dashboard_projects_path)
expect(project.users.exists?(user.id)).to be_falsey
end
context 'when the user has been specifically allowed to access a protected branch' do
let(:other_user) { create(:user) }
let!(:matching_protected_branch) { create(:protected_branch, authorize_user_to_push: user, authorize_user_to_merge: user, project: project) }
let!(:non_matching_protected_branch) { create(:protected_branch, authorize_user_to_push: other_user, authorize_user_to_merge: other_user, project: project) }
context 'user leaves project' do
scenario "removes the user's branch permissions" do
click_link 'Leave project'
expect(current_path).to eq(dashboard_projects_path)
expect(matching_protected_branch.push_access_levels.where(user: user)).not_to exist
expect(matching_protected_branch.merge_access_levels.where(user: user)).not_to exist
expect(non_matching_protected_branch.push_access_levels.where(user: other_user)).to exist
expect(non_matching_protected_branch.merge_access_levels.where(user: other_user)).to exist
end
end
end
end
......@@ -64,10 +64,6 @@ feature 'Project milestone' do
end
end
def milestone_path
project_milestone_path(project, milestone)
end
context 'when project has an issue' do
before do
create(:issue, project: project, milestone: milestone)
......
......@@ -46,18 +46,6 @@ feature 'Projects > Show > Developer views empty project instructions' do
end
end
context 'with Kerberos enabled' do
background do
allow(Gitlab.config.kerberos).to receive(:enabled).and_return(true)
end
scenario 'defaults to KRB5' do
visit_project
expect_instructions_for('kerberos')
end
end
def visit_project
visit project_path(project)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment