debian-mirror-gitlab/spec/features/commits/user_view_commits_spec.rb

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

66 lines
1.9 KiB
Ruby
Raw Permalink Normal View History

2020-05-24 23:13:21 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'Commit > User view commits', feature_category: :source_code_management do
2022-10-11 01:57:18 +05:30
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group, :public) }
2020-05-24 23:13:21 +05:30
2022-10-11 01:57:18 +05:30
shared_examples 'can view commits' do
2020-05-24 23:13:21 +05:30
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
it 'lists the correct number of commits' do
expect(page).to have_selector('#commits-list > li:nth-child(2) > ul', count: 1)
end
end
2022-10-11 01:57:18 +05:30
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
2020-05-24 23:13:21 +05:30
end