Commit f618448d9e119fad0f487db968e4e14d419e28d6
1 parent
056ae34c
Exists in
master
and in
1 other branch
Include 'message' in deploy notice, add tests for app err/deploy notification switches.
Showing
3 changed files
with
22 additions
and
3 deletions
Show diff stats
spec/controllers/deploys_controller_spec.rb
@@ -9,7 +9,8 @@ describe DeploysController do | @@ -9,7 +9,8 @@ describe DeploysController do | ||
9 | 'local_username' => 'john.doe', | 9 | 'local_username' => 'john.doe', |
10 | 'scm_repository' => 'git@github.com/jdpace/errbit.git', | 10 | 'scm_repository' => 'git@github.com/jdpace/errbit.git', |
11 | 'rails_env' => 'production', | 11 | 'rails_env' => 'production', |
12 | - 'scm_revision' => '19d77837eef37902cf5df7e4445c85f392a8d0d5' | 12 | + 'scm_revision' => '19d77837eef37902cf5df7e4445c85f392a8d0d5', |
13 | + 'message' => 'johns first deploy' | ||
13 | } | 14 | } |
14 | @app = Factory(:app_with_watcher, :api_key => 'APIKEY') | 15 | @app = Factory(:app_with_watcher, :api_key => 'APIKEY') |
15 | end | 16 | end |
@@ -26,7 +27,9 @@ describe DeploysController do | @@ -26,7 +27,9 @@ describe DeploysController do | ||
26 | :username => 'john.doe', | 27 | :username => 'john.doe', |
27 | :environment => 'production', | 28 | :environment => 'production', |
28 | :repository => 'git@github.com/jdpace/errbit.git', | 29 | :repository => 'git@github.com/jdpace/errbit.git', |
29 | - :revision => '19d77837eef37902cf5df7e4445c85f392a8d0d5' | 30 | + :revision => '19d77837eef37902cf5df7e4445c85f392a8d0d5', |
31 | + :message => 'johns first deploy' | ||
32 | + | ||
30 | }).and_return(Factory(:deploy)) | 33 | }).and_return(Factory(:deploy)) |
31 | post :create, :deploy => @params, :api_key => 'APIKEY' | 34 | post :create, :deploy => @params, :api_key => 'APIKEY' |
32 | end | 35 | end |
spec/models/deploy_spec.rb
@@ -42,6 +42,13 @@ describe Deploy do | @@ -42,6 +42,13 @@ describe Deploy do | ||
42 | @staging_errs.all?{|err| err.reload.resolved?}.should == false | 42 | @staging_errs.all?{|err| err.reload.resolved?}.should == false |
43 | end | 43 | end |
44 | end | 44 | end |
45 | + | ||
46 | + context 'when the app has deploy notifications set to false' do | ||
47 | + it 'should not send an email notification' do | ||
48 | + Mailer.should_not_receive(:deploy_notification) | ||
49 | + Factory(:deploy, :app => Factory(:app_with_watcher, :notify_on_deploys => false)) | ||
50 | + end | ||
51 | + end | ||
45 | end | 52 | end |
46 | 53 | ||
47 | end | 54 | end |
spec/models/err_spec.rb
@@ -120,5 +120,14 @@ describe Err do | @@ -120,5 +120,14 @@ describe Err do | ||
120 | end | 120 | end |
121 | end | 121 | end |
122 | end | 122 | end |
123 | - | 123 | + |
124 | + context 'being created' do | ||
125 | + context 'when the app has err notifications set to false' do | ||
126 | + it 'should not send an email notification' do | ||
127 | + app = Factory(:app_with_watcher, :notify_on_deploys => false) | ||
128 | + Mailer.should_not_receive(:err_notification) | ||
129 | + Factory(:err, :app => app) | ||
130 | + end | ||
131 | + end | ||
132 | + end | ||
124 | end | 133 | end |
125 | \ No newline at end of file | 134 | \ No newline at end of file |