mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-21 10:36:04 +10:00
Revert "Fix: models/ci/mail_service_spec.rb"
This reverts commit 345ff6cbf9.
This requires sidekiq >= 3.4 and fixed all other CE tests
This commit is contained in:
@@ -29,11 +29,6 @@ describe Ci::MailService do
|
||||
|
||||
describe 'Sends email for' do
|
||||
let(:mail) { Ci::MailService.new }
|
||||
let(:deliveries) { ActionMailer::Base.deliveries}
|
||||
|
||||
before(:each) do
|
||||
deliveries.clear
|
||||
end
|
||||
|
||||
describe 'failed build' do
|
||||
let(:project) { FactoryGirl.create(:ci_project, email_add_pusher: true) }
|
||||
@@ -47,10 +42,13 @@ describe Ci::MailService do
|
||||
end
|
||||
|
||||
it do
|
||||
should_email("git@example.com")
|
||||
mail.execute(build)
|
||||
expect(deliveries.count).to eq(1)
|
||||
expect(deliveries[0].subject).to include('Build failed for')
|
||||
expect(deliveries[0].to).to eq(["git@example.com"])
|
||||
end
|
||||
|
||||
def should_email(email)
|
||||
expect(Notify).to receive(:build_fail_email).with(build.id, email)
|
||||
expect(Notify).not_to receive(:build_success_email).with(build.id, email)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -66,10 +64,13 @@ describe Ci::MailService do
|
||||
end
|
||||
|
||||
it do
|
||||
should_email("git@example.com")
|
||||
mail.execute(build)
|
||||
expect(deliveries.count).to eq(1)
|
||||
expect(deliveries[0].subject).to include('Build success for')
|
||||
expect(deliveries[0].to).to eq(["git@example.com"])
|
||||
end
|
||||
|
||||
def should_email(email)
|
||||
expect(Notify).to receive(:build_success_email).with(build.id, email)
|
||||
expect(Notify).not_to receive(:build_fail_email).with(build.id, email)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -90,12 +91,14 @@ describe Ci::MailService do
|
||||
end
|
||||
|
||||
it do
|
||||
should_email("git@example.com")
|
||||
should_email("jeroen@example.com")
|
||||
mail.execute(build)
|
||||
expect(deliveries.count).to eq(2)
|
||||
expect(deliveries[0].subject).to include('Build success for')
|
||||
expect(deliveries[0].to).to eq(["jeroen@example.com"])
|
||||
expect(deliveries[1].subject).to include('Build success for')
|
||||
expect(deliveries[1].to).to eq(["git@example.com"])
|
||||
end
|
||||
|
||||
def should_email(email)
|
||||
expect(Notify).to receive(:build_success_email).with(build.id, email)
|
||||
expect(Notify).not_to receive(:build_fail_email).with(build.id, email)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -116,8 +119,14 @@ describe Ci::MailService do
|
||||
end
|
||||
|
||||
it do
|
||||
should_email(commit.git_author_email)
|
||||
should_email("jeroen@example.com")
|
||||
mail.execute(build) if mail.can_execute?(build)
|
||||
expect(deliveries.count).to eq(0)
|
||||
end
|
||||
|
||||
def should_email(email)
|
||||
expect(Notify).not_to receive(:build_success_email).with(build.id, email)
|
||||
expect(Notify).not_to receive(:build_fail_email).with(build.id, email)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -161,8 +170,14 @@ describe Ci::MailService do
|
||||
|
||||
it do
|
||||
Ci::Build.retry(build)
|
||||
should_email(commit.git_author_email)
|
||||
should_email("jeroen@example.com")
|
||||
mail.execute(build) if mail.can_execute?(build)
|
||||
expect(deliveries.count).to eq(0)
|
||||
end
|
||||
|
||||
def should_email(email)
|
||||
expect(Notify).not_to receive(:build_success_email).with(build.id, email)
|
||||
expect(Notify).not_to receive(:build_fail_email).with(build.id, email)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user