engineyard-serverside 2.3.9 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +15 -0
  2. data/bin/engineyard-serverside-execute-hook +31 -0
  3. data/lib/engineyard-serverside/about.rb +3 -0
  4. data/lib/engineyard-serverside/cli.rb +3 -1
  5. data/lib/engineyard-serverside/configuration.rb +5 -0
  6. data/lib/engineyard-serverside/deploy.rb +25 -7
  7. data/lib/engineyard-serverside/maintenance.rb +14 -1
  8. data/lib/engineyard-serverside/paths.rb +4 -0
  9. data/lib/engineyard-serverside/server.rb +3 -2
  10. data/lib/engineyard-serverside/version.rb +1 -1
  11. data/spec/archive_deploy_spec.rb +4 -10
  12. data/spec/basic_deploy_spec.rb +3 -3
  13. data/spec/bundler_deploy_spec.rb +32 -32
  14. data/spec/configuration_spec.rb +42 -42
  15. data/spec/custom_deploy_spec.rb +9 -9
  16. data/spec/deploy_hook_spec.rb +103 -89
  17. data/spec/deprecation_spec.rb +3 -3
  18. data/spec/ey_yml_customized_deploy_spec.rb +21 -21
  19. data/spec/fixtures/repos/executable_hooks/README +1 -0
  20. data/spec/fixtures/repos/executable_hooks/deploy/before_restart +72 -0
  21. data/spec/fixtures/repos/public_system/Gemfile +4 -0
  22. data/spec/fixtures/repos/public_system/Gemfile.lock +12 -0
  23. data/spec/fixtures/repos/public_system/README +5 -0
  24. data/spec/fixtures/repos/public_system/ey.yml +3 -0
  25. data/spec/fixtures/repos/public_system/public/system/cant_touch_this.txt +3 -0
  26. data/spec/lockfile_parser_spec.rb +26 -26
  27. data/spec/multi_dependency_manager_spec.rb +3 -3
  28. data/spec/nodejs_deploy_spec.rb +2 -2
  29. data/spec/php_deploy_spec.rb +7 -7
  30. data/spec/rails31_deploy_spec.rb +56 -56
  31. data/spec/restart_spec.rb +3 -3
  32. data/spec/rollback_spec.rb +19 -19
  33. data/spec/server_spec.rb +16 -16
  34. data/spec/services_deploy_spec.rb +40 -40
  35. data/spec/shell_spec.rb +1 -1
  36. data/spec/source/archive_spec.rb +1 -1
  37. data/spec/source/git_spec.rb +1 -1
  38. data/spec/spec_helper.rb +0 -1
  39. data/spec/sqlite3_deploy_spec.rb +6 -6
  40. data/spec/symlink_spec.rb +15 -0
  41. metadata +139 -154
  42. data/lib/engineyard-serverside/source_strategy.rb +0 -77
@@ -58,7 +58,7 @@ describe "the EY::Serverside::Deploy API" do
58
58
  # that are using eydeploy.rb and relying on this documentation.
59
59
  #
60
60
  ############################################################################
61
- td.call_order.should == %w(
61
+ expect(td.call_order).to eq(%w(
62
62
  push_code
63
63
  copy_repository_cache
64
64
  create_revision_file
@@ -72,7 +72,7 @@ describe "the EY::Serverside::Deploy API" do
72
72
  restart
73
73
  disable_maintenance_page
74
74
  cleanup_old_releases
75
- gc_repository_cache)
75
+ gc_repository_cache))
76
76
  end
77
77
 
78
78
  describe "task overrides" do
@@ -95,7 +95,7 @@ describe "the EY::Serverside::Deploy API" do
95
95
  it "doesn't load eydeploy_rb file" do
96
96
  write_eydeploy 'eydeploy.rb'
97
97
  @deploy.require_custom_tasks
98
- @deploy.should_not respond_to(:got_new_methods)
98
+ expect(@deploy).not_to respond_to(:got_new_methods)
99
99
  end
100
100
  end
101
101
 
@@ -108,13 +108,13 @@ describe "the EY::Serverside::Deploy API" do
108
108
  it "requires 'eydeploy.rb' and adds any defined methods to the deploy" do
109
109
  write_eydeploy 'eydeploy.rb'
110
110
  @deploy.require_custom_tasks
