minitest-capistrano 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/minitest/capistrano.rb +36 -0
- data/lib/minitest/capistrano/version.rb +1 -1
- data/spec/minitest_capistrano_spec.rb +19 -0
- metadata +12 -6
data/lib/minitest/capistrano.rb
CHANGED
@@ -44,6 +44,24 @@ module MiniTest
|
|
44
44
|
assert_empty configuration.runs, msg
|
45
45
|
end
|
46
46
|
|
47
|
+
##
|
48
|
+
# Fails unless +configuration+ has captured +cmd+.
|
49
|
+
#
|
50
|
+
# assert_have_captured "echo hi", configuration
|
51
|
+
|
52
|
+
def assert_have_captured(cmd, configuration, msg = nil)
|
53
|
+
msg ||= "Expected configuration to capture #{cmd}, but did not"
|
54
|
+
refute_nil configuration.captures[cmd], msg
|
55
|
+
end
|
56
|
+
|
57
|
+
##
|
58
|
+
# Fails if +configuration+ has captured +cmd+.
|
59
|
+
|
60
|
+
def refute_have_captured(cmd, configuration, msg = nil)
|
61
|
+
msg ||= "Expected configuration to not capture #{cmd}, but did"
|
62
|
+
assert_nil configuration.captures[cmd], msg
|
63
|
+
end
|
64
|
+
|
47
65
|
##
|
48
66
|
# Fails unless +configuration+ has a callback of +before_task_name+ before
|
49
67
|
# +task_name+.
|
@@ -163,6 +181,24 @@ module MiniTest
|
|
163
181
|
|
164
182
|
infect_an_assertion :refute_have_run_something, :wont_have_run_anything, true
|
165
183
|
|
184
|
+
##
|
185
|
+
# See MiniTest::Assertions#assert_have_captured
|
186
|
+
#
|
187
|
+
# config.must_have_captured cmd
|
188
|
+
#
|
189
|
+
# :method: must_have_captured
|
190
|
+
|
191
|
+
infect_an_assertion :assert_have_captured, :must_have_captured
|
192
|
+
|
193
|
+
##
|
194
|
+
# See MiniTest::Assertions#refute_have_captured
|
195
|
+
#
|
196
|
+
# config.wont_have_captured cmd
|
197
|
+
#
|
198
|
+
# :method: wont_have_captured
|
199
|
+
|
200
|
+
infect_an_assertion :refute_have_captured, :wont_have_captured
|
201
|
+
|
166
202
|
##
|
167
203
|
# See MiniTest::Assertions#assert_callback_before
|
168
204
|
#
|
@@ -116,6 +116,15 @@ describe MiniTest::Assertions do
|
|
116
116
|
subject.refute_have_run_something @config
|
117
117
|
end
|
118
118
|
|
119
|
+
it "assert a command has been captured" do
|
120
|
+
@config.capture "cat /tmp/surprise.txt"
|
121
|
+
subject.assert_have_captured "cat /tmp/surprise.txt", @config
|
122
|
+
end
|
123
|
+
|
124
|
+
it "refutes a command has been captured" do
|
125
|
+
subject.refute_have_captured "cat /tmp/anything", @config
|
126
|
+
end
|
127
|
+
|
119
128
|
it "asserts a callback exists for one task before another" do
|
120
129
|
@config.before :startup, :announce_startup
|
121
130
|
|
@@ -174,6 +183,16 @@ describe MiniTest::Expectations do
|
|
174
183
|
@config.wont_have_run_anything
|
175
184
|
end
|
176
185
|
|
186
|
+
it "needs to verify a command has captured" do
|
187
|
+
@config.capture "yabba dabba"
|
188
|
+
@config.must_have_captured "yabba dabba"
|
189
|
+
end
|
190
|
+
|
191
|
+
it "needs to verify a command has not been captured" do
|
192
|
+
@config.capture "wot?"
|
193
|
+
@config.wont_have_captured "yabba dabba"
|
194
|
+
end
|
195
|
+
|
177
196
|
it "needs to verify a callback exists for a task before another" do
|
178
197
|
@config.before :stop, :warn_people
|
179
198
|
|
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.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
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: &70324415617860 !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: *70324415617860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: capistrano
|
27
|
-
requirement: &
|
27
|
+
requirement: &70324415616060 !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: *70324415616060
|
36
36
|
description: MiniTest assertions and expectations for testing Capistrano recipes
|
37
37
|
email:
|
38
38
|
- fnichol@nichol.ca
|
@@ -63,12 +63,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
63
|
- - ! '>='
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: '0'
|
66
|
+
segments:
|
67
|
+
- 0
|
68
|
+
hash: 594627113195929341
|
66
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
70
|
none: false
|
68
71
|
requirements:
|
69
72
|
- - ! '>='
|
70
73
|
- !ruby/object:Gem::Version
|
71
74
|
version: '0'
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
hash: 594627113195929341
|
72
78
|
requirements: []
|
73
79
|
rubyforge_project:
|
74
80
|
rubygems_version: 1.8.10
|