Guard against regressions in commit email specs

This commit is contained in:
Nick Thomas 2018-09-18 10:04:15 +01:00
parent 12f9879295
commit 5a88391579
No known key found for this signature in database
GPG Key ID: 2A313A47AFADACE9
5 changed files with 12 additions and 5 deletions

View File

@ -184,11 +184,12 @@ class ProjectWiki
def commit_details(action, message = nil, title = nil)
commit_message = message || default_message(action, title)
git_user = Gitlab::Git::User.from_gitlab(@user)
Gitlab::Git::Wiki::CommitDetails.new(@user.id,
@user.username,
@user.name,
@user.commit_email,
git_user.username,
git_user.name,
git_user.email,
commit_message)
end

View File

@ -280,6 +280,7 @@ describe ProjectWiki do
it 'sets the correct commit email' do
subject.create_page('test page', 'content')
expect(user.commit_email).not_to eq(user.email)
expect(commit.author_email).to eq(user.commit_email)
expect(commit.committer_email).to eq(user.commit_email)
end
@ -329,6 +330,7 @@ describe ProjectWiki do
end
it 'sets the correct commit email' do
expect(user.commit_email).not_to eq(user.email)
expect(commit.author_email).to eq(user.commit_email)
expect(commit.committer_email).to eq(user.commit_email)
end
@ -363,6 +365,7 @@ describe ProjectWiki do
it 'sets the correct commit email' do
subject.delete_page(@page)
expect(user.commit_email).not_to eq(user.email)
expect(commit.author_email).to eq(user.commit_email)
expect(commit.committer_email).to eq(user.commit_email)
end

View File

@ -84,6 +84,7 @@ describe Files::CreateService do
it 'uses the commit email' do
subject.execute
expect(user.commit_email).not_to eq(user.email)
expect(commit.author_email).to eq(user.commit_email)
expect(commit.committer_email).to eq(user.commit_email)
end

View File

@ -4,7 +4,7 @@ describe Files::DeleteService do
subject { described_class.new(project, user, commit_params) }
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:user) { create(:user, :commit_email) }
let(:file_path) { 'files/ruby/popen.rb' }
let(:branch_name) { project.default_branch }
let(:last_commit_sha) { nil }
@ -39,6 +39,7 @@ describe Files::DeleteService do
it 'uses the commit email' do
subject.execute
expect(user.commit_email).not_to eq(user.email)
expect(commit.author_email).to eq(user.commit_email)
expect(commit.committer_email).to eq(user.commit_email)
end

View File

@ -4,7 +4,7 @@ describe Files::UpdateService do
subject { described_class.new(project, user, commit_params) }
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:user) { create(:user, :commit_email) }
let(:file_path) { 'files/ruby/popen.rb' }
let(:new_contents) { 'New Content' }
let(:branch_name) { project.default_branch }
@ -59,6 +59,7 @@ describe Files::UpdateService do
it 'uses the commit email' do
subject.execute
expect(user.commit_email).not_to eq(user.email)
expect(commit.author_email).to eq(user.commit_email)
expect(commit.committer_email).to eq(user.commit_email)
end