Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/commits_spec.rb')
-rw-r--r--spec/features/commits_spec.rb41
1 files changed, 39 insertions, 2 deletions
diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb
index f538df89fd3..d8b886b239f 100644
--- a/spec/features/commits_spec.rb
+++ b/spec/features/commits_spec.rb
@@ -3,8 +3,8 @@
require 'spec_helper'
describe 'Commits' do
- let(:project) { create(:project, :repository) }
- let(:user) { create(:user) }
+ let_it_be(:project) { create(:project, :repository) }
+ let_it_be(:user) { create(:user) }
describe 'CI' do
before do
@@ -183,4 +183,41 @@ describe 'Commits' do
expect(find('.js-project-refs-dropdown')).to have_content branch_name
end
end
+
+ context 'viewing commits for an author' do
+ let(:author_commit) { project.repository.commits(nil, limit: 1).first }
+ let(:commits) { project.repository.commits(nil, author: author, limit: 40) }
+
+ before do
+ project.add_maintainer(user)
+ sign_in(user)
+ visit project_commits_path(project, nil, author: author)
+ end
+
+ shared_examples 'show commits by author' do
+ it "includes the author's commits" do
+ commits.each do |commit|
+ expect(page).to have_content("#{author_commit.author_name} authored #{commit.authored_date.strftime("%b %d, %Y")}")
+ end
+ end
+ end
+
+ context 'author is complete' do
+ let(:author) { "#{author_commit.author_name} <#{author_commit.author_email}>" }
+
+ it_behaves_like 'show commits by author'
+ end
+
+ context 'author is just a name' do
+ let(:author) { "#{author_commit.author_name}" }
+
+ it_behaves_like 'show commits by author'
+ end
+
+ context 'author is just an email' do
+ let(:author) { "#{author_commit.author_email}" }
+
+ it_behaves_like 'show commits by author'
+ end
+ end
end