engineyard 3.1.2 → 3.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe EY do
4
4
  it "provides EY errors" do
5
- EY::Error.should be
5
+ expect(EY::Error).to be
6
6
  end
7
7
  end
@@ -11,18 +11,18 @@ describe "ey deploy without an eyrc file" do
11
11
  input.puts(scenario_password)
12
12
  end
13
13
 
14
- @out.should include("We need to fetch your API token; please log in.")
15
- @out.should include("Email:")
16
- @out.should include("Password:")
17
- @ssh_commands.should_not be_empty
14
+ expect(@out).to include("We need to fetch your API token; please log in.")
15
+ expect(@out).to include("Email:")
16
+ expect(@out).to include("Password:")
17
+ expect(@ssh_commands).not_to be_empty
18
18
 
19
- read_eyrc.should == {"api_token" => scenario_api_token}
19
+ expect(read_eyrc).to eq({"api_token" => scenario_api_token})
20
20
  end
21
21
 
22
22
  it "uses the token on the command line" do
23
23
  api_scenario "one app, one environment"
24
24
  ey(%w[deploy --no-migrate --api-token] + [scenario_api_token])
25
- @ssh_commands.should_not be_empty
25
+ expect(@ssh_commands).not_to be_empty
26
26
  end
27
27
  end
28
28
 
@@ -44,11 +44,11 @@ describe "ey deploy" do
44
44
  end
45
45
 
46
46
  def verify_ran(scenario)
