Commit e175e183bac04daf67ca476ae4ae7ba60a898b49

Authored by Cyril Mougel
1 parent 79514294
Exists in master and in 1 other branch production

Fix spec/model/deploy with fabrication gem

Showing 1 changed file with 11 additions and 11 deletions   Show diff stats
spec/models/deploy_spec.rb
... ... @@ -4,13 +4,13 @@ describe Deploy do
4 4  
5 5 context 'validations' do
6 6 it 'requires a username' do
7   - deploy = Factory.build(:deploy, :username => nil)
  7 + deploy = Fabricate.build(:deploy, :username => nil)
8 8 deploy.should_not be_valid
9 9 deploy.errors[:username].should include("can't be blank")
10 10 end
11 11  
12 12 it 'requires an environment' do
13   - deploy = Factory.build(:deploy, :environment => nil)
  13 + deploy = Fabricate.build(:deploy, :environment => nil)
14 14 deploy.should_not be_valid
15 15 deploy.errors[:environment].should include("can't be blank")
16 16 end
... ... @@ -20,24 +20,24 @@ describe Deploy do
20 20 it 'should send an email notification' do
21 21 Mailer.should_receive(:deploy_notification).
22 22 and_return(mock('email', :deliver => true))
23   - Factory(:deploy, :app => Factory(:app_with_watcher, :notify_on_deploys => true))
  23 + Fabricate(:deploy, :app => Fabricate(:app_with_watcher, :notify_on_deploys => true))
24 24 end
25 25  
26 26 context 'when the app has resolve_errs_on_deploy set to false' do
27 27 it 'should not resolve the apps errs' do
28   - app = Factory(:app, :resolve_errs_on_deploy => false)
29   - @problems = 3.times.map{Factory(:err, :problem => Factory(:problem, :resolved => false, :app => app))}
30   - Factory(:deploy, :app => app)
  28 + app = Fabricate(:app, :resolve_errs_on_deploy => false)
  29 + @problems = 3.times.map{Fabricate(:err, :problem => Fabricate(:problem, :resolved => false, :app => app))}
  30 + Fabricate(:deploy, :app => app)
31 31 app.reload.problems.none?{|problem| problem.resolved?}.should == true
32 32 end
33 33 end
34 34  
35 35 context 'when the app has resolve_errs_on_deploy set to true' do
36 36 it 'should resolve the apps errs that were in the same environment' do
37   - app = Factory(:app, :resolve_errs_on_deploy => true)
38   - @prod_errs = 3.times.map{Factory(:problem, :resolved => false, :app => app, :environment => 'production')}
39   - @staging_errs = 3.times.map{Factory(:problem, :resolved => false, :app => app, :environment => 'staging')}
40   - Factory(:deploy, :app => app, :environment => 'production')
  37 + app = Fabricate(:app, :resolve_errs_on_deploy => true)
  38 + @prod_errs = 3.times.map{Fabricate(:problem, :resolved => false, :app => app, :environment => 'production')}
  39 + @staging_errs = 3.times.map{Fabricate(:problem, :resolved => false, :app => app, :environment => 'staging')}
  40 + Fabricate(:deploy, :app => app, :environment => 'production')
41 41 @prod_errs.all?{|problem| problem.reload.resolved?}.should == true
42 42 @staging_errs.all?{|problem| problem.reload.resolved?}.should == false
43 43 end
... ... @@ -46,7 +46,7 @@ describe Deploy do
46 46 context 'when the app has deploy notifications set to false' do
47 47 it 'should not send an email notification' do
48 48 Mailer.should_not_receive(:deploy_notification)
49   - Factory(:deploy, :app => Factory(:app_with_watcher, :notify_on_deploys => false))
  49 + Fabricate(:deploy, :app => Fabricate(:app_with_watcher, :notify_on_deploys => false))
50 50 end
51 51 end
52 52 end
... ...