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 | 9 | 'local_username' => 'john.doe', |
10 | 10 | 'scm_repository' => 'git@github.com/jdpace/errbit.git', |
11 | 11 | 'rails_env' => 'production', |
12 | - 'scm_revision' => '19d77837eef37902cf5df7e4445c85f392a8d0d5' | |
12 | + 'scm_revision' => '19d77837eef37902cf5df7e4445c85f392a8d0d5', | |
13 | + 'message' => 'johns first deploy' | |
13 | 14 | } |
14 | 15 | @app = Factory(:app_with_watcher, :api_key => 'APIKEY') |
15 | 16 | end |
... | ... | @@ -26,7 +27,9 @@ describe DeploysController do |
26 | 27 | :username => 'john.doe', |
27 | 28 | :environment => 'production', |
28 | 29 | :repository => 'git@github.com/jdpace/errbit.git', |
29 | - :revision => '19d77837eef37902cf5df7e4445c85f392a8d0d5' | |
30 | + :revision => '19d77837eef37902cf5df7e4445c85f392a8d0d5', | |
31 | + :message => 'johns first deploy' | |
32 | + | |
30 | 33 | }).and_return(Factory(:deploy)) |
31 | 34 | post :create, :deploy => @params, :api_key => 'APIKEY' |
32 | 35 | end | ... | ... |
spec/models/deploy_spec.rb
... | ... | @@ -42,6 +42,13 @@ describe Deploy do |
42 | 42 | @staging_errs.all?{|err| err.reload.resolved?}.should == false |
43 | 43 | end |
44 | 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 | 52 | end |
46 | 53 | |
47 | 54 | end | ... | ... |
spec/models/err_spec.rb
... | ... | @@ -120,5 +120,14 @@ describe Err do |
120 | 120 | end |
121 | 121 | end |
122 | 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 | 133 | end |
125 | 134 | \ No newline at end of file | ... | ... |