47
- @out.should match(/Beginning deploy.../)
48
- @out.should match(/Application:\s+#{scenario[:application]}/)
49
- @out.should match(/Environment:\s+#{scenario[:environment]}/)
50
- @out.should match(/deployment recorded/i)
51
- @ssh_commands.should have_command_like(/engineyard-serverside.*deploy.*--app #{scenario[:application]}/)
47
+ expect(@out).to match(/Beginning deploy.../)
48
+ expect(@out).to match(/Application:\s+#{scenario[:application]}/)
49
+ expect(@out).to match(/Environment:\s+#{scenario[:environment]}/)
50
+ expect(@out).to match(/deployment recorded/i)
51
+ expect(@ssh_commands).to have_command_like(/engineyard-serverside.*deploy.*--app #{scenario[:application]}/)
52
52
  end
53
53
 
54
54
  # common behavior
@@ -62,7 +62,7 @@ describe "ey deploy" do
62
62
  context "without ssh keys (with ssh enabled)" do
63
63
  before do
64
64
  ENV.delete('NO_SSH')
65
- Net::SSH.stub(:start).and_raise(Net::SSH::AuthenticationFailed.new("no key"))
65
+ allow(Net::SSH).to receive(:start).and_raise(Net::SSH::AuthenticationFailed.new("no key"))
66
66
  end
67
67
 
68
68
  after do
@@ -72,7 +72,7 @@ describe "ey deploy" do
72
72
  it "tells you that you need to add an appropriate ssh key (even with --quiet)" do
73
73
  login_scenario "one app, one environment"
74
74
  fast_failing_ey %w[deploy --no-migrate --quiet]
75
- @err.should include("Authentication Failed")
75
+ expect(@err).to include("Authentication Failed")
76
76
  end
77
77
  end
78
78
 
@@ -80,26 +80,26 @@ describe "ey deploy" do
80
80
  it "complains when there is no app" do
81
81
  login_scenario "empty"
82
82
  fast_failing_ey ["deploy"]
83
- @err.should include(%|No application found|)
83
+ expect(@err).to include(%|No application found|)
84
84
  end
85
85
 
86
86
  it "complains when the specified environment does not contain the app" do
87
87
  login_scenario "one app, one environment, not linked"
88
88
  fast_failing_ey %w[deploy -e giblets -r master]
89
- @err.should match(/Application "rails232app" and environment "giblets" are not associated./)
89
+ expect(@err).to match(/Application "rails232app" and environment "giblets" are not associated./)
90
90
  end
91
91
 
92
92
  it "complains when environment is not specified and app is in >1 environment" do
93
93
  login_scenario "one app, many environments"
94
94
  fast_failing_ey %w[deploy --ref master --no-migrate]
95
- @err.should match(/Multiple application environments possible/i)
95
+ expect(@err).to match(/Multiple application environments possible/i)
96
96
  end
97
97
 
98
98
  it "complains when the app master is in a non-running state" do
99
99
  login_scenario "one app, one environment, app master red"
100
100
  fast_failing_ey %w[deploy --environment giblets --ref master --no-migrate]
101
- @err.should_not match(/No running instances/i)
102
- @err.should match(/running.*\(green\)/)
101
+ expect(@err).not_to match(/No running instances/i)
102
+ expect(@err).to match(/running.*\(green\)/)
103
103
  end
104
104
  end
105
105
 
@@ -119,26 +119,26 @@ describe "ey deploy" do
119
119
 
120
120
  it "tells you to run ey init" do
121
121
  fast_failing_ey %w[deploy]
122
- @err.should match(/ey init/)
123
- @ssh_commands.should be_empty
122
+ expect(@err).to match(/ey init/)
123
+ expect(@ssh_commands).to be_empty
124
124
  end
125
125
 
126
126
  it "tells you to run ey init" do
127
127
  fast_failing_ey %w[deploy --migrate]
128
- @err.should match(/ey init/)
129
- @ssh_commands.should be_empty
128
+ expect(@err).to match(/ey init/)
129
+ expect(@ssh_commands).to be_empty
130
130
  end
131
131
  end
132
132
 
133
133
  it "can be disabled with --no-migrate" do
134
134
  fast_ey %w[deploy --no-migrate]
135
- @ssh_commands.last.should =~ /engineyard-serverside.*deploy/
136
- @ssh_commands.last.should_not =~ /--migrate/
135
+ expect(@ssh_commands.last).to match(/engineyard-serverside.*deploy/)
136
+ expect(@ssh_commands.last).not_to match(/--migrate/)
137
137
  end
138
138
 
139
139
  it "runs the migrate command when one is given" do
140
140
  fast_ey ['deploy', '--migrate', 'thor fancy:migrate']
141
- @ssh_commands.last.should match(/--migrate 'thor fancy:migrate'/)
141
+ expect(@ssh_commands.last).to match(/--migrate 'thor fancy:migrate'/)
142
142
  end
143
143
 
144
144
  context "ey.yml migrate only" do
@@ -147,7 +147,7 @@ describe "ey deploy" do
147
147
 
148
148
  it "tells you to run ey init" do
149
149
  fast_failing_ey %w[deploy]
150
- @err.should match(/ey init/)
150
+ expect(@err).to match(/ey init/)
151
151
  end
152
152
  end
153
153
 
@@ -157,7 +157,7 @@ describe "ey deploy" do
157
157
 
158
158
  it "tells you to run ey init" do
159
159
  fast_failing_ey %w[deploy]
160
- @err.should match(/ey init/)
160
+ expect(@err).to match(/ey init/)
161
161
  end
162
162
  end
163
163
 
@@ -172,7 +172,7 @@ describe "ey deploy" do
172
172
 
173
173
  it "migrates with the custom command" do
174
174
  fast_ey %w[deploy]
175
- @ssh_commands.last.should =~ /--migrate 'thor fancy:migrate'/
175
+ expect(@ssh_commands.last).to match(/--migrate 'thor fancy:migrate'/)
176
176
  end
177
177
  end
178
178
 
@@ -182,18 +182,18 @@ describe "ey deploy" do
182
182
 
183
183
  it "does not migrate by default" do
184
184
  fast_ey %w[deploy]
185
- @ssh_commands.last.should =~ /engineyard-serverside.*deploy/
186
- @ssh_commands.last.should_not =~ /--migrate/
185
+ expect(@ssh_commands.last).to match(/engineyard-serverside.*deploy/)
186
+ expect(@ssh_commands.last).not_to match(/--migrate/)
187
187
  end
188
188
 
189
189
  it "can be turned back on with --migrate" do
190
190
  fast_ey ["deploy", "--migrate", "rake fancy:migrate"]
191
- @ssh_commands.last.should =~ /--migrate 'rake fancy:migrate'/
191
+ expect(@ssh_commands.last).to match(/--migrate 'rake fancy:migrate'/)
192
192
  end
193
193
 
194
194
  it "tells you to initialize ey.yml when --migrate is specified with no value" do
195
195
  fast_failing_ey %w[deploy --migrate]
196
- @err.should match(/ey init/)
196
+ expect(@err).to match(/ey init/)
197
197
  end
198
198
  end
199
199
 
@@ -203,12 +203,12 @@ describe "ey deploy" do
203
203
 
204
204
  it "does not migrate by default" do
205
205
  fast_ey %w[deploy]
206
- @ssh_commands.last.should_not match(/--migrate/)
206
+ expect(@ssh_commands.last).not_to match(/--migrate/)
207
207
  end
208
208
 
209
209
  it "migrates with the custom command when --migrate is specified with no value" do
210
210
  fast_ey %w[deploy --migrate]
211
- @ssh_commands.last.should match(/--migrate 'thor fancy:migrate'/)
211
+ expect(@ssh_commands.last).to match(/--migrate 'thor fancy:migrate'/)
212
212
  end
213
213
  end
214
214
  end
@@ -220,7 +220,7 @@ describe "ey deploy" do
220
220
 
221
221
  it "passes the framework environment" do
222
222
  fast_ey %w[deploy --no-migrate]
223
- @ssh_commands.last.should match(/--framework-env production/)
223
+ expect(@ssh_commands.last).to match(/--framework-env production/)
224
224
  end
225
225
  end
226
226
 
@@ -234,27 +234,27 @@ describe "ey deploy" do
234
234
  context "without a configured default branch" do
235
235
  it "defaults to the checked-out local branch" do
236
236
  fast_ey %w[deploy --no-migrate]
237
- @ssh_commands.last.should =~ /--ref resolved-current-branch/
237
+ expect(@ssh_commands.last).to match(/--ref resolved-current-branch/)
238
238
  end
239
239
 
240
240
  it "deploys another branch if given" do
241
241
  fast_ey %w[deploy --ref master --no-migrate]
242
- @ssh_commands.last.should =~ /--ref resolved-master/
242
+ expect(@ssh_commands.last).to match(/--ref resolved-master/)
243
243
  end
244
244
 
245
245
  it "deploys a tag if given" do
246
246
  fast_ey %w[deploy --ref v1 --no-migrate]
247
- @ssh_commands.last.should =~ /--ref resolved-v1/
247
+ expect(@ssh_commands.last).to match(/--ref resolved-v1/)
248
248
  end
249
249
 
250
250
  it "allows using --branch to specify a branch" do
251
251
  fast_ey %w[deploy --branch master --no-migrate]
252
- @ssh_commands.last.should match(/--ref resolved-master/)
252
+ expect(@ssh_commands.last).to match(/--ref resolved-master/)
253
253
  end
254
254
 
255
255
  it "allows using --tag to specify the tag" do
256
256
  fast_ey %w[deploy --tag v1 --no-migrate]
257
- @ssh_commands.last.should match(/--ref resolved-v1/)
257
+ expect(@ssh_commands.last).to match(/--ref resolved-v1/)
258
258
  end
259
259
  end
260
260
 
@@ -269,22 +269,22 @@ describe "ey deploy" do
269
269
 
270
270
  it "deploys the default branch by default" do
271
271
  fast_ey %w[deploy]
272
- @ssh_commands.last.should =~ /--ref resolved-master/
272
+ expect(@ssh_commands.last).to match(/--ref resolved-master/)
273
273
  end
274
274
 
275
275
  it "complains about a non-default branch without --ignore-default-branch" do
276
276
  fast_failing_ey %w[deploy -r current-branch]
277
- @err.should =~ /default branch is set to "master"/
277
+ expect(@err).to match(/default branch is set to "master"/)
278
278
  end
279
279
 
280
280
  it "deploys a non-default branch with --ignore-default-branch" do
281
281
  fast_ey %w[deploy -r current-branch --ignore-default-branch]
282
- @ssh_commands.last.should =~ /--ref resolved-current-branch/
282
+ expect(@ssh_commands.last).to match(/--ref resolved-current-branch/)
283
283
  end
284
284
 
285
285
  it "deploys a non-default branch with --R ref" do
286
286
  fast_ey %w[deploy -R current-branch]
287
- @ssh_commands.last.should =~ /--ref resolved-current-branch/
287
+ expect(@ssh_commands.last).to match(/--ref resolved-current-branch/)
288
288
  end
289
289
  end
290
290
  end
@@ -300,7 +300,7 @@ describe "ey deploy" do
300
300
 
301
301
  it "no longer gets passed along to engineyard-serverside (since serverside will read it on its own)" do
302
302
  fast_ey %w[deploy --no-migrate]
303
- @ssh_commands.last.should_not =~ /"bert":"ernie"/
303
+ expect(@ssh_commands.last).not_to match(/"bert":"ernie"/)
304
304
  end
305
305
  end
306
306
 
@@ -311,9 +311,9 @@ describe "ey deploy" do
311
311
 
312
312
  it "lets you choose by complete name even if the complete name is ambiguous" do
313
313
  fast_ey %w[deploy --environment railsapp_staging --no-migrate]
314
- @out.should match(/Beginning deploy.../)
315
- @out.should match(/Ref:\s+master/)
316
- @out.should match(/Environment:\s+railsapp_staging/)
314
+ expect(@out).to match(/Beginning deploy.../)
315
+ expect(@out).to match(/Ref:\s+master/)
316
+ expect(@out).to match(/Environment:\s+railsapp_staging/)
317
317
  end
318
318
  end
319
319
 
@@ -332,16 +332,16 @@ describe "ey deploy" do
332
332
 
333
333
  it "passes --config to engineyard-serverside" do
334
334
  ey %w[deploy --config some:stuff more:crap --no-migrate]
335
- config_options.should_not be_nil
336
- config_options['some'].should == 'stuff'
337
- config_options['more'].should == 'crap'
335
+ expect(config_options).not_to be_nil
336
+ expect(config_options['some']).to eq('stuff')
337
+ expect(config_options['more']).to eq('crap')
338
338
  end
339
339
 
340
340
  it "supports legacy --extra-deploy-hook-options" do
341
341
  ey %w[deploy --extra-deploy-hook-options some:stuff more:crap --no-migrate]
342
- config_options.should_not be_nil
343
- config_options['some'].should == 'stuff'
344
- config_options['more'].should == 'crap'
342
+ expect(config_options).not_to be_nil
343
+ expect(config_options['some']).to eq('stuff')
344
+ expect(config_options['more']).to eq('crap')
345
345
  end
346
346
 
347
347
  context "when ey.yml is present" do
@@ -353,7 +353,7 @@ describe "ey deploy" do
353
353
 
354
354
  it "overrides what's in ey.yml" do
355
355
  fast_ey %w[deploy --config beer:esb]
356
- config_options['beer'].should == 'esb'
356
+ expect(config_options['beer']).to eq('esb')
357
357
  end
358
358
  end
359
359
  end
@@ -374,22 +374,22 @@ describe "ey deploy" do
374
374
 
375
375
  it "allows you to specify an app when not in a directory" do
376
376
  fast_ey %w[deploy --app rails232app --ref master --migrate]
377
- @ssh_commands.last.should match(/--app rails232app/)
378
- @ssh_commands.last.should match(/--ref resolved-master/)
379
- @ssh_commands.last.should match(/--migrate 'rake db:migrate --trace'/)
377
+ expect(@ssh_commands.last).to match(/--app rails232app/)
378
+ expect(@ssh_commands.last).to match(/--ref resolved-master/)
379
+ expect(@ssh_commands.last).to match(/--migrate 'rake db:migrate --trace'/)
380
380
  end
381
381
 
382
382
  it "requires that you specify a ref when specifying the application" do
383
383
  Dir.chdir(File.expand_path("~")) do
384
384
  fast_failing_ey %w[deploy --app rails232app --no-migrate]
385
- @err.should match(/you must also specify the --ref/)
385
+ expect(@err).to match(/you must also specify the --ref/)
386
386
  end
387
387
  end
388
388
 
389
389
  it "requires that you specify a migrate option when specifying the application" do
390
390
  Dir.chdir(File.expand_path("~")) do
391
391
  fast_failing_ey %w[deploy --app rails232app --ref master]
392
- @err.should match(/you must also specify .* --migrate or --no-migrate/)
392
+ expect(@err).to match(/you must also specify .* --migrate or --no-migrate/)
393
393
  end
394
394
  end
395
395
  end
@@ -404,13 +404,13 @@ describe "ey deploy" do
404
404
  it "should send the correct serverside version when specified" do
405
405
  fast_ey %w[deploy --no-migrate --serverside-version 1.6.4]
406
406
  deploy_command = @ssh_commands.find {|c| c =~ /engineyard-serverside.*deploy/ }
407
- deploy_command.should =~ /engineyard-serverside _1.6.4_ deploy/
407
+ expect(deploy_command).to match(/engineyard-serverside _1.6.4_ deploy/)
408
408
  end
409
409
 
410
410
  it "should send the default serverside version when unspecified" do
411
411
  fast_ey %w[deploy --no-migrate]
412
412
  deploy_command = @ssh_commands.find {|c| c =~ /engineyard-serverside.*deploy/ }
413
- deploy_command.should =~ /engineyard-serverside _#{EY::ENGINEYARD_SERVERSIDE_VERSION}_ deploy/
413
+ expect(deploy_command).to match(/engineyard-serverside _#{EY::ENGINEYARD_SERVERSIDE_VERSION}_ deploy/)
414
414
  end
415
415
  end
416
416
 
@@ -424,11 +424,11 @@ describe "ey deploy" do
424
424
  end
425
425
 
426
426
  it "passes along the repository URL to engineyard-serverside" do
427
- @deploy_command.should =~ /--git user@git.host:path\/to\/repo.git/
427
+ expect(@deploy_command).to match(/--git user@git.host:path\/to\/repo.git/)
428
428
  end
429
429
 
430
430
  it "passes along the web server stack to engineyard-serverside" do
431
- @deploy_command.should =~ /--stack nginx_mongrel/
431
+ expect(@deploy_command).to match(/--stack nginx_mongrel/)
432
432
  end
433
433
  end
434
434
 
@@ -3,21 +3,21 @@ require 'spec_helper'
3
3
  describe "ey" do
4
4
  context "run without arguments" do
5
5
  it "prints usage information" do
6
- ey.should include("Usage:")
6
+ expect(ey).to include("Usage:")
7
7
  end
8
8
  end
9
9
 
10
10
  context "run with an argument that is not a command" do
11
11
  it "tells the user that is not a command" do
12
12
  ey %w[foobarbaz], :expect_failure => true
13
- @err.should include("Could not find command")
13
+ expect(@err).to include("Could not find command")
14
14
  end
15
15
  end
16
16
 
17
17
  context "run a command and a bad flag" do
18
18
  it "tells the user that is not a valid flag" do
19
19
  ey %w[help --expect-failure], :expect_failure => true
20
- @err.should include("Unknown switches")
20
+ expect(@err).to include("Unknown switches")
21
21
  end
22
22
  end
23
23
  end
@@ -15,8 +15,8 @@ describe "ey environments" do
15
15
  end
16
16
 
17
17
  def verify_ran(scenario)
18
- @out.should match(/#{scenario[:environment]}/) if scenario[:environment]
19
- @out.should match(/#{scenario[:application]}/) if scenario[:application]
18
+ expect(@out).to match(/#{scenario[:environment]}/) if scenario[:environment]
19
+ expect(@out).to match(/#{scenario[:application]}/) if scenario[:application]
20
20
  end
21
21
 
22
22
  include_examples "it takes an environment name and an app name and an account name"
@@ -28,7 +28,7 @@ describe "ey environments" do
28
28
 
29
29
  it "suggests that you use environments --all" do
30
30
  fast_failing_ey %w[environments]
31
- @err.should =~ /Use ey environments --all to see all environments./
31
+ expect(@err).to match(/Use ey environments --all to see all environments./)
32
32
  end
33
33
  end
34
34
 
@@ -39,71 +39,71 @@ describe "ey environments" do
39
39
 
40
40
  it "lists the environments your app is in" do
41
41
  fast_ey %w[environments]
42
- @out.should include('main/rails232app')
43
- @out.should =~ /giblets/
44
- @out.should =~ /bakon/
42
+ expect(@out).to include('main/rails232app')
43
+ expect(@out).to match(/giblets/)
44
+ expect(@out).to match(/bakon/)
45
45
  end
46
46
 
47
47
  it "lists the environments with specified app" do
48
48
  fast_ey %w[environments --app rails232app]
49
- @out.should include('main/rails232app')
50
- @out.should =~ /giblets/
51
- @out.should =~ /bakon/
49
+ expect(@out).to include('main/rails232app')
50
+ expect(@out).to match(/giblets/)
51
+ expect(@out).to match(/bakon/)
52
52
  end
53
53
 
54
54
  it "finds no environments with gibberish app" do
55
55
  fast_failing_ey %w[environments --account main --app gibberish]
56
- @err.should =~ /Use ey environments --all to see all environments./
56
+ expect(@err).to match(/Use ey environments --all to see all environments./)
57
57
  end
58
58
 
59
59
  it "finds no environments with gibberish account" do
60
60
  fast_failing_ey %w[environments --account gibberish --app rails232]
61
- @err.should =~ /Use ey environments --all to see all environments./
61
+ expect(@err).to match(/Use ey environments --all to see all environments./)
62
62
  end
63
63
 
64
64
  it "lists the environments that the app is in" do
65
65
  fast_ey %w[environments --app rails232app]
66
- @out.should include('main/rails232app')
67
- @out.should =~ /giblets/
68
- @out.should =~ /bakon/
66
+ expect(@out).to include('main/rails232app')
67
+ expect(@out).to match(/giblets/)
68
+ expect(@out).to match(/bakon/)
69
69
  end
70
70
 
71
71
  it "lists the environments that the app is in" do
72
72
  fast_ey %w[environments --account main]
73
- @out.should include('main/rails232app')
74
- @out.should =~ /giblets/
75
- @out.should =~ /bakon/
73
+ expect(@out).to include('main/rails232app')
74
+ expect(@out).to match(/giblets/)
75
+ expect(@out).to match(/bakon/)
76
76
  end
77
77
 
78
78
  it "lists the environments matching --environment" do
79
79
  fast_ey %w[environments -e gib]
80
- @out.should include('main/rails232app')
81
- @out.should =~ /giblets/
82
- @out.should_not =~ /bakon/
80
+ expect(@out).to include('main/rails232app')
81
+ expect(@out).to match(/giblets/)
82
+ expect(@out).not_to match(/bakon/)
83
83
  end
84
84
 
85
85
  it "reports failure to find a git repo when not in one" do
86
86
  Dir.chdir(Dir.tmpdir) do
87
87
  fast_failing_ey %w[environments]
88
- @err.should =~ /fatal: Not a git repository \(or any of the parent directories\): .*#{Regexp.escape(Dir.tmpdir)}/
89
- @out.should_not =~ /no application configured/
88
+ expect(@err).to match(/fatal: Not a git repository \(or any of the parent directories\): .*#{Regexp.escape(Dir.tmpdir)}/)
89
+ expect(@out).not_to match(/no application configured/)
90
90
  end
91
91
  end
92
92
 
93
93
  it "lists all environments that have apps with -A" do
94
94
  fast_ey %w[environments -A]
95
- @out.should include("bakon")
96
- @out.should include("giblets")
95
+ expect(@out).to include("bakon")
96
+ expect(@out).to include("giblets")
97
97
  end
98
98
 
99
99
  it "outputs simply with -s" do
100
100
  fast_ey %w[environments -s], :debug => false
101
- @out.split(/\n/).sort.should == ["bakon", "giblets"]
101
+ expect(@out.split(/\n/).sort).to eq(["bakon", "giblets"])
102
102
  end
103
103
 
104
104
  it "outputs all environments (including ones with no apps) simply with -A and -s" do
105
105
  fast_ey %w[environments -A -s], :debug => false
106
- @out.split(/\n/).sort.should == ["bakon", "beef", "giblets"]
106
+ expect(@out.split(/\n/).sort).to eq(["bakon", "beef", "giblets"])
107
107
  end
108
108
  end
109
109
  end
@@ -114,7 +114,7 @@ describe "ey environments with an ambiguous git repo" do
114
114
 
115
115
  it "lists environments from all apps using the git repo" do
116
116
  fast_ey %w[environments]
117
- @out.should include("giblets")
118
- @out.should include("keycollector_production")
117
+ expect(@out).to include("giblets")
118
+ expect(@out).to include("keycollector_production")
119
119
  end
120
120
  end