whiskey_disk 0.0.7 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,295 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper.rb'))
2
- require 'rake'
3
-
4
- describe 'rake tasks' do
5
- before do
6
- Rake.application = @rake = Rake::Application.new
7
- load File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'tasks', 'deploy.rb'))
8
- WhiskeyDisk.reset
9
- end
10
-
11
- after do
12
- Rake.application = nil
13
- end
14
-
15
- describe 'deploy:setup' do
16
- describe 'when a domain is specified' do
17
- before do
18
- @configuration = { 'domain' => 'some domain'}
19
- WhiskeyDisk::Config.stub!(:fetch).and_return(@configuration)
20
- [
21
- :ensure_main_parent_path_is_present,
22
- :ensure_config_parent_path_is_present,
23
- :checkout_main_repository,
24
- :install_hooks,
25
- :checkout_configuration_repository,
26
- :update_main_repository_checkout,
27
- :update_configuration_repository_checkout,
28
- :refresh_configuration,
29
- :run_post_setup_hooks,
30
- :flush
31
- ].each do |meth|
32
- WhiskeyDisk.stub!(meth)
33
- end
34
- end
35
-
36
- it 'should make changes on the specified domain' do
37
- @rake["deploy:setup"].invoke
38
- WhiskeyDisk.should.be.remote
39
- end
40
-
41
- it 'should ensure that the parent path for the main repository checkout is present' do
42
- WhiskeyDisk.should.receive(:ensure_main_parent_path_is_present)
43
- @rake["deploy:setup"].invoke
44
- end
45
-
46
- it 'should ensure that the parent path for the configuration repository checkout is present' do
47
- WhiskeyDisk.should.receive(:ensure_config_parent_path_is_present)
48
- @rake["deploy:setup"].invoke
49
- end
50
-
51
- it 'should check out the main repository' do
52
- WhiskeyDisk.should.receive(:checkout_main_repository)
53
- @rake["deploy:setup"].invoke
54
- end
55
-
56
- it 'should install a post-receive hook on the checked out repository' do
57
- WhiskeyDisk.should.receive(:install_hooks)
58
- @rake["deploy:setup"].invoke
59
- end
60
-
61
- it 'should check out the configuration repository' do
62
- WhiskeyDisk.should.receive(:checkout_configuration_repository)
63
- @rake["deploy:setup"].invoke
64
- end
65
-
66
- it 'should update the main repository checkout' do
67
- WhiskeyDisk.should.receive(:update_main_repository_checkout)
68
- @rake["deploy:setup"].invoke
69
- end
70
-
71
- it 'should update the configuration repository checkout' do
72
- WhiskeyDisk.should.receive(:update_configuration_repository_checkout)
73
- @rake["deploy:setup"].invoke
74
- end
75
-
76
- it 'should refresh the configuration' do
77
- WhiskeyDisk.should.receive(:refresh_configuration)
78
- @rake["deploy:setup"].invoke
79
- end
80
-
81
- it 'should run any post setup hooks' do
82
- WhiskeyDisk.should.receive(:run_post_setup_hooks)
83
- @rake["deploy:setup"].invoke
84
- end
85
-
86
- it 'should flush WhiskeyDisk changes' do
87
- WhiskeyDisk.should.receive(:flush)
88
- @rake["deploy:setup"].invoke
89
- end
90
- end
91
-
92
- describe 'when no domain is specified' do
93
- before do
94
- @configuration = { 'domain' => '' }
95
- WhiskeyDisk::Config.stub!(:fetch).and_return(@configuration)
96
-
97
- [
98
- :ensure_config_parent_path_is_present,
99
- :checkout_configuration_repository,
100
- :update_configuration_repository_checkout,
101
- :refresh_configuration,
102
- :run_post_setup_hooks,
103
- :flush
104
- ].each do |meth|
105
- WhiskeyDisk.stub!(meth)
106
- end
107
- end
108
-
109
- it 'should make changes on the local system' do
110
- WhiskeyDisk.should.not.be.remote
111
- end
112
-
113
- it 'should NOT ensure that the parent path for the main repository checkout is present' do
114
- WhiskeyDisk.should.not.receive(:ensure_main_parent_path_is_present)
115
- @rake["deploy:setup"].invoke
116
- end
117
-
118
- it 'should ensure that the parent path for the configuration repository checkout is present' do
119
- WhiskeyDisk.should.receive(:ensure_config_parent_path_is_present)
120
- @rake["deploy:setup"].invoke
121
- end
122
-
123
- it 'should NOT check out the main repository' do
124
- WhiskeyDisk.should.not.receive(:checkout_main_repository)
125
- @rake["deploy:setup"].invoke
126
- end
127
-
128
- it 'should NOT install a post-receive hook on the checked out repository' do
129
- WhiskeyDisk.should.not.receive(:install_hooks)
130
- @rake["deploy:setup"].invoke
131
- end
132
-
133
- it 'should check out the configuration repository' do
134
- WhiskeyDisk.should.receive(:checkout_configuration_repository)
135
- @rake["deploy:setup"].invoke
136
- end
137
-
138
- it 'should update the configuration repository checkout' do
139
- WhiskeyDisk.should.receive(:update_configuration_repository_checkout)
140
- @rake["deploy:setup"].invoke
141
- end
142
-
143
- it 'should refresh the configuration' do
144
- WhiskeyDisk.should.receive(:refresh_configuration)
145
- @rake["deploy:setup"].invoke
146
- end
147
-
148
- it 'should run any post setup hooks' do
149
- WhiskeyDisk.should.receive(:run_post_setup_hooks)
150
- @rake["deploy:setup"].invoke
151
- end
152
-
153
- it 'should flush WhiskeyDisk changes' do
154
- WhiskeyDisk.should.receive(:flush)
155
- @rake["deploy:setup"].invoke
156
- end
157
- end
158
- end
159
-
160
- describe 'deploy:now' do
161
- describe 'when a domain is specified' do
162
- before do
163
- @configuration = { 'domain' => 'some domain'}
164
- WhiskeyDisk::Config.stub!(:fetch).and_return(@configuration)
165
- [
166
- :update_main_repository_checkout,
167
- :update_configuration_repository_checkout,
168
- :refresh_configuration,
169
- :run_post_deploy_hooks,
170
- :flush
171
- ].each do |meth|
172
- WhiskeyDisk.stub!(meth)
173
- end
174
- end
175
- it 'should make changes on the specified domain' do
176
- @rake["deploy:now"].invoke
177
- WhiskeyDisk.should.be.remote
178
- end
179
-
180
- it 'should update the main repository checkout' do
181
- WhiskeyDisk.should.receive(:update_main_repository_checkout)
182
- @rake["deploy:now"].invoke
183
- end
184
-
185
- it 'should update the configuration repository checkout' do
186
- WhiskeyDisk.should.receive(:update_configuration_repository_checkout)
187
- @rake["deploy:now"].invoke
188
- end
189
-
190
- it 'should refresh the configuration' do
191
- WhiskeyDisk.should.receive(:refresh_configuration)
192
- @rake["deploy:now"].invoke
193
- end
194
-
195
- it 'should run any post deployment hooks' do
196
- WhiskeyDisk.should.receive(:run_post_deploy_hooks)
197
- @rake["deploy:now"].invoke
198
- end
199
-
200
- it 'should flush WhiskeyDisk changes' do
201
- WhiskeyDisk.should.receive(:flush)
202
- @rake["deploy:now"].invoke
203
- end
204
- end
205
-
206
- describe 'when no domain is specified' do
207
- before do
208
- @configuration = { 'domain' => '' }
209
- WhiskeyDisk::Config.stub!(:fetch).and_return(@configuration)
210
-
211
- [
212
- :update_configuration_repository_checkout,
213
- :refresh_configuration,
214
- :run_post_deploy_hooks,
215
- :flush
216
- ].each do |meth|
217
- WhiskeyDisk.stub!(meth)
218
- end
219
- end
220
-
221
- it 'should make changes on the local system' do
222
- WhiskeyDisk.should.not.be.remote
223
- end
224
-
225
- it 'should NOT update the main repository checkout' do
226
- WhiskeyDisk.should.not.receive(:update_main_repository_checkout)
227
- @rake["deploy:now"].invoke
228
- end
229
-
230
- it 'should update the configuration repository checkout' do
231
- WhiskeyDisk.should.receive(:update_configuration_repository_checkout)
232
- @rake["deploy:now"].invoke
233
- end
234
-
235
- it 'should refresh the configuration' do
236
- WhiskeyDisk.should.receive(:refresh_configuration)
237
- @rake["deploy:now"].invoke
238
- end
239
-
240
- it 'should run any post deployment hooks' do
241
- WhiskeyDisk.should.receive(:run_post_deploy_hooks)
242
- @rake["deploy:now"].invoke
243
- end
244
-
245
- it 'should flush WhiskeyDisk changes' do
246
- WhiskeyDisk.should.receive(:flush)
247
- @rake["deploy:now"].invoke
248
- end
249
- end
250
-
251
- describe 'deploy:post_setup' do
252
- it 'should run the defined post_setup rake task when a post_setup rake task is defined for this environment' do
253
- @configuration = { 'environment' => 'production'}
254
- WhiskeyDisk::Config.stub!(:fetch).and_return(@configuration)
255
- WhiskeyDisk.reset
256
-
257
- task "deploy:production:post_setup" do
258
- WhiskeyDisk.fake_method
259
- end
260
-
261
- WhiskeyDisk.should.receive(:fake_method)
262
- Rake::Task['deploy:post_setup'].invoke
263
- end
264
-
265
- it 'should not fail when no post_setup rake task is defined for this environment' do
266
- @configuration = { 'environment' => 'staging'}
267
- WhiskeyDisk::Config.stub!(:fetch).and_return(@configuration)
268
- WhiskeyDisk.reset
269
- lambda { Rake::Task['deploy:post_setup'].invoke }.should.not.raise
270
- end
271
- end
272
-
273
- describe 'deploy:post_deploy' do
274
- it 'should run the defined post_deploy rake task when a post_deploy rake task is defined for this environment' do
275
- @configuration = { 'environment' => 'production'}
276
- WhiskeyDisk::Config.stub!(:fetch).and_return(@configuration)
277
- WhiskeyDisk.reset
278
-
279
- task "deploy:production:post_deploy" do
280
- WhiskeyDisk.fake_method
281
- end
282
-
283
- WhiskeyDisk.should.receive(:fake_method)
284
- Rake::Task['deploy:post_deploy'].invoke
285
- end
286
-
287
- it 'should not fail when no post_deploy rake task is defined for this environment' do
288
- @configuration = { 'environment' => 'staging'}
289
- WhiskeyDisk::Config.stub!(:fetch).and_return(@configuration)
290
- WhiskeyDisk.reset
291
- lambda { Rake::Task['deploy:post_deploy'].invoke }.should.not.raise
292
- end
293
- end
294
- end
295
- end