Commit 75c2e1a3 authored by Robert May's avatar Robert May

Updates to the specs

parent c7fbe3c4
......@@ -185,21 +185,39 @@ describe 'Commits' do
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
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)
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
visit project_commits_path(project, nil, author: author)
context 'author is complete' do
let(:author) { "#{author_commit.author_name} <#{author_commit.author_email}>" }
commits.each do |commit|
expect(page).to have_content("#{author_commit.author_name} authored #{commit.authored_date.strftime("%b %d, %Y")}")
end
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
......@@ -325,13 +325,13 @@ describe Repository 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
expect(repository.commits(nil, author: known_author, limit: 1)).not_to be_empty
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)
expect(repository.commits(nil, author: unknown_author, limit: 1)).to be_empty
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