diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-05 12:12:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-05 12:12:22 +0300 |
commit | a7ad6496140ba3272b2d88d8e79e7e4d699f5653 (patch) | |
tree | 7a6160629434cd1322c90739b55014f01c638577 /spec/features/commits | |
parent | 6d706d5dc036fb40f4d7b8e6619c3c78335620aa (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/commits')
-rw-r--r-- | spec/features/commits/user_view_commits_spec.rb | 57 |
1 files changed, 50 insertions, 7 deletions
diff --git a/spec/features/commits/user_view_commits_spec.rb b/spec/features/commits/user_view_commits_spec.rb index 5907534220d..f7fd3a6e209 100644 --- a/spec/features/commits/user_view_commits_spec.rb +++ b/spec/features/commits/user_view_commits_spec.rb @@ -3,14 +3,10 @@ require 'spec_helper' RSpec.describe 'Commit > User view commits' do - let_it_be(:project) { create(:project, :public, :repository) } - let_it_be(:user) { project.creator } + let_it_be(:user) { create(:user) } + let_it_be(:group) { create(:group, :public) } - before do - visit project_commits_path(project) - end - - describe 'Commits List' do + shared_examples 'can view commits' do it 'displays the correct number of commits per day in the header' do expect(first('.js-commit-header').find('.commits-count').text).to eq('1 commit') end @@ -19,4 +15,51 @@ RSpec.describe 'Commit > User view commits' do expect(page).to have_selector('#commits-list > li:nth-child(2) > ul', count: 1) end end + + describe 'Commits List' do + context 'when project is public' do + let(:project) { create(:project, :public, :repository, group: group) } + + before do + visit project_commits_path(project) + end + + it_behaves_like 'can view commits' + end + + context 'when project is public with private repository' do + let(:project) { create(:project, :public, :repository, :repository_private, group: group) } + + context 'and user is an inherited member from the group' do + context 'and user is a guest' do + before do + group.add_guest(user) + sign_in(user) + visit project_commits_path(project) + end + + it_behaves_like 'can view commits' + end + end + end + + context 'when project is private' do + let(:project) { create(:project, :private, :repository, group: group) } + + context 'and user is an inherited member from the group' do + context 'and user is a guest' do + before do + group.add_guest(user) + sign_in(user) + visit project_commits_path(project) + end + + it 'renders not found' do + expect(page).to have_title('Not Found') + expect(page).to have_content('Page Not Found') + end + end + end + end + end end |