Commit 8ec8aa14 authored by Robert Speicher's avatar Robert Speicher

Use `:empty_project` where possible in mailer specs

parent d4c99f64
...@@ -184,6 +184,7 @@ describe Notify do ...@@ -184,6 +184,7 @@ describe Notify do
end end
context 'for merge requests' do context 'for merge requests' do
let(:project) { create(:project, :repository) }
let(:merge_author) { create(:user) } let(:merge_author) { create(:user) }
let(:merge_request) { create(:merge_request, author: current_user, assignee: assignee, source_project: project, target_project: project) } let(:merge_request) { create(:merge_request, author: current_user, assignee: assignee, source_project: project, target_project: project) }
let(:merge_request_with_description) { create(:merge_request, author: current_user, assignee: assignee, source_project: project, target_project: project, description: FFaker::Lorem.sentence) } let(:merge_request_with_description) { create(:merge_request, author: current_user, assignee: assignee, source_project: project, target_project: project, description: FFaker::Lorem.sentence) }
...@@ -334,7 +335,7 @@ describe Notify do ...@@ -334,7 +335,7 @@ describe Notify do
end end
describe 'project was moved' do describe 'project was moved' do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject { Notify.project_was_moved_email(project.id, user.id, "gitlab/gitlab") } subject { Notify.project_was_moved_email(project.id, user.id, "gitlab/gitlab") }
...@@ -460,7 +461,7 @@ describe Notify do ...@@ -460,7 +461,7 @@ describe Notify do
end end
describe 'project invitation' do describe 'project invitation' do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:master) { create(:user).tap { |u| project.team << [u, :master] } } let(:master) { create(:user).tap { |u| project.team << [u, :master] } }
let(:project_member) { invite_to_project(project, inviter: master) } let(:project_member) { invite_to_project(project, inviter: master) }
...@@ -480,7 +481,7 @@ describe Notify do ...@@ -480,7 +481,7 @@ describe Notify do
end end
describe 'project invitation accepted' do describe 'project invitation accepted' do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:invited_user) { create(:user, name: 'invited user') } let(:invited_user) { create(:user, name: 'invited user') }
let(:master) { create(:user).tap { |u| project.team << [u, :master] } } let(:master) { create(:user).tap { |u| project.team << [u, :master] } }
let(:project_member) do let(:project_member) do
...@@ -505,7 +506,7 @@ describe Notify do ...@@ -505,7 +506,7 @@ describe Notify do
end end
describe 'project invitation declined' do describe 'project invitation declined' do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:master) { create(:user).tap { |u| project.team << [u, :master] } } let(:master) { create(:user).tap { |u| project.team << [u, :master] } }
let(:project_member) do let(:project_member) do
invitee = invite_to_project(project, inviter: master) invitee = invite_to_project(project, inviter: master)
...@@ -569,6 +570,7 @@ describe Notify do ...@@ -569,6 +570,7 @@ describe Notify do
end end
describe 'on a commit' do describe 'on a commit' do
let(:project) { create(:project, :repository) }
let(:commit) { project.commit } let(:commit) { project.commit }
before(:each) { allow(note).to receive(:noteable).and_return(commit) } before(:each) { allow(note).to receive(:noteable).and_return(commit) }
...@@ -636,6 +638,7 @@ describe Notify do ...@@ -636,6 +638,7 @@ describe Notify do
end end
context 'items that are noteable, emails for a note on a diff' do context 'items that are noteable, emails for a note on a diff' do
let(:project) { create(:project, :repository) }
let(:note_author) { create(:user, name: 'author_name') } let(:note_author) { create(:user, name: 'author_name') }
before :each do before :each do
...@@ -977,6 +980,7 @@ describe Notify do ...@@ -977,6 +980,7 @@ describe Notify do
end end
describe 'email on push with multiple commits' do describe 'email on push with multiple commits' do
let(:project) { create(:project, :repository) }
let(:example_site_path) { root_path } let(:example_site_path) { root_path }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:raw_compare) { Gitlab::Git::Compare.new(project.repository.raw_repository, sample_image_commit.id, sample_commit.id) } let(:raw_compare) { Gitlab::Git::Compare.new(project.repository.raw_repository, sample_image_commit.id, sample_commit.id) }
...@@ -1070,6 +1074,7 @@ describe Notify do ...@@ -1070,6 +1074,7 @@ describe Notify do
end end
describe 'email on push with a single commit' do describe 'email on push with a single commit' do
let(:project) { create(:project, :repository) }
let(:example_site_path) { root_path } let(:example_site_path) { root_path }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:raw_compare) { Gitlab::Git::Compare.new(project.repository.raw_repository, sample_commit.parent_id, sample_commit.id) } let(:raw_compare) { Gitlab::Git::Compare.new(project.repository.raw_repository, sample_commit.parent_id, sample_commit.id) }
...@@ -1102,7 +1107,7 @@ describe Notify do ...@@ -1102,7 +1107,7 @@ describe Notify do
end end
describe 'HTML emails setting' do describe 'HTML emails setting' do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:multipart_mail) { Notify.project_was_moved_email(project.id, user.id, "gitlab/gitlab") } let(:multipart_mail) { Notify.project_was_moved_email(project.id, user.id, "gitlab/gitlab") }
......
...@@ -3,7 +3,7 @@ shared_context 'gitlab email notification' do ...@@ -3,7 +3,7 @@ shared_context 'gitlab email notification' do
let(:gitlab_sender) { Gitlab.config.gitlab.email_from } let(:gitlab_sender) { Gitlab.config.gitlab.email_from }
let(:gitlab_sender_reply_to) { Gitlab.config.gitlab.email_reply_to } let(:gitlab_sender_reply_to) { Gitlab.config.gitlab.email_reply_to }
let(:recipient) { create(:user, email: 'recipient@example.com') } let(:recipient) { create(:user, email: 'recipient@example.com') }
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:new_user_address) { 'newguy@example.com' } let(:new_user_address) { 'newguy@example.com' }
before do before do
......
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