111
- @deploy.got_new_methods.should == 'from the file on disk'
111
+ expect(@deploy.got_new_methods).to eq('from the file on disk')
112
112
  end
113
113
 
114
114
  it "falls back to 'config/eydeploy.rb'" do
115
115
  write_eydeploy 'config/eydeploy.rb'
116
116
  @deploy.require_custom_tasks
117
- @deploy.got_new_methods.should == 'from the file on disk'
117
+ expect(@deploy.got_new_methods).to eq('from the file on disk')
118
118
  end
119
119
 
120
120
  it "lets you super up from any defined methods" do
@@ -126,15 +126,15 @@ describe "the EY::Serverside::Deploy API" do
126
126
 
127
127
  deploy = TestDeploySuper.realnew(test_servers, @config, test_shell)
128
128
  deploy.require_custom_tasks
129
- deploy.value.should == "base + derived"
129
+ expect(deploy.value).to eq("base + derived")
130
130
  end
131
131
 
132
132
  it "records exceptions raised from the instance eval in the log" do
133
133
  write_eydeploy 'eydeploy.rb', "raise 'Imma blow up'"
134
- lambda { @deploy.require_custom_tasks }.should raise_error
134
+ expect { @deploy.require_custom_tasks }.to raise_error
135
135
  log = @log_path.read
136
- log.should =~ /Exception while loading .*eydeploy\.rb/
137
- log.should include('Imma blow up')
136
+ expect(log).to match(/Exception while loading .*eydeploy\.rb/)
137
+ expect(log).to include('Imma blow up')
138
138
  end
139
139
  end
140
140
  end
@@ -7,18 +7,18 @@ describe "deploy hooks" do
7
7
  end
8
8
 
9
9
  it "runs all the hooks" do
10
- deploy_dir.join('current', 'before_deploy.ran' ).should exist
11
- deploy_dir.join('current', 'before_bundle.ran' ).should exist
12
- deploy_dir.join('current', 'after_bundle.ran' ).should exist
13
- deploy_dir.join('current', 'before_migrate.ran').should exist
14
- deploy_dir.join('current', 'after_migrate.ran' ).should exist
15
- deploy_dir.join('current', 'before_compile_assets.ran').should exist
16
- deploy_dir.join('current', 'after_compile_assets.ran' ).should exist
17
- deploy_dir.join('current', 'before_symlink.ran').should exist
18
- deploy_dir.join('current', 'after_symlink.ran' ).should exist
19
- deploy_dir.join('current', 'before_restart.ran').should exist
20
- deploy_dir.join('current', 'after_restart.ran' ).should exist
21
- deploy_dir.join('current', 'after_deploy.ran' ).should exist
10
+ expect(deploy_dir.join('current', 'before_deploy.ran' )).to exist
11
+ expect(deploy_dir.join('current', 'before_bundle.ran' )).to exist
12
+ expect(deploy_dir.join('current', 'after_bundle.ran' )).to exist
13
+ expect(deploy_dir.join('current', 'before_migrate.ran')).to exist
14
+ expect(deploy_dir.join('current', 'after_migrate.ran' )).to exist
15
+ expect(deploy_dir.join('current', 'before_compile_assets.ran')).to exist
16
+ expect(deploy_dir.join('current', 'after_compile_assets.ran' )).to exist
17
+ expect(deploy_dir.join('current', 'before_symlink.ran')).to exist
18
+ expect(deploy_dir.join('current', 'after_symlink.ran' )).to exist
19
+ expect(deploy_dir.join('current', 'before_restart.ran')).to exist
20
+ expect(deploy_dir.join('current', 'after_restart.ran' )).to exist
21
+ expect(deploy_dir.join('current', 'after_deploy.ran' )).to exist
22
22
  end
23
23
  end
24
24
 
@@ -32,14 +32,24 @@ describe "deploy hooks" do
32
32
 
33
33
  it "prints the failure to the log even when non-verbose" do
34
34
  out = read_output
35
- out.should =~ %r|FATAL: Exception raised in deploy hook .*/before_migrate.rb.|
36
- out.should =~ %r|RuntimeError:.*Hook failing in \(eval\)|
37
- out.should =~ %r|Please fix this error before retrying.|
35
+ expect(out).to match(%r|FATAL: Exception raised in deploy hook .*/before_migrate.rb.|)
36
+ expect(out).to match(%r|RuntimeError:.*Hook failing in \(eval\)|)
37
+ expect(out).to match(%r|Please fix this error before retrying.|)
38
38
  end
