summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorJeroen Knoops <jeroen.knoops@gmail.com>2013-11-30 23:11:41 +0100
committerJeroen Knoops <jeroen.knoops@gmail.com>2013-11-30 23:11:41 +0100
commitfcda188a1c5d254c1b09ce4bf1f4a75dce90d98b (patch)
tree40058843f8b930425d4e4bcb5e77af4f03bd5613 /spec/services
parent326f41269dbc2cf0c4f25dc3266d6218326d8cdf (diff)
downloadgitlab-ci-fcda188a1c5d254c1b09ce4bf1f4a75dce90d98b.tar.gz
Send email notification on change of build status from success to failed and failed to success
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/notification_service_spec.rb19
1 files changed, 9 insertions, 10 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index 841763a..1f2038e 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -6,7 +6,7 @@ describe NotificationService do
describe 'Builds' do
describe 'failed build' do
- let(:project) { FactoryGirl.create(:project, :email_only_breaking_build => true)}
+ let(:project) { FactoryGirl.create(:project)}
let(:build) { FactoryGirl.create(:build, :status => :failed, :project => project) }
it do
@@ -20,26 +20,27 @@ describe NotificationService do
end
end
- describe 'successfull build when only breaking builds should trigger email' do
- let(:project) { FactoryGirl.create(:project, :email_only_breaking_build => true)}
+ describe 'successfull build' do
+ let(:project) { FactoryGirl.create(:project)}
let(:build) { FactoryGirl.create(:build, :status => :success, :project => project) }
it do
- should_not_email(build.git_author_email)
+ should_email(build.git_author_email)
notification.build_ended(build)
end
- def should_not_email(email)
- Notify.should_not_receive(:build_success_email).with(build.id, email)
+ def should_email(email)
+ Notify.should_receive(:build_success_email).with(build.id, email)
Notify.should_not_receive(:build_fail_email).with(build.id, email)
end
end
- describe 'successfull build when all builds should trigger email' do
- let(:project) { FactoryGirl.create(:project, :email_only_breaking_build => false)}
+ describe 'successfull build and project has email_recipients' do
+ let(:project) { FactoryGirl.create(:project, :email_recipients => "jeroen@example.com")}
let(:build) { FactoryGirl.create(:build, :status => :success, :project => project) }
it do
should_email(build.git_author_email)
+ should_email("jeroen@example.com")
notification.build_ended(build)
end
@@ -48,8 +49,6 @@ describe NotificationService do
Notify.should_not_receive(:build_fail_email).with(build.id, email)
end
end
-
-
end
end