Commit eb525849 authored by Robert May's avatar Robert May

Adjust spec style, check author name

parent 32ece4b1
......@@ -185,19 +185,20 @@ describe 'Commits' do
end
context 'viewing commits for an author' do
let(:author_commit) { project.repository.commits(nil, limit: 1).first }
let(:author) { "#{author_commit.author_name} <#{author_commit.author_email}>" }
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
it 'includes the committed_date for each commit' do
it 'includes the author name and committed_date for each commit' do
author_commit = project.repository.commits(nil, limit: 1).first
author = "#{author_commit.author_name} <#{author_commit.author_email}>"
commits = project.repository.commits(nil, author: author, limit: 40)
visit project_commits_path(project, nil, author: author)
commits.each do |commit|
expect(page).to have_content("authored #{commit.authored_date.strftime("%b %d, %Y")}")
expect(page).to have_content("#{author_commit.author_name} authored #{commit.authored_date.strftime("%b %d, %Y")}")
end
end
end
......
......@@ -321,15 +321,16 @@ describe Repository do
end
context "when 'author' is set" do
let(:commit) { repository.commits(nil, limit: 1).first }
let(:known_author) { "#{commit.author_name} <#{commit.author_email}>" }
let(:unknown_author) { "The Man With No Name <zapp@brannigan.com>" }
it "returns commits from that author" do
commit = repository.commits(nil, limit: 1).first
known_author = "#{commit.author_name} <#{commit.author_email}>"
expect(repository.commits(nil, author: known_author, limit: 1).size).to be > 0
end
it "doesn't returns commits from an unknown author" do
unknown_author = "The Man With No Name <zapp@brannigan.com>"
expect(repository.commits(nil, author: unknown_author, limit: 1).size).to eq(0)
end
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