39
39
 
40
40
  it "retains the failed release" do
41
41
  release_name = @config.paths.active_release.basename
42
- deploy_dir.join('releases_failed', release_name).should be_directory
42
+ expect(deploy_dir.join('releases_failed', release_name)).to be_directory
43
+ end
44
+ end
45
+
46
+ context "with an executable for a deploy hook" do
47
+ before(:all) do
48
+ deploy_test_application('executable_hooks')
49
+ end
50
+
51
+ it 'runs the hook' do
52
+ deploy_dir.join('current', 'before_restart.ran').should exist
43
53
  end
44
54
  end
45
55
 
@@ -56,7 +66,7 @@ describe "deploy hooks" do
56
66
 
57
67
  context "#run" do
58
68
  it "is available" do
59
- deploy_hook.eval_hook('respond_to?(:run)').should be_true
69
+ expect(deploy_hook.eval_hook('respond_to?(:run)')).to be_true
60
70
  end
61
71
 
62
72
  it "runs commands like the shell does" do
@@ -65,28 +75,28 @@ describe "deploy hooks" do
65
75
 
66
76
  deploy_hook.eval_hook('run("echo $COUNT > /tmp/deploy_hook_spec.the_count")')
67
77
 
68
- IO.read("/tmp/deploy_hook_spec.the_count").strip.should == "Chocula"
78
+ expect(IO.read("/tmp/deploy_hook_spec.the_count").strip).to eq("Chocula")
69
79
  end
70
80
 
71
81
  it "returns true/false to indicate the command's success" do
72
- deploy_hook.eval_hook('run("true")').should be_true
73
- deploy_hook.eval_hook('run("false")').should be_false
82
+ expect(deploy_hook.eval_hook('run("true")')).to be_true
83
+ expect(deploy_hook.eval_hook('run("false")')).to be_false
74
84
  end
75
85
 
76
86
  it "raises when the bang method alternative is used" do
77
- lambda {
87
+ expect {
78
88
  deploy_hook.eval_hook('run!("false")')
79
- }.should raise_error(RuntimeError)
89
+ }.to raise_error(RuntimeError)
80
90
  out = read_output
81
- out.should =~ %r|FATAL: Exception raised in deploy hook /data/app_name/releases/\d+/deploy/fake_test_hook.rb.|
82
- out.should =~ %r|RuntimeError: .*run!.*Command failed. false|
83
- out.should =~ %r|Please fix this error before retrying.|
91
+ expect(out).to match(%r|FATAL: Exception raised in deploy hook /data/app_name/releases/\d+/deploy/fake_test_hook.rb.|)
92
+ expect(out).to match(%r|RuntimeError: .*run!.*Command failed. false|)
93
+ expect(out).to match(%r|Please fix this error before retrying.|)
84
94
  end
85
95
  end
86
96
 
87
97
  context "#sudo" do
88
98
  it "is available" do
89
- deploy_hook.eval_hook('respond_to?(:sudo)').should be_true
99
+ expect(deploy_hook.eval_hook('respond_to?(:sudo)')).to be_true
90
100
  end
91
101
 
92
102
  it "runs things with sudo" do
@@ -99,34 +109,34 @@ describe "deploy hooks" do
99
109
  it "raises when the bang method alternative is used" do
100
110
  hook = deploy_hook
101
111
  mock_sudo do
102
- lambda {
112
+ expect {
103
113
  hook.eval_hook('sudo!("false")')
104
- }.should raise_error(RuntimeError)
114
+ }.to raise_error(RuntimeError)
105
115
  end
106
116
  out = read_output
107
- out.should =~ %r|FATAL: Exception raised in deploy hook /data/app_name/releases/\d+/deploy/fake_test_hook.rb.|
108
- out.should =~ %r|RuntimeError: .*sudo!.*Command failed. false|
109
- out.should =~ %r|Please fix this error before retrying.|
117
+ expect(out).to match(%r|FATAL: Exception raised in deploy hook /data/app_name/releases/\d+/deploy/fake_test_hook.rb.|)
118
+ expect(out).to match(%r|RuntimeError: .*sudo!.*Command failed. false|)
119
+ expect(out).to match(%r|Please fix this error before retrying.|)
110
120
  end
