From e175e183bac04daf67ca476ae4ae7ba60a898b49 Mon Sep 17 00:00:00 2001 From: Cyril Mougel Date: Tue, 29 Nov 2011 17:21:02 +0100 Subject: [PATCH] Fix spec/model/deploy with fabrication gem --- spec/models/deploy_spec.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/spec/models/deploy_spec.rb b/spec/models/deploy_spec.rb index 7f01a5c..7ef93a6 100644 --- a/spec/models/deploy_spec.rb +++ b/spec/models/deploy_spec.rb @@ -4,13 +4,13 @@ describe Deploy do context 'validations' do it 'requires a username' do - deploy = Factory.build(:deploy, :username => nil) + deploy = Fabricate.build(:deploy, :username => nil) deploy.should_not be_valid deploy.errors[:username].should include("can't be blank") end it 'requires an environment' do - deploy = Factory.build(:deploy, :environment => nil) + deploy = Fabricate.build(:deploy, :environment => nil) deploy.should_not be_valid deploy.errors[:environment].should include("can't be blank") end @@ -20,24 +20,24 @@ describe Deploy do it 'should send an email notification' do Mailer.should_receive(:deploy_notification). and_return(mock('email', :deliver => true)) - Factory(:deploy, :app => Factory(:app_with_watcher, :notify_on_deploys => true)) + Fabricate(:deploy, :app => Fabricate(:app_with_watcher, :notify_on_deploys => true)) end context 'when the app has resolve_errs_on_deploy set to false' do it 'should not resolve the apps errs' do - app = Factory(:app, :resolve_errs_on_deploy => false) - @problems = 3.times.map{Factory(:err, :problem => Factory(:problem, :resolved => false, :app => app))} - Factory(:deploy, :app => app) + app = Fabricate(:app, :resolve_errs_on_deploy => false) + @problems = 3.times.map{Fabricate(:err, :problem => Fabricate(:problem, :resolved => false, :app => app))} + Fabricate(:deploy, :app => app) app.reload.problems.none?{|problem| problem.resolved?}.should == true end end context 'when the app has resolve_errs_on_deploy set to true' do it 'should resolve the apps errs that were in the same environment' do - app = Factory(:app, :resolve_errs_on_deploy => true) - @prod_errs = 3.times.map{Factory(:problem, :resolved => false, :app => app, :environment => 'production')} - @staging_errs = 3.times.map{Factory(:problem, :resolved => false, :app => app, :environment => 'staging')} - Factory(:deploy, :app => app, :environment => 'production') + app = Fabricate(:app, :resolve_errs_on_deploy => true) + @prod_errs = 3.times.map{Fabricate(:problem, :resolved => false, :app => app, :environment => 'production')} + @staging_errs = 3.times.map{Fabricate(:problem, :resolved => false, :app => app, :environment => 'staging')} + Fabricate(:deploy, :app => app, :environment => 'production') @prod_errs.all?{|problem| problem.reload.resolved?}.should == true @staging_errs.all?{|problem| problem.reload.resolved?}.should == false end @@ -46,7 +46,7 @@ describe Deploy do 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)) + Fabricate(:deploy, :app => Fabricate(:app_with_watcher, :notify_on_deploys => false)) end end end -- libgit2 0.21.2