diff --git a/spec/controllers/deploys_controller_spec.rb b/spec/controllers/deploys_controller_spec.rb index 9578ae3..72519c4 100644 --- a/spec/controllers/deploys_controller_spec.rb +++ b/spec/controllers/deploys_controller_spec.rb @@ -9,7 +9,8 @@ describe DeploysController do 'local_username' => 'john.doe', 'scm_repository' => 'git@github.com/jdpace/errbit.git', 'rails_env' => 'production', - 'scm_revision' => '19d77837eef37902cf5df7e4445c85f392a8d0d5' + 'scm_revision' => '19d77837eef37902cf5df7e4445c85f392a8d0d5', + 'message' => 'johns first deploy' } @app = Factory(:app_with_watcher, :api_key => 'APIKEY') end @@ -26,7 +27,9 @@ describe DeploysController do :username => 'john.doe', :environment => 'production', :repository => 'git@github.com/jdpace/errbit.git', - :revision => '19d77837eef37902cf5df7e4445c85f392a8d0d5' + :revision => '19d77837eef37902cf5df7e4445c85f392a8d0d5', + :message => 'johns first deploy' + }).and_return(Factory(:deploy)) post :create, :deploy => @params, :api_key => 'APIKEY' end diff --git a/spec/models/deploy_spec.rb b/spec/models/deploy_spec.rb index a82c14e..9ae5f7e 100644 --- a/spec/models/deploy_spec.rb +++ b/spec/models/deploy_spec.rb @@ -42,6 +42,13 @@ describe Deploy do @staging_errs.all?{|err| err.reload.resolved?}.should == false end end + + context 'when the app has deploy notifications set to false' do + it 'should not send an email notification' do + Mailer.should_not_receive(:deploy_notification) + Factory(:deploy, :app => Factory(:app_with_watcher, :notify_on_deploys => false)) + end + end end end diff --git a/spec/models/err_spec.rb b/spec/models/err_spec.rb index 4410200..7647b42 100644 --- a/spec/models/err_spec.rb +++ b/spec/models/err_spec.rb @@ -120,5 +120,14 @@ describe Err do end end end - + + context 'being created' do + context 'when the app has err notifications set to false' do + it 'should not send an email notification' do + app = Factory(:app_with_watcher, :notify_on_deploys => false) + Mailer.should_not_receive(:err_notification) + Factory(:err, :app => app) + end + end + end end \ No newline at end of file -- libgit2 0.21.2