111
121
  end
112
122
 
113
123
  context "capistrano-ish methods" do
114
124
  it "has them" do
115
- deploy_hook.eval_hook('respond_to?(:latest_release) ').should be_true
116
- deploy_hook.eval_hook('respond_to?(:previous_release) ').should be_true
117
- deploy_hook.eval_hook('respond_to?(:all_releases) ').should be_true
118
- deploy_hook.eval_hook('respond_to?(:current_path) ').should be_true
119
- deploy_hook.eval_hook('respond_to?(:shared_path) ').should be_true
120
- deploy_hook.eval_hook('respond_to?(:release_dir) ').should be_true
121
- deploy_hook.eval_hook('respond_to?(:failed_release_dir)').should be_true
122
- deploy_hook.eval_hook('respond_to?(:release_path) ').should be_true
125
+ expect(deploy_hook.eval_hook('respond_to?(:latest_release) ')).to be_true
126
+ expect(deploy_hook.eval_hook('respond_to?(:previous_release) ')).to be_true
127
+ expect(deploy_hook.eval_hook('respond_to?(:all_releases) ')).to be_true
128
+ expect(deploy_hook.eval_hook('respond_to?(:current_path) ')).to be_true
129
+ expect(deploy_hook.eval_hook('respond_to?(:shared_path) ')).to be_true
130
+ expect(deploy_hook.eval_hook('respond_to?(:release_dir) ')).to be_true
131
+ expect(deploy_hook.eval_hook('respond_to?(:failed_release_dir)')).to be_true
132
+ expect(deploy_hook.eval_hook('respond_to?(:release_path) ')).to be_true
123
133
  end
124
134
 
125
135
  it "shows a deprecation warning that asks you to use config to access these variables" do
126
- deploy_hook.eval_hook('shared_path.nil?').should be_false
136
+ expect(deploy_hook.eval_hook('shared_path.nil?')).to be_false
127
137
  out = read_output
128
- out.should include("Use of `shared_path` (via method_missing) is deprecated in favor of `config.shared_path` for improved error messages and compatibility.")
129
- out.should =~ %r|in /data/app_name/releases/\d+/deploy/fake_test_hook.rb|
138
+ expect(out).to include("Use of `shared_path` (via method_missing) is deprecated in favor of `config.shared_path` for improved error messages and compatibility.")
139
+ expect(out).to match(%r|in /data/app_name/releases/\d+/deploy/fake_test_hook.rb|)
130
140
  end
131
141
  end
132
142
 
@@ -136,15 +146,15 @@ describe "deploy hooks" do
136
146
  end
137
147
 
138
148
  it "has account_name" do
139
- @hook.eval_hook('account_name').should == 'acc'
149
+ expect(@hook.eval_hook('account_name')).to eq('acc')
140
150
  end
141
151
 
142
152
  it "has environment_name" do
143
- @hook.eval_hook('environment_name').should == 'env'
153
+ expect(@hook.eval_hook('environment_name')).to eq('env')
144
154
  end
145
155
 
146
156
  it "has app_name" do
147
- @hook.eval_hook('app_name').should == 'app'
157
+ expect(@hook.eval_hook('app_name')).to eq('app')
148
158
  end
149
159
  end
150
160
 
@@ -162,50 +172,50 @@ describe "deploy hooks" do
162
172
  end
163
173
 
164
174
  it "is deprecated through the @node ivar" do
165
- deploy_hook.eval_hook('@node.nil?').should be_false
175
+ expect(deploy_hook.eval_hook('@node.nil?')).to be_false
166
176
  out = read_output
167
- out.should =~ %r|Use of `@node` in deploy hooks is deprecated.|
168
- out.should =~ %r|Please use `config.node`, which provides access to the same object.|
169
- out.should =~ %r|/data/app_name/releases/\d+/deploy/fake_test_hook.rb|
177
+ expect(out).to match(%r|Use of `@node` in deploy hooks is deprecated.|)
178
+ expect(out).to match(%r|Please use `config.node`, which provides access to the same object.|)
179
+ expect(out).to match(%r|/data/app_name/releases/\d+/deploy/fake_test_hook.rb|)
170
180
  end
171
181
 
172
182
  it "is available" do
173
- deploy_hook.eval_hook('config.node.nil?').should be_false
183
+ expect(deploy_hook.eval_hook('config.node.nil?')).to be_false
174
184
  end
