debian-mirror-gitlab/spec/features/projects/user_views_empty_project_spec.rb

60 lines
1.3 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-05-09 12:01:36 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'User views an empty project' do
2018-05-09 12:01:36 +05:30
let(:project) { create(:project, :empty_repo) }
let(:user) { create(:user) }
shared_examples 'allowing push to default branch' do
2021-02-22 17:27:13 +05:30
it 'shows push-to-master instructions' do
2018-05-09 12:01:36 +05:30
visit project_path(project)
expect(page).to have_content('git push -u origin master')
end
end
2018-11-18 11:00:15 +05:30
describe 'as a maintainer' do
2018-05-09 12:01:36 +05:30
before do
2018-11-18 11:00:15 +05:30
project.add_maintainer(user)
2021-02-22 17:27:13 +05:30
sign_in(user)
2018-05-09 12:01:36 +05:30
end
it_behaves_like 'allowing push to default branch'
end
describe 'as an admin' do
let(:user) { create(:user, :admin) }
2021-02-22 17:27:13 +05:30
context 'when admin mode is enabled' do
before do
sign_in(user)
gitlab_enable_admin_mode_sign_in(user)
end
it_behaves_like 'allowing push to default branch'
end
context 'when admin mode is disabled' do
it 'does not show push-to-master instructions' do
visit project_path(project)
expect(page).not_to have_content('git push -u origin master')
end
end
2018-05-09 12:01:36 +05:30
end
describe 'as a developer' do
before do
project.add_developer(user)
sign_in(user)
end
it 'does not show push-to-master instructions' do
2021-02-22 17:27:13 +05:30
visit project_path(project)
2018-05-09 12:01:36 +05:30
expect(page).not_to have_content('git push -u origin master')
end
end
end