ZenTest 3.4.3 → 3.5.1
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/History.txt +46 -3
- data/Manifest.txt +13 -0
- data/README.txt +1 -0
- data/Rakefile +20 -3
- data/bin/autotest +23 -37
- data/bin/multiruby +13 -7
- data/bin/unit_diff +1 -1
- data/example_dot_autotest.rb +14 -0
- data/lib/autotest.rb +77 -30
- data/lib/autotest/autoupdate.rb +26 -0
- data/lib/autotest/emacs.rb +29 -0
- data/lib/autotest/fixtures.rb +12 -0
- data/lib/autotest/growl.rb +7 -17
- data/lib/autotest/heckle.rb +14 -0
- data/lib/autotest/migrate.rb +7 -0
- data/lib/autotest/notify.rb +38 -0
- data/lib/autotest/redgreen.rb +7 -4
- data/lib/autotest/screen.rb +77 -0
- data/lib/autotest/shame.rb +45 -0
- data/lib/autotest/timestamp.rb +3 -1
- data/lib/camping_autotest.rb +37 -0
- data/lib/functional_test_matrix.rb +85 -0
- data/lib/rails_autotest.rb +49 -41
- data/lib/rspec_rails_autotest.rb +119 -0
- data/lib/test/rails.rb +28 -1
- data/lib/test/rails/controller_test_case.rb +27 -6
- data/lib/test/rails/functional_test_case.rb +3 -0
- data/lib/test/rails/helper_test_case.rb +3 -0
- data/lib/test/rails/view_test_case.rb +13 -5
- data/lib/test/zentest_assertions.rb +42 -23
- data/lib/unit_diff.rb +86 -69
- data/lib/zentest.rb +58 -87
- data/lib/zentest_mapping.rb +97 -0
- data/test/test_autotest.rb +23 -3
- data/test/test_help.rb +10 -4
- data/test/test_rails_autotest.rb +6 -4
- data/test/test_rails_controller_test_case.rb +10 -2
- data/test/test_ruby_fork.rb +12 -12
- data/test/test_unit_diff.rb +37 -33
- data/test/test_zentest.rb +15 -141
- data/test/test_zentest_assertions.rb +38 -18
- data/test/test_zentest_mapping.rb +213 -0
- metadata +18 -4
data/lib/rails_autotest.rb
CHANGED
@@ -4,49 +4,58 @@ class RailsAutotest < Autotest
|
|
4
4
|
|
5
5
|
def initialize # :nodoc:
|
6
6
|
super
|
7
|
-
@exceptions =
|
7
|
+
@exceptions = /^\.\/(?:db|doc|log|public|script|tmp|vendor\/rails)/
|
8
|
+
|
9
|
+
@test_mappings = {
|
10
|
+
%r%^test/fixtures/(.*)s.yml% => proc { |_, m|
|
11
|
+
["test/unit/#{m[1]}_test.rb",
|
12
|
+
"test/controllers/#{m[1]}_controller_test.rb",
|
13
|
+
"test/views/#{m[1]}_view_test.rb",
|
14
|
+
"test/functional/#{m[1]}_controller_test.rb"]
|
15
|
+
},
|
16
|
+
%r%^test/(unit|integration|controllers|views|functional)/.*rb$% => proc { |filename, _|
|
17
|
+
filename
|
18
|
+
},
|
19
|
+
%r%^app/models/(.*)\.rb$% => proc { |_, m|
|
20
|
+
["test/unit/#{m[1]}_test.rb"]
|
21
|
+
},
|
22
|
+
%r%^app/helpers/application_helper.rb% => proc {
|
23
|
+
files_matching %r%^test/(views|functional)/.*_test\.rb$%
|
24
|
+
},
|
25
|
+
%r%^app/helpers/(.*)_helper.rb% => proc { |_, m|
|
26
|
+
if m[1] == "application" then
|
27
|
+
files_matching %r%^test/(views|functional)/.*_test\.rb$%
|
28
|
+
else
|
29
|
+
["test/views/#{m[1]}_view_test.rb",
|
30
|
+
"test/functional/#{m[1]}_controller_test.rb"]
|
31
|
+
end
|
32
|
+
},
|
33
|
+
%r%^app/views/(.*)/% => proc { |_, m|
|
34
|
+
["test/views/#{m[1]}_view_test.rb",
|
35
|
+
"test/functional/#{m[1]}_controller_test.rb"]
|
36
|
+
},
|
37
|
+
%r%^app/controllers/(.*)\.rb$% => proc { |_, m|
|
38
|
+
if m[1] == "application" then
|
39
|
+
files_matching %r%^test/(controllers|views|functional)/.*_test\.rb$%
|
40
|
+
else
|
41
|
+
["test/controllers/#{m[1]}_test.rb",
|
42
|
+
"test/functional/#{m[1]}_test.rb"]
|
43
|
+
end
|
44
|
+
},
|
45
|
+
%r%^app/views/layouts/% => proc {
|
46
|
+
"test/views/layouts_view_test.rb"
|
47
|
+
},
|
48
|
+
%r%^config/routes.rb$% => proc { # FIX:
|
49
|
+
files_matching %r%^test/(controllers|views|functional)/.*_test\.rb$%
|
50
|
+
},
|
51
|
+
%r%^test/test_helper.rb|config/((boot|environment(s/test)?).rb|database.yml)% => proc {
|
52
|
+
files_matching %r%^test/(unit|controllers|views|functional)/.*_test\.rb$%
|
53
|
+
},
|
54
|
+
}
|
8
55
|
end
|
9
56
|
|
10
57
|
def tests_for_file(filename)
|
11
|
-
|
12
|
-
case filename
|
13
|
-
when %r%^test/fixtures/(.*)s.yml% then
|
14
|
-
["test/unit/#{$1}_test.rb",
|
15
|
-
"test/controllers/#{$1}_controller_test.rb",
|
16
|
-
"test/views/#{$1}_view_test.rb",
|
17
|
-
"test/functional/#{$1}_controller_test.rb"]
|
18
|
-
when %r%^test/(unit|integration|controllers|views|functional)/.*rb$% then
|
19
|
-
[filename]
|
20
|
-
when %r%^app/models/(.*)\.rb$% then
|
21
|
-
["test/unit/#{$1}_test.rb"]
|
22
|
-
when %r%^app/helpers/application_helper.rb% then
|
23
|
-
@files.keys.select { |f|
|
24
|
-
f =~ %r%^test/(views|functional)/.*_test\.rb$%
|
25
|
-
}
|
26
|
-
when %r%^app/helpers/(.*)_helper.rb%, %r%^app/views/(.*)/% then
|
27
|
-
["test/views/#{$1}_view_test.rb",
|
28
|
-
"test/functional/#{$1}_controller_test.rb"]
|
29
|
-
when %r%^app/controllers/application.rb$% then # FIX: wtf?
|
30
|
-
["test/controllers/dummy_controller_test.rb",
|
31
|
-
"test/functional/dummy_controller_test.rb"]
|
32
|
-
when %r%^app/controllers/(.*)\.rb$% then
|
33
|
-
["test/controllers/#{$1}_test.rb",
|
34
|
-
"test/functional/#{$1}_test.rb"]
|
35
|
-
when %r%^app/views/layouts/% then
|
36
|
-
["test/views/layouts_view_test.rb"]
|
37
|
-
when %r%^config/routes.rb$% then
|
38
|
-
@files.keys.select do |f|
|
39
|
-
f =~ %r%^test/(controllers|views|functional)/.*_test\.rb$%
|
40
|
-
end
|
41
|
-
when %r%^test/test_helper.rb%,
|
42
|
-
%r%^config/((boot|environment(s/test)?).rb|database.yml)% then
|
43
|
-
@files.keys.select do |f|
|
44
|
-
f =~ %r%^test/(unit|controllers|views|functional)/.*_test\.rb$%
|
45
|
-
end
|
46
|
-
else
|
47
|
-
@output.puts "Dunno! #{filename}" if $TESTING
|
48
|
-
[]
|
49
|
-
end.uniq.select { |f| @files.has_key? f }
|
58
|
+
super.select { |f| @files.has_key? f }
|
50
59
|
end
|
51
60
|
|
52
61
|
def path_to_classname(s)
|
@@ -57,4 +66,3 @@ class RailsAutotest < Autotest
|
|
57
66
|
f.join('::')
|
58
67
|
end
|
59
68
|
end
|
60
|
-
|
@@ -0,0 +1,119 @@
|
|
1
|
+
# (c) Copyright 2006 Nick Sieger <nicksieger@gmail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person
|
4
|
+
# obtaining a copy of this software and associated documentation files
|
5
|
+
# (the "Software"), to deal in the Software without restriction,
|
6
|
+
# including without limitation the rights to use, copy, modify, merge,
|
7
|
+
# publish, distribute, sublicense, and/or sell copies of the Software,
|
8
|
+
# and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
18
|
+
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
19
|
+
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'autotest'
|
24
|
+
|
25
|
+
class RspecRailsAutotest < Autotest
|
26
|
+
attr_accessor :spec_command
|
27
|
+
|
28
|
+
def initialize # :nodoc:
|
29
|
+
@spec_command = "spec --diff unified"
|
30
|
+
super
|
31
|
+
@exceptions = %r%^\./(?:coverage|db|doc|log|public|script|vendor)%
|
32
|
+
end
|
33
|
+
|
34
|
+
def tests_for_file(filename)
|
35
|
+
case filename
|
36
|
+
when %r%^spec/fixtures/(.*)s.yml% then
|
37
|
+
["spec/models/#{$1}_spec.rb",
|
38
|
+
"spec/controllers/#{$1}_controller_spec.rb"]
|
39
|
+
when %r%^spec/models/.*rb$% then
|
40
|
+
[filename]
|
41
|
+
when %r%^spec/controllers/.*\.rb$% then
|
42
|
+
[filename]
|
43
|
+
# when %r%^spec/acceptance/.*\.rb$% then
|
44
|
+
# [filename]
|
45
|
+
when %r%^app/models/(.*)\.rb$% then
|
46
|
+
["spec/models/#{$1}_spec.rb"]
|
47
|
+
when %r%^app/helpers/application_helper.rb% then
|
48
|
+
@files.keys.select { |f|
|
49
|
+
f =~ %r%^spec/controllers/.*_spec\.rb$%
|
50
|
+
}
|
51
|
+
when %r%^app/helpers/(.*)_helper.rb% then
|
52
|
+
["spec/controllers/#{$1}_controller_spec.rb"]
|
53
|
+
when %r%^app/controllers/application.rb$% then
|
54
|
+
@files.keys.select { |f|
|
55
|
+
f =~ %r%^spec/controllers/.*_spec\.rb$%
|
56
|
+
}
|
57
|
+
when %r%^app/controllers/(.*)\.rb$% then
|
58
|
+
["spec/controllers/#{$1}_spec.rb"]
|
59
|
+
when %r%^app/views/layouts/% then
|
60
|
+
[]
|
61
|
+
when %r%^app/views/(.*)/% then
|
62
|
+
["spec/controllers/#{$1}_controller_spec.rb"]
|
63
|
+
when %r%^config/routes.rb$% then
|
64
|
+
@files.keys.select do |f|
|
65
|
+
f =~ %r%^spec/controllers/.*_spec\.rb$%
|
66
|
+
end
|
67
|
+
when %r%^spec/spec_helper.rb%,
|
68
|
+
%r%^config/((boot|environment(s/test)?).rb|database.yml)% then
|
69
|
+
@files.keys.select do |f|
|
70
|
+
f =~ %r%^spec/(models|controllers)/.*_spec\.rb$%
|
71
|
+
end
|
72
|
+
else
|
73
|
+
@output.puts "Dunno! #{filename}" if $TESTING
|
74
|
+
[]
|
75
|
+
end.uniq.select { |f| @files.has_key? f }
|
76
|
+
end
|
77
|
+
|
78
|
+
def handle_results(results)
|
79
|
+
failed = results.scan(/^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m)
|
80
|
+
@files_to_test = consolidate_failures failed
|
81
|
+
unless @files_to_test.empty? then
|
82
|
+
hook :red
|
83
|
+
else
|
84
|
+
hook :green
|
85
|
+
end unless $TESTING
|
86
|
+
@tainted = true unless @files_to_test.empty?
|
87
|
+
end
|
88
|
+
|
89
|
+
def consolidate_failures(failed)
|
90
|
+
filters = Hash.new { |h,k| h[k] = [] }
|
91
|
+
failed.each do |spec, failed_trace|
|
92
|
+
@files.keys.select{|f| f =~ /spec\//}.each do |f|
|
93
|
+
if failed_trace =~ Regexp.new(f)
|
94
|
+
filters[f] << spec
|
95
|
+
break
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
return filters
|
100
|
+
end
|
101
|
+
|
102
|
+
def make_test_cmd(files_to_test)
|
103
|
+
cmds = []
|
104
|
+
full, partial = files_to_test.partition { |k,v| v.empty? }
|
105
|
+
|
106
|
+
unless full.empty? then
|
107
|
+
classes = full.map {|k,v| k}.flatten.join(' ')
|
108
|
+
cmds << "#{spec_command} #{classes}"
|
109
|
+
end
|
110
|
+
|
111
|
+
partial.each do |klass, methods|
|
112
|
+
cmds.push(*methods.map { |meth|
|
113
|
+
"#{spec_command} -s #{meth.inspect} #{klass}"
|
114
|
+
})
|
115
|
+
end
|
116
|
+
|
117
|
+
return cmds.join('; ')
|
118
|
+
end
|
119
|
+
end
|
data/lib/test/rails.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'test/unit'
|
2
|
+
require 'rubygems/version'
|
2
3
|
require 'test_help' # hopefully temporary, required for Test::Rails to work
|
3
4
|
# until we get rid of test_help so Test::Unit::TestCase
|
4
5
|
# is kept virgin.
|
6
|
+
require 'rails/version' unless defined? Rails::VERSION
|
5
7
|
|
6
8
|
$TESTING = true
|
7
9
|
|
@@ -249,7 +251,24 @@ $TESTING = true
|
|
249
251
|
#
|
250
252
|
# The stats target is updated to account for controller and view tests.
|
251
253
|
|
252
|
-
module Test::Rails
|
254
|
+
module Test::Rails
|
255
|
+
|
256
|
+
@rails_version = Gem::Version.new Rails::VERSION::STRING
|
257
|
+
@v1_2 = Gem::Version.new '1.2'
|
258
|
+
|
259
|
+
##
|
260
|
+
# The currently loaded rails version. Better than Rails::VERSION::STRING
|
261
|
+
# since this one is comparable.
|
262
|
+
|
263
|
+
def self.rails_version
|
264
|
+
@rails_version
|
265
|
+
end
|
266
|
+
|
267
|
+
def self.v1_2 # :nodoc:
|
268
|
+
@v1_2
|
269
|
+
end
|
270
|
+
|
271
|
+
end
|
253
272
|
|
254
273
|
class Object # :nodoc:
|
255
274
|
def self.path2class(klassname)
|
@@ -265,3 +284,11 @@ require 'test/rails/helper_test_case'
|
|
265
284
|
require 'test/rails/ivar_proxy'
|
266
285
|
require 'test/rails/view_test_case'
|
267
286
|
|
287
|
+
##
|
288
|
+
# Use sensible defaults.
|
289
|
+
|
290
|
+
class Test::Unit::TestCase # :nodoc:
|
291
|
+
self.use_transactional_fixtures = true
|
292
|
+
self.use_instantiated_fixtures = false
|
293
|
+
end
|
294
|
+
|
@@ -112,13 +112,31 @@
|
|
112
112
|
|
113
113
|
class Test::Rails::ControllerTestCase < Test::Rails::FunctionalTestCase
|
114
114
|
|
115
|
+
self.use_transactional_fixtures = true
|
116
|
+
self.use_instantiated_fixtures = false
|
117
|
+
|
115
118
|
NOTHING = Object.new # :nodoc:
|
116
119
|
|
117
120
|
DEFAULT_ASSIGNS = %w[
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
121
|
+
_cookies _flash _headers _params _request _response _session
|
122
|
+
|
123
|
+
cookies flash headers params request response session
|
124
|
+
|
125
|
+
action_name
|
126
|
+
before_filter_chain_aborted
|
127
|
+
db_rt_after_render
|
128
|
+
db_rt_before_render
|
129
|
+
ignore_missing_templates
|
130
|
+
loggedin_user
|
131
|
+
logger
|
132
|
+
rendering_runtime
|
133
|
+
request_origin
|
134
|
+
template
|
135
|
+
template_class
|
136
|
+
template_root
|
137
|
+
url
|
138
|
+
user
|
139
|
+
variables_added
|
122
140
|
]
|
123
141
|
|
124
142
|
def setup
|
@@ -229,7 +247,10 @@ class Test::Rails::ControllerTestCase < Test::Rails::FunctionalTestCase
|
|
229
247
|
ivar = ivar.to_s
|
230
248
|
@assigns_asserted << ivar
|
231
249
|
assert_includes ivar, assigns, "#{ivar.inspect} missing from assigns"
|
232
|
-
|
250
|
+
unless value.equal? NOTHING then
|
251
|
+
assert_equal value, assigns[ivar],
|
252
|
+
"assert_assigned #{ivar.intern.inspect}"
|
253
|
+
end
|
233
254
|
end
|
234
255
|
|
235
256
|
##
|
@@ -338,7 +359,7 @@ class Test::Rails::ControllerTestCase < Test::Rails::FunctionalTestCase
|
|
338
359
|
message = []
|
339
360
|
message << "You are missing these assert_assigned assertions:"
|
340
361
|
assigns_missing.sort.each do |ivar|
|
341
|
-
message << " assert_assigned #{ivar.intern.inspect} #, some_value"
|
362
|
+
message << " assert_assigned #{ivar.intern.inspect} #, :some_value"
|
342
363
|
end
|
343
364
|
message << nil # stupid '.'
|
344
365
|
|
@@ -6,6 +6,9 @@ $TESTING_RTC = defined? $TESTING_RTC
|
|
6
6
|
|
7
7
|
class Test::Rails::FunctionalTestCase < Test::Rails::TestCase
|
8
8
|
|
9
|
+
self.use_transactional_fixtures = true
|
10
|
+
self.use_instantiated_fixtures = false
|
11
|
+
|
9
12
|
##
|
10
13
|
# Sets up instance variables to allow tests depending on a controller work.
|
11
14
|
#
|
@@ -86,6 +86,9 @@
|
|
86
86
|
|
87
87
|
class Test::Rails::ViewTestCase < Test::Rails::FunctionalTestCase
|
88
88
|
|
89
|
+
self.use_transactional_fixtures = true
|
90
|
+
self.use_instantiated_fixtures = false
|
91
|
+
|
89
92
|
##
|
90
93
|
# Sets up the test case.
|
91
94
|
|
@@ -102,7 +105,6 @@ class Test::Rails::ViewTestCase < Test::Rails::FunctionalTestCase
|
|
102
105
|
# these go here so that flash and session work as they should.
|
103
106
|
@controller.send :initialize_template_class, @response
|
104
107
|
@controller.send :assign_shortcuts, @request, @response
|
105
|
-
@controller.send :reset_session
|
106
108
|
|
107
109
|
assigns[:session] = @controller.session
|
108
110
|
@controller.class.send :public, :flash # make flash accessible to the test
|
@@ -172,8 +174,14 @@ class Test::Rails::ViewTestCase < Test::Rails::FunctionalTestCase
|
|
172
174
|
defaults = { :layout => false }
|
173
175
|
options = defaults.merge options
|
174
176
|
|
175
|
-
|
177
|
+
if Test::Rails.rails_version >= Test::Rails.v1_2 then
|
178
|
+
@controller.send :params=, @request.parameters
|
179
|
+
else
|
180
|
+
@controller.instance_variable_set :@params, @request.parameters
|
181
|
+
end
|
176
182
|
@controller.send :initialize_current_url
|
183
|
+
current_url = URI.parse @controller.url_for
|
184
|
+
@request.request_uri = current_url.request_uri
|
177
185
|
|
178
186
|
# Rails 1.0
|
179
187
|
@controller.send :assign_names rescue nil
|
@@ -467,9 +475,9 @@ class Test::Rails::ViewTestCase < Test::Rails::FunctionalTestCase
|
|
467
475
|
def action_name(test)
|
468
476
|
orig_name = test = test.sub(/.*in `test_(.*)'/, '\1')
|
469
477
|
controller = @controller.class.name.sub('Controller', '').underscore
|
470
|
-
|
471
|
-
extensions = %w
|
472
|
-
|
478
|
+
|
479
|
+
extensions = %w[rhtml rxml rjs mab]
|
480
|
+
|
473
481
|
while test =~ /_/ do
|
474
482
|
return test if extensions.any? { |ext| File.file? "app/views/#{controller}/#{test}.#{ext}" }
|
475
483
|
|
@@ -4,25 +4,44 @@
|
|
4
4
|
module Test::Unit::Assertions
|
5
5
|
|
6
6
|
##
|
7
|
-
# Asserts that +
|
7
|
+
# Asserts that +obj+ responds to #empty? and #empty? returns true.
|
8
8
|
|
9
|
-
def
|
10
|
-
|
11
|
-
|
12
|
-
end
|
9
|
+
def assert_empty(obj)
|
10
|
+
assert_respond_to obj, :empty?
|
11
|
+
assert_block "#{obj.inspect} expected to be empty." do obj.empty? end
|
13
12
|
end
|
14
13
|
|
15
14
|
##
|
16
|
-
#
|
15
|
+
# Like assert_in_delta but better dealing with errors proportional
|
16
|
+
# to the sizes of +a+ and +b+.
|
17
17
|
|
18
|
-
|
18
|
+
def assert_in_epsilon(a, b, epsilon, message = nil)
|
19
|
+
return assert(true) if a == b # count assertion
|
20
|
+
|
21
|
+
error = ((a - b).to_f / ((b.abs > a.abs) ? b : a)).abs
|
22
|
+
message ||= "#{a} expected to be within #{epsilon * 100}% of #{b}, was #{error}"
|
23
|
+
|
24
|
+
assert_block message do error <= epsilon end
|
25
|
+
end
|
19
26
|
|
20
27
|
##
|
21
|
-
# Asserts that +obj+ responds to #
|
28
|
+
# Asserts that +obj+ responds to #include? and that obj includes +item+.
|
22
29
|
|
23
|
-
def
|
24
|
-
assert_respond_to obj, :
|
25
|
-
|
30
|
+
def assert_include(item, obj, message = nil)
|
31
|
+
assert_respond_to obj, :include?
|
32
|
+
message ||= "#{obj.inspect}\ndoes not include\n#{item.inspect}."
|
33
|
+
assert_block message do obj.include? item end
|
34
|
+
end
|
35
|
+
|
36
|
+
alias assert_includes assert_include
|
37
|
+
|
38
|
+
##
|
39
|
+
# Asserts that +boolean+ is not false or nil.
|
40
|
+
|
41
|
+
def deny(boolean, message = nil)
|
42
|
+
_wrap_assertion do
|
43
|
+
assert_block(build_message(message, "<?> is not false or nil.", boolean)) { not boolean }
|
44
|
+
end
|
26
45
|
end
|
27
46
|
|
28
47
|
##
|
@@ -30,30 +49,30 @@ module Test::Unit::Assertions
|
|
30
49
|
|
31
50
|
def deny_empty(obj)
|
32
51
|
assert_respond_to obj, :empty?
|
33
|
-
|
52
|
+
assert_block "#{obj.inspect} expected to have stuff." do !obj.empty? end
|
34
53
|
end
|
35
54
|
|
36
55
|
##
|
37
|
-
#
|
56
|
+
# Alias for assert_not_equal
|
38
57
|
|
39
|
-
alias
|
58
|
+
alias deny_equal assert_not_equal
|
40
59
|
|
41
60
|
##
|
42
|
-
# Asserts that +obj+ responds to #include? and that obj
|
61
|
+
# Asserts that +obj+ responds to #include? and that obj does not include
|
62
|
+
# +item+.
|
43
63
|
|
44
|
-
def
|
64
|
+
def deny_include(item, obj, message = nil)
|
45
65
|
assert_respond_to obj, :include?
|
46
|
-
|
66
|
+
message ||= "#{obj.inspect} includes #{item.inspect}."
|
67
|
+
assert_block message do !obj.include? item end
|
47
68
|
end
|
48
69
|
|
70
|
+
alias deny_includes deny_include
|
71
|
+
|
49
72
|
##
|
50
|
-
# Asserts that +obj+
|
51
|
-
# +item+.
|
73
|
+
# Asserts that +obj+ is not nil.
|
52
74
|
|
53
|
-
|
54
|
-
assert_respond_to obj, :include?
|
55
|
-
assert_equal false, obj.include?(item), message
|
56
|
-
end
|
75
|
+
alias deny_nil assert_not_nil
|
57
76
|
|
58
77
|
##
|
59
78
|
# Captures $stdout and $stderr to StringIO objects and returns them.
|