175
185
 
176
186
  it "has indifferent access" do
177
- deploy_hook.eval_hook('config.node[:instance_role] ').should == 'solo'
178
- deploy_hook.eval_hook('config.node["instance_role"]').should == 'solo'
187
+ expect(deploy_hook.eval_hook('config.node[:instance_role] ')).to eq('solo')
188
+ expect(deploy_hook.eval_hook('config.node["instance_role"]')).to eq('solo')
179
189
  end
180
190
 
181
191
  it "has deep indifferent access" do
182
- deploy_hook.eval_hook('config.node["applications"]["myapp"]["type"]').should == 'rails'
183
- deploy_hook.eval_hook('config.node[:applications]["myapp"][:type] ').should == 'rails'
184
- deploy_hook.eval_hook('config.node[:applications][:myapp][:type] ').should == 'rails'
192
+ expect(deploy_hook.eval_hook('config.node["applications"]["myapp"]["type"]')).to eq('rails')
193
+ expect(deploy_hook.eval_hook('config.node[:applications]["myapp"][:type] ')).to eq('rails')
194
+ expect(deploy_hook.eval_hook('config.node[:applications][:myapp][:type] ')).to eq('rails')
185
195
  end
186
196
  end
187
197
 
188
198
  context "config" do
189
199
  it "is available" do
190
- deploy_hook.eval_hook('config.nil?').should be_false
200
+ expect(deploy_hook.eval_hook('config.nil?')).to be_false
191
201
  end
192
202
 
193
203
  it "is deprecated through the @configuration ivar" do
194
- deploy_hook.eval_hook('@configuration.nil?').should be_false
204
+ expect(deploy_hook.eval_hook('@configuration.nil?')).to be_false
195
205
  out = read_output
196
- out.should =~ %r|Use of `@configuration` in deploy hooks is deprecated.|
197
- out.should =~ %r|Please use `config`, which provides access to the same object.|
198
- out.should =~ %r|/data/app_name/releases/\d+/deploy/fake_test_hook.rb|
206
+ expect(out).to match(%r|Use of `@configuration` in deploy hooks is deprecated.|)
207
+ expect(out).to match(%r|Please use `config`, which provides access to the same object.|)
208
+ expect(out).to match(%r|/data/app_name/releases/\d+/deploy/fake_test_hook.rb|)
199
209
  end
200
210
 
201
211
  it "has the configuration in it" do
202
- deploy_hook('bert' => 'ernie').eval_hook('config.bert').should == 'ernie'
212
+ expect(deploy_hook('bert' => 'ernie').eval_hook('config.bert')).to eq('ernie')
203
213
  end
204
214
 
205
215
  it "can be accessed with method calls, with [:symbols], or ['strings']" do
206
- deploy_hook('bert' => 'ernie').eval_hook('config.bert ').should == 'ernie'
207
- deploy_hook('bert' => 'ernie').eval_hook('config[:bert] ').should == 'ernie'
208
- deploy_hook('bert' => 'ernie').eval_hook('config["bert"]').should == 'ernie'
216
+ expect(deploy_hook('bert' => 'ernie').eval_hook('config.bert ')).to eq('ernie')
217
+ expect(deploy_hook('bert' => 'ernie').eval_hook('config[:bert] ')).to eq('ernie')
218
+ expect(deploy_hook('bert' => 'ernie').eval_hook('config["bert"]')).to eq('ernie')
209
219
  end
210
220
 
211
221
  [:repository_cache,
@@ -217,17 +227,17 @@ describe "deploy hooks" do
217
227
  :revision,
218
228
  :environment].each do |attribute|
219
229
  it "has the #{attribute.inspect} attribute for compatibility with chef-deploy" do
220
- deploy_hook.eval_hook("config.has_key?(#{attribute.inspect})").should be_true
230
+ expect(deploy_hook.eval_hook("config.has_key?(#{attribute.inspect})")).to be_true
221
231
  end
222
232
  end
223
233
  end
224
234
 
225
235
  context "environment variables" do
226
236
  it "sets the framework env variables" do
