minitest-capistrano 0.0.5 → 0.0.6
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.
- data/lib/minitest/capistrano.rb +45 -0
- data/lib/minitest/capistrano/version.rb +1 -1
- data/spec/minitest_capistrano_spec.rb +36 -0
- metadata +7 -7
data/lib/minitest/capistrano.rb
CHANGED
@@ -62,6 +62,25 @@ module MiniTest
|
|
62
62
|
assert_nil configuration.captures[cmd], msg
|
63
63
|
end
|
64
64
|
|
65
|
+
##
|
66
|
+
# Fails unless +configuration+ has put +cmd+.
|
67
|
+
#
|
68
|
+
# assert_have_put "/tmp/thefile", configuration, "thedata"
|
69
|
+
|
70
|
+
def assert_have_put(path, configuration, data, msg = nil)
|
71
|
+
msg ||= "Expected configuration to put #{path} with data, but did not"
|
72
|
+
refute_nil configuration.putes[path], msg
|
73
|
+
assert_equal configuration.putes[path][:data], data, msg
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Fails if +configuration+ has put +path+.
|
78
|
+
|
79
|
+
def refute_have_put(path, configuration, data = nil, msg = nil)
|
80
|
+
msg ||= "Expected configuration to not put #{path}, but did"
|
81
|
+
assert_nil configuration.putes[path], msg
|
82
|
+
end
|
83
|
+
|
65
84
|
##
|
66
85
|
# Fails unless +configuration+ has a callback of +before_task_name+ before
|
67
86
|
# +task_name+.
|
@@ -199,6 +218,24 @@ module MiniTest
|
|
199
218
|
|
200
219
|
infect_an_assertion :refute_have_captured, :wont_have_captured
|
201
220
|
|
221
|
+
##
|
222
|
+
# See MiniTest::Assertions#assert_have_put
|
223
|
+
#
|
224
|
+
# config.must_have_put path, data
|
225
|
+
#
|
226
|
+
# :method: must_have_put
|
227
|
+
|
228
|
+
infect_an_assertion :assert_have_put, :must_have_put
|
229
|
+
|
230
|
+
##
|
231
|
+
# See MiniTest::Assertions#refute_have_put
|
232
|
+
#
|
233
|
+
# config.wont_have_put path, data
|
234
|
+
#
|
235
|
+
# :method: wont_have_put
|
236
|
+
|
237
|
+
infect_an_assertion :refute_have_put, :wont_have_put
|
238
|
+
|
202
239
|
##
|
203
240
|
# See MiniTest::Assertions#assert_callback_before
|
204
241
|
#
|
@@ -285,6 +322,14 @@ module MiniTest
|
|
285
322
|
@uploads ||= {}
|
286
323
|
end
|
287
324
|
|
325
|
+
def put(data, path, options={})
|
326
|
+
putes[path] = {:data => data, :options => options}
|
327
|
+
end
|
328
|
+
|
329
|
+
def putes
|
330
|
+
@putes ||= {}
|
331
|
+
end
|
332
|
+
|
288
333
|
def capture(command, options={})
|
289
334
|
captures[command] = {:options => options}
|
290
335
|
captures_responses[command]
|
@@ -50,6 +50,19 @@ describe MiniTest::Capistrano::ConfigurationExtension do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
describe "#put" do
|
54
|
+
it "starts with an empty hash" do
|
55
|
+
@config.putes.must_be_empty
|
56
|
+
end
|
57
|
+
|
58
|
+
it "adds an entry to the hash when called" do
|
59
|
+
@config.putes.must_be_empty
|
60
|
+
@config.put "data", "path"
|
61
|
+
@config.putes.wont_be_empty
|
62
|
+
@config.putes["path"].wont_be_nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
53
66
|
describe "#capture" do
|
54
67
|
it "starts with an empty hash" do
|
55
68
|
@config.captures.must_be_empty
|
@@ -125,6 +138,19 @@ describe MiniTest::Assertions do
|
|
125
138
|
subject.refute_have_captured "cat /tmp/anything", @config
|
126
139
|
end
|
127
140
|
|
141
|
+
it "assert a file has been put" do
|
142
|
+
@config.put "#!/usr/bin/env ruby", "/tmp/server.rb"
|
143
|
+
subject.assert_have_put "/tmp/server.rb", @config, "#!/usr/bin/env ruby"
|
144
|
+
end
|
145
|
+
|
146
|
+
it "refutes a file has been put with data" do
|
147
|
+
subject.refute_have_put "/tmp/anything", @config, "data"
|
148
|
+
end
|
149
|
+
|
150
|
+
it "refutes a file has been put with no data" do
|
151
|
+
subject.refute_have_put "/tmp/anything", @config
|
152
|
+
end
|
153
|
+
|
128
154
|
it "asserts a callback exists for one task before another" do
|
129
155
|
@config.before :startup, :announce_startup
|
130
156
|
|
@@ -193,6 +219,16 @@ describe MiniTest::Expectations do
|
|
193
219
|
@config.wont_have_captured "yabba dabba"
|
194
220
|
end
|
195
221
|
|
222
|
+
it "needs to verify a file has been put" do
|
223
|
+
@config.put "thedata", "thepath"
|
224
|
+
@config.must_have_put "thepath", "thedata"
|
225
|
+
end
|
226
|
+
|
227
|
+
it "needs to verify a file has not been put" do
|
228
|
+
@config.put "yabbadabbadata", "yepperspath"
|
229
|
+
@config.wont_have_put "nopath"
|
230
|
+
end
|
231
|
+
|
196
232
|
it "needs to verify a callback exists for a task before another" do
|
197
233
|
@config.before :stop, :warn_people
|
198
234
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-capistrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
16
|
-
requirement: &
|
16
|
+
requirement: &70262687273480 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.10.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70262687273480
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: capistrano
|
27
|
-
requirement: &
|
27
|
+
requirement: &70262687271540 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '2.9'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70262687271540
|
36
36
|
description: MiniTest assertions and expectations for testing Capistrano recipes
|
37
37
|
email:
|
38
38
|
- fnichol@nichol.ca
|
@@ -65,7 +65,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
65
|
version: '0'
|
66
66
|
segments:
|
67
67
|
- 0
|
68
|
-
hash:
|
68
|
+
hash: -1505468003130279717
|
69
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
70
|
none: false
|
71
71
|
requirements:
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
version: '0'
|
75
75
|
segments:
|
76
76
|
- 0
|
77
|
-
hash:
|
77
|
+
hash: -1505468003130279717
|
78
78
|
requirements: []
|
79
79
|
rubyforge_project:
|
80
80
|
rubygems_version: 1.8.10
|