Commit 9e66ac69d4a39c01e2cbbe0efda23240b8b56bcd

Authored by Nathan Broadbent
1 parent 246b113b
Exists in master and in 1 other branch production

Fixed specs for deploy email notifications (so that they don't rely on default values.)

spec/controllers/deploys_controller_spec.rb
@@ -12,7 +12,7 @@ describe DeploysController do @@ -12,7 +12,7 @@ describe DeploysController do
12 'scm_revision' => '19d77837eef37902cf5df7e4445c85f392a8d0d5', 12 'scm_revision' => '19d77837eef37902cf5df7e4445c85f392a8d0d5',
13 'message' => 'johns first deploy' 13 'message' => 'johns first deploy'
14 } 14 }
15 - @app = Factory(:app_with_watcher, :api_key => 'APIKEY') 15 + @app = Factory(:app_with_watcher, :notify_on_deploys => true, :api_key => 'APIKEY')
16 end 16 end
17 17
18 it 'finds the app via the api key' do 18 it 'finds the app via the api key' do
@@ -34,7 +34,7 @@ describe DeploysController do @@ -34,7 +34,7 @@ describe DeploysController do
34 post :create, :deploy => @params, :api_key => 'APIKEY' 34 post :create, :deploy => @params, :api_key => 'APIKEY'
35 end 35 end
36 36
37 - it 'sends an email notification' do 37 + it 'sends an email notification when configured to do so' do
38 post :create, :deploy => @params, :api_key => 'APIKEY' 38 post :create, :deploy => @params, :api_key => 'APIKEY'
39 email = ActionMailer::Base.deliveries.last 39 email = ActionMailer::Base.deliveries.last
40 email.to.should include(@app.watchers.first.email) 40 email.to.should include(@app.watchers.first.email)
@@ -61,3 +61,4 @@ describe DeploysController do @@ -61,3 +61,4 @@ describe DeploysController do
61 end 61 end
62 62
63 end 63 end
  64 +
spec/models/deploy_spec.rb
@@ -20,7 +20,7 @@ describe Deploy do @@ -20,7 +20,7 @@ describe Deploy do
20 it 'should send an email notification' do 20 it 'should send an email notification' do
21 Mailer.should_receive(:deploy_notification). 21 Mailer.should_receive(:deploy_notification).
22 and_return(mock('email', :deliver => true)) 22 and_return(mock('email', :deliver => true))
23 - Factory(:deploy, :app => Factory(:app_with_watcher)) 23 + Factory(:deploy, :app => Factory(:app_with_watcher, :notify_on_deploys => true))
24 end 24 end
25 25
26 context 'when the app has resolve_errs_on_deploy set to false' do 26 context 'when the app has resolve_errs_on_deploy set to false' do