227
- deploy_hook('framework_env' => 'production').eval_hook("ENV['RAILS_ENV']").should == 'production'
228
- deploy_hook('framework_env' => 'production').eval_hook("ENV['RACK_ENV'] ").should == 'production'
229
- deploy_hook('framework_env' => 'production').eval_hook("ENV['MERB_ENV'] ").should == 'production'
230
- deploy_hook('framework_env' => 'production').eval_hook("ENV['NODE_ENV'] ").should == 'production'
237
+ expect(deploy_hook('framework_env' => 'production').eval_hook("ENV['RAILS_ENV']")).to eq('production')
238
+ expect(deploy_hook('framework_env' => 'production').eval_hook("ENV['RACK_ENV'] ")).to eq('production')
239
+ expect(deploy_hook('framework_env' => 'production').eval_hook("ENV['MERB_ENV'] ")).to eq('production')
240
+ expect(deploy_hook('framework_env' => 'production').eval_hook("ENV['NODE_ENV'] ")).to eq('production')
231
241
  end
232
242
  end
233
243
 
@@ -257,74 +267,78 @@ describe "deploy hooks" do
257
267
  end
258
268
 
259
269
  it "#on_app_master runs on app masters and solos" do
260
- where_code_runs_with("on_app_master").should == %w(solo app_master)
270
+ expect(where_code_runs_with("on_app_master")).to eq(%w(solo app_master))
261
271
  end
262
272
 
263
273
  it "#on_app_servers runs on app masters, app slaves, and solos" do
264
- where_code_runs_with("on_app_servers").should == %w(solo app_master app multi_role,app)
274
+ expect(where_code_runs_with("on_app_servers")).to eq(%w(solo app_master app multi_role,app))
265
275
  end
266
276
 
267
277
  it "#on_app_servers_and_utilities does what it says on the tin" do
268
- where_code_runs_with("on_app_servers_and_utilities").should ==
278
+ expect(where_code_runs_with("on_app_servers_and_utilities")).to eq(
269
279
  %w(solo app_master app multi_role,app multi,util util_alpha util_beta util_gamma)
280
+ )
270
281
  end
271
282
 
272
283
  it "#on_utilities() runs on all utility instances" do
273
- where_code_runs_with("on_utilities").should ==
284
+ expect(where_code_runs_with("on_utilities")).to eq(
274
285
  %w(multi,util util_alpha util_beta util_gamma)
286
+ )
275
287
  end
276
288
 
277
289
  it "#on_utilities('sometype') runs on only utilities of type 'sometype'" do
278
- where_code_runs_with("on_utilities('alpha')").should == %w(util_alpha)
290
+ expect(where_code_runs_with("on_utilities('alpha')")).to eq(%w(util_alpha))
279
291
  end
280
292
 
281
293
  it "#on_utilities('type1', 'type2') runs on utilities of both types" do
282
- where_code_runs_with("on_utilities('alpha', 'beta')").should ==
294
+ expect(where_code_runs_with("on_utilities('alpha', 'beta')")).to eq(
283
295
  %w(util_alpha util_beta)
296
+ )
284
297
  end
285
298
 
286
299
  it "#on_utilities can be invoked with (['a', 'b']) or ('a', 'b')" do
287
- where_code_runs_with("on_utilities(%w[alpha beta])").should ==
300
+ expect(where_code_runs_with("on_utilities(%w[alpha beta])")).to eq(
288
301
  where_code_runs_with("on_utilities('alpha', 'beta')")
302
+ )
289
303
  end
290
304
  end
291
305
 
292
306
  context "#syntax_error" do
293
307
  it "returns nil for hook files containing valid Ruby syntax" do
294
308
  hook_path = File.expand_path('../fixtures/valid_hook.rb', __FILE__)
295
- deploy_hook.syntax_error(hook_path).should be_nil
309
+ expect(deploy_hook.syntax_error(hook_path)).to be_nil
296
310
  end
297
311
 
298
312
  it "returns a brief problem description for hook files containing valid Ruby syntax" do
299
313
  hook_path = File.expand_path('../fixtures/invalid_hook.rb', __FILE__)
300
314
  error = Regexp.escape("spec/fixtures/invalid_hook.rb:1: syntax error, unexpected '^'")
301
- deploy_hook.syntax_error(hook_path).should =~ /#{error}/
315
+ expect(deploy_hook.syntax_error(hook_path)).to match(/#{error}/)
302
316
  end
303
317
  end
304
318
 
305
319
  context "errors in hooks" do
306
320
  it "shows the error in a helpful way" do
307
- lambda {
321
+ expect {
308
322
  deploy_hook.eval_hook('methedo_no_existo')
309
- }.should raise_error(NameError)
323
+ }.to raise_error(NameError)
310
324
  out = read_output
311
- out.should =~ %r|FATAL: Exception raised in deploy hook /data/app_name/releases/\d+/deploy/fake_test_hook.rb.|
312
- out.should =~ %r|NameError: undefined local variable or method `methedo_no_existo' for|
313
- out.should =~ %r|Please fix this error before retrying.|
325
+ expect(out).to match(%r|FATAL: Exception raised in deploy hook /data/app_name/releases/\d+/deploy/fake_test_hook.rb.|)
326
+ expect(out).to match(%r|NameError: undefined local variable or method `methedo_no_existo' for|)
327
+ expect(out).to match(%r|Please fix this error before retrying.|)
314
328
  end
315
329
  end
316
330
 
317
331
  context "is compatible with older deploy hook scripts" do
318
332
  it "#current_role returns the first role" do
319
- deploy_hook('current_roles' => %w(a b)).eval_hook('current_role').should == 'a'
333
+ expect(deploy_hook('current_roles' => %w(a b)).eval_hook('current_role')).to eq('a')
320
334
  end
321
335
 
322
336
  it "has info, warning, debug, logged_system, and access to shell" do
323
- deploy_hook.eval_hook('respond_to?(:info) ').should be_true
324
- deploy_hook.eval_hook('respond_to?(:warning) ').should be_true
325
- deploy_hook.eval_hook('respond_to?(:debug) ').should be_true
326
- deploy_hook.eval_hook('respond_to?(:logged_system)').should be_true
327
- deploy_hook.eval_hook('respond_to?(:shell) ').should be_true
337
+ expect(deploy_hook.eval_hook('respond_to?(:info) ')).to be_true
338
+ expect(deploy_hook.eval_hook('respond_to?(:warning) ')).to be_true
339
+ expect(deploy_hook.eval_hook('respond_to?(:debug) ')).to be_true
340
+ expect(deploy_hook.eval_hook('respond_to?(:logged_system)')).to be_true
341
+ expect(deploy_hook.eval_hook('respond_to?(:shell) ')).to be_true
328
342
  end
329
343
  end
330
344
  end
@@ -13,11 +13,11 @@ describe EY::Serverside do
13
13
  end
14
14
 
15
15
  it "deprecates EY::Serverside::LoggedOutput for EY::Serverside::Shell::Helpers" do
16
- EY::Serverside::LoggedOutput.should == EY::Serverside::Shell::Helpers
17
- @warnings.string.should include("EY::Serverside::LoggedOutput")
16
+ expect(EY::Serverside::LoggedOutput).to eq(EY::Serverside::Shell::Helpers)
17
+ expect(@warnings.string).to include("EY::Serverside::LoggedOutput")
18
18
  end
19
19
 
20
20
  it "doesn't interfere with unrelated constants" do
21
- lambda{ EY::Serverside::WTFNotDefined }.should raise_error(NameError, /uninitialized constant.*WTFNotDefined/)
21
+ expect{ EY::Serverside::WTFNotDefined }.to raise_error(NameError, /uninitialized constant.*WTFNotDefined/)
22
22
  end
23
23
  end
@@ -7,11 +7,11 @@ describe "Deploying an app with ey.yml" do
7
7
  end
8
8
 
9
9
  it "does not migrate even though ey.yml says migrate: true" do
10
- read_output.should_not =~ /Migrating/
10
+ expect(read_output).not_to match(/Migrating/)
11
11
  end
12
12
 
13
13
  it "does not enable the maintenance page at all" do
14
- deploy_dir.join('current','maintenance_disabled').should exist
14
+ expect(deploy_dir.join('current','maintenance_disabled')).to exist
15
15
  end
16
16
  end
17
17
 
@@ -23,45 +23,45 @@ describe "Deploying an app with ey.yml" do
23
23
 
24
24
  it "excludes copy_excludes from releases" do
25
25
  cmd = @deployer.commands.grep(/rsync -aq/).first
26
- cmd.should include('rsync -aq --exclude=".git" --exclude="README"')
27
- deploy_dir.join('current', '.git').should_not exist
28
- deploy_dir.join('current', 'README').should_not exist
26
+ expect(cmd).to include('rsync -aq --exclude=".git" --exclude="README"')
27
+ expect(deploy_dir.join('current', '.git')).not_to exist
28
+ expect(deploy_dir.join('current', 'README')).not_to exist
29
29
  end
30
30
 
31
31
  it "loads ey.yml at lower priority than command line options" do
32
- deploy_dir.join('current', 'REVISION').read.should == "somebranch\n"
32
+ expect(deploy_dir.join('current', 'REVISION').read).to eq("somebranch\n")
33
33
  end
34
34
 
35
35
  it "loads bundle_without from the config, which overrides the default (and 'defaults:' in ey.yml)" do
36
36
  cmd = @deployer.commands.grep(/bundle _\S*_ install/).first
37
- cmd.should include('--without only test')
37
+ expect(cmd).to include('--without only test')
38
38
  end
39
39
 
40
40
  it "does not enable the maintenance page during migrations" do
41
- deploy_dir.join('current','maintenance_disabled').should exist
42
- deploy_dir.join('current','maintenance_enabled').should_not exist
41
+ expect(deploy_dir.join('current','maintenance_disabled')).to exist
42
+ expect(deploy_dir.join('current','maintenance_enabled')).not_to exist
43
43
  end
44
44
 
45
45
  it "does not remove an existing maintenance page" do
46
46
  maintenance = EY::Serverside::Maintenance.new(test_servers, @config, test_shell)
47
47
  deploy_dir.join('current','maintenance_disabled').delete
48
48
  maintenance.manually_enable
49
- deploy_dir.join('shared','system','maintenance.html').should exist
49
+ expect(deploy_dir.join('shared','system','maintenance.html')).to exist
50
50
  redeploy_test_application
51
- read_output.should =~ /Maintenance page is still up./
52
- deploy_dir.join('shared','system','maintenance.html').should exist
53
- deploy_dir.join('current','maintenance_disabled').should_not exist
54
- deploy_dir.join('current','maintenance_enabled').should exist
51
+ expect(read_output).to match(/Maintenance page is still up./)
52
+ expect(deploy_dir.join('shared','system','maintenance.html')).to exist
53
+ expect(deploy_dir.join('current','maintenance_disabled')).not_to exist
54
+ expect(deploy_dir.join('current','maintenance_enabled')).to exist
55
55
  maintenance.manually_disable
56
- deploy_dir.join('shared','system','maintenance.html').should_not exist
56
+ expect(deploy_dir.join('shared','system','maintenance.html')).not_to exist
57
57
  end
58
58
 
59
59
  it "makes custom variables available to hooks" do
60
- deploy_dir.join('current', 'custom_hook').read.should include("custom_from_ey_yml")
60
+ expect(deploy_dir.join('current', 'custom_hook').read).to include("custom_from_ey_yml")
61
61
  end
62
62
 
63
63
  it "doesn't display the database adapter warning with ignore_database_adapter_warning: true" do
64
- read_output.should_not =~ /WARNING/
64
+ expect(read_output).not_to match(/WARNING/)
65
65
  end
66
66
  end
67
67
 
@@ -74,12 +74,12 @@ describe "Deploying an app with ey.yml" do
74
74
  end
75
75
 
76
76
  it "always installs maintenance pages" do
77
- deploy_dir.join('current','maintenance_enabled').should exist
78
- deploy_dir.join('current','maintenance_disabled').should_not exist
77
+ expect(deploy_dir.join('current','maintenance_enabled')).to exist
78
+ expect(deploy_dir.join('current','maintenance_disabled')).not_to exist
79
79
  end
80
80
 
81
81
  it "displays the database adapter warning without ignore_database_adapter_warning" do
82
- read_output.should =~ /WARNING: Gemfile.lock does not contain a recognized database adapter./
82
+ expect(read_output).to match(/WARNING: Gemfile.lock does not contain a recognized database adapter./)
83
83
  end
84
84
  end
85
85
 
@@ -93,7 +93,7 @@ describe "Deploying an app with ey.yml" do
93
93
  end
94
94
 
95
95
  it "doesn't display the database adapter warning" do
96
- read_output.should_not =~ /WARNING: Gemfile.lock does not contain a recognized database adapter./
96
+ expect(read_output).not_to match(/WARNING: Gemfile.lock does not contain a recognized database adapter./)
97
97
  end
98
98
  end
99
99
  end