ZenTest 3.4.1 → 3.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +14 -0
- data/Manifest.txt +1 -0
- data/Rakefile +0 -5
- data/lib/autotest.rb +1 -1
- data/lib/test/rails/controller_test_case.rb +4 -2
- data/lib/test/rails/functional_test_case.rb +3 -1
- data/lib/test/rails/helper_test_case.rb +1 -0
- data/lib/test/zentest_assertions.rb +7 -2
- data/lib/unit_diff.rb +1 -1
- data/lib/zentest.rb +1 -1
- data/test/test_autotest.rb +3 -4
- data/test/test_help.rb +18 -0
- data/test/test_rails_autotest.rb +1 -0
- data/test/test_rails_controller_test_case.rb +48 -0
- data/test/test_rails_helper_test_case.rb +14 -7
- data/test/test_rails_view_test_case.rb +12 -5
- data/test/test_unit_diff.rb +2 -2
- data/test/test_zentest_assertions.rb +13 -5
- metadata +15 -5
data/History.txt
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
*** 3.4.2 / 2006-11-09
|
2
|
+
|
3
|
+
+ 2 minor enhancements:
|
4
|
+
+ Add TextHelper for pluralize.
|
5
|
+
+ Add deny_nil to Test::Rails.
|
6
|
+
+ 7 bug fixes:
|
7
|
+
+ Fixed test_help's Flash. It's is a module. Oops...
|
8
|
+
+ Don't run util_audit_assert_assigned if tests didn't pass, results will be bogus.
|
9
|
+
+ Fixed AssertionsTest names to match what autotest expects.
|
10
|
+
+ Fixed bug where deny_includes failed for Symbol keys.
|
11
|
+
+ Switched autotest to use require instead of load... Why??? I don't know!!
|
12
|
+
+ Fixed a minor but annoying whitespace difference in unit_diff.
|
13
|
+
+ Switched argument order of assert_includes and deny_includes to match Test::Unit convention.
|
14
|
+
|
1
15
|
*** 3.4.1 / 2006-10-13
|
2
16
|
|
3
17
|
+ 3 minor enhancements:
|
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -19,11 +19,6 @@ Hoe.new("ZenTest", ZenTest::VERSION) do |p|
|
|
19
19
|
p.description = description.join("\n\n")
|
20
20
|
end
|
21
21
|
|
22
|
-
desc 'Update Manifest.txt'
|
23
|
-
task :update_manifest => :clean do
|
24
|
-
sh "p4 open Manifest.txt; find . -type f | sed -e 's%./%%' | sort > Manifest.txt"
|
25
|
-
end
|
26
|
-
|
27
22
|
task :autotest do
|
28
23
|
ruby "-Ilib ./bin/autotest"
|
29
24
|
end
|
data/lib/autotest.rb
CHANGED
@@ -216,7 +216,7 @@ class Autotest
|
|
216
216
|
|
217
217
|
unless full.empty? then
|
218
218
|
classes = full.map {|k,v| k}.flatten.join(' ')
|
219
|
-
cmds << "#{ruby} -I#{@libs} -rtest/unit -e \"%w[#{classes}].each { |f|
|
219
|
+
cmds << "#{ruby} -I#{@libs} -rtest/unit -e \"%w[#{classes}].each { |f| require f }\" | unit_diff -u"
|
220
220
|
end
|
221
221
|
|
222
222
|
partial.each do |klass, methods|
|
@@ -228,7 +228,7 @@ class Test::Rails::ControllerTestCase < Test::Rails::FunctionalTestCase
|
|
228
228
|
def assert_assigned(ivar, value = NOTHING)
|
229
229
|
ivar = ivar.to_s
|
230
230
|
@assigns_asserted << ivar
|
231
|
-
assert_includes
|
231
|
+
assert_includes ivar, assigns, "#{ivar.inspect} missing from assigns"
|
232
232
|
assert_equal value, assigns[ivar] unless value.equal? NOTHING
|
233
233
|
end
|
234
234
|
|
@@ -267,7 +267,8 @@ class Test::Rails::ControllerTestCase < Test::Rails::FunctionalTestCase
|
|
267
267
|
# Asserts that the assigns variable +ivar+ is not set.
|
268
268
|
|
269
269
|
def deny_assigned(ivar)
|
270
|
-
|
270
|
+
ivar = ivar.to_s
|
271
|
+
deny_includes ivar, assigns
|
271
272
|
end
|
272
273
|
|
273
274
|
##
|
@@ -320,6 +321,7 @@ class Test::Rails::ControllerTestCase < Test::Rails::FunctionalTestCase
|
|
320
321
|
# .
|
321
322
|
|
322
323
|
def util_audit_assert_assigned
|
324
|
+
return unless @test_passed
|
323
325
|
return unless @controller.send :performed?
|
324
326
|
all_assigns = assigns.keys.sort
|
325
327
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
$TESTING_RTC = defined? $TESTING_RTC
|
2
|
+
|
1
3
|
##
|
2
4
|
# FunctionalTestCase is an abstract class that sets up a controller instance
|
3
5
|
# for its subclasses.
|
@@ -17,7 +19,7 @@ class Test::Rails::FunctionalTestCase < Test::Rails::TestCase
|
|
17
19
|
# actions.
|
18
20
|
|
19
21
|
def setup
|
20
|
-
return if self.class.name =~ /TestCase$/
|
22
|
+
return if self.class.name =~ /TestCase$/ and not $TESTING_RTC
|
21
23
|
super
|
22
24
|
|
23
25
|
@controller_class = Object.path2class @controller_class_name
|
@@ -33,6 +33,7 @@ class Test::Rails::HelperTestCase < Test::Rails::FunctionalTestCase
|
|
33
33
|
include ActionView::Helpers::UrlHelper
|
34
34
|
include ActionView::Helpers::AssetTagHelper
|
35
35
|
include ActionView::Helpers::PrototypeHelper rescue nil # Rails 1.0 only
|
36
|
+
include ActionView::Helpers::TextHelper
|
36
37
|
|
37
38
|
##
|
38
39
|
# Automatically includes the helper module into the test sublcass.
|
@@ -33,10 +33,15 @@ module Test::Unit::Assertions
|
|
33
33
|
assert_equal false, obj.empty?
|
34
34
|
end
|
35
35
|
|
36
|
+
##
|
37
|
+
# Asserts that +obj+ is not nil.
|
38
|
+
|
39
|
+
alias deny_nil assert_not_nil
|
40
|
+
|
36
41
|
##
|
37
42
|
# Asserts that +obj+ responds to #include? and that obj includes +item+.
|
38
43
|
|
39
|
-
def assert_includes(
|
44
|
+
def assert_includes(item, obj, message = nil)
|
40
45
|
assert_respond_to obj, :include?
|
41
46
|
assert_equal true, obj.include?(item), message
|
42
47
|
end
|
@@ -45,7 +50,7 @@ module Test::Unit::Assertions
|
|
45
50
|
# Asserts that +obj+ responds to #include? and that obj does not include
|
46
51
|
# +item+.
|
47
52
|
|
48
|
-
def deny_includes(
|
53
|
+
def deny_includes(item, obj, message = nil)
|
49
54
|
assert_respond_to obj, :include?
|
50
55
|
assert_equal false, obj.include?(item), message
|
51
56
|
end
|
data/lib/unit_diff.rb
CHANGED
data/lib/zentest.rb
CHANGED
data/test/test_autotest.rb
CHANGED
@@ -30,8 +30,8 @@ class TestAutotest < Test::Unit::TestCase
|
|
30
30
|
def setup
|
31
31
|
@test_class = 'TestBlah'
|
32
32
|
@test = 'test/test_blah.rb'
|
33
|
+
@other_test = 'test/test_blah_other.rb'
|
33
34
|
@impl = 'lib/blah.rb'
|
34
|
-
@rails = self.class.name =~ /Rails/
|
35
35
|
@inner_test = 'test/outer/test_inner.rb'
|
36
36
|
@outer_test = 'test/test_outer.rb'
|
37
37
|
@inner_test_class = "TestOuter::TestInner"
|
@@ -62,8 +62,7 @@ class TestAutotest < Test::Unit::TestCase
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def test_consolidate_failures_multiple_possibilities
|
65
|
-
|
66
|
-
@a.files[f] = Time.at(42)
|
65
|
+
@a.files[@other_test] = Time.at(42)
|
67
66
|
result = @a.consolidate_failures([['test_unmatched', @test_class]])
|
68
67
|
expected = { @test => ['test_unmatched']}
|
69
68
|
assert_equal expected, result
|
@@ -233,7 +232,7 @@ test_error2(#{@test_class}):
|
|
233
232
|
'test/test_fooby.rb' => [ 'test_something1', 'test_something2' ]
|
234
233
|
}
|
235
234
|
|
236
|
-
expected = [ "#{RUBY} -I.:lib:test -rtest/unit -e \"%w[#{@test}].each { |f|
|
235
|
+
expected = [ "#{RUBY} -I.:lib:test -rtest/unit -e \"%w[#{@test}].each { |f| require f }\" | unit_diff -u",
|
237
236
|
"#{RUBY} -I.:lib:test test/test_fooby.rb -n \"/^(test_something1|test_something2)$/\" | unit_diff -u" ].join("; ")
|
238
237
|
|
239
238
|
result = @a.make_test_cmd f
|
data/test/test_help.rb
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
# ActionPack
|
2
|
+
module ActionController; end
|
3
|
+
module ActionController::Flash; end
|
4
|
+
class ActionController::Flash::FlashHash; end
|
5
|
+
class ActionController::TestSession < Hash; end
|
6
|
+
|
7
|
+
class ActionController::TestRequest
|
8
|
+
attr_accessor :session
|
9
|
+
end
|
10
|
+
class ActionController::TestResponse; end
|
11
|
+
|
1
12
|
class ApplicationController; end
|
2
13
|
|
3
14
|
module ActionView; end
|
@@ -10,3 +21,10 @@ module ActionView::Helpers::FormHelper; end
|
|
10
21
|
module ActionView::Helpers::UrlHelper; end
|
11
22
|
module ActionView::Helpers::AssetTagHelper; end
|
12
23
|
|
24
|
+
# ActionMailer
|
25
|
+
|
26
|
+
module ActionMailer; end
|
27
|
+
class ActionMailer::Base
|
28
|
+
def self.deliveries=(arg); end
|
29
|
+
end
|
30
|
+
|
data/test/test_rails_autotest.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'test/zentest_assertions'
|
3
|
+
|
4
|
+
$TESTING_RTC = true
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'test/rails'
|
8
|
+
rescue LoadError, NameError
|
9
|
+
$TESTING_RTC = false
|
10
|
+
end
|
11
|
+
|
12
|
+
class TRController < ApplicationController
|
13
|
+
end if $TESTING_RTC
|
14
|
+
|
15
|
+
class TestRailsControllerTestCase < Test::Rails::ControllerTestCase
|
16
|
+
|
17
|
+
def setup
|
18
|
+
@controller_class_name = 'TRController'
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def assigns
|
23
|
+
{ 'ivar' => 'value' }
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_assert_assigned
|
27
|
+
assert_assigned :ivar
|
28
|
+
assert_assigned :ivar, 'value'
|
29
|
+
|
30
|
+
assert_raise Test::Unit::AssertionFailedError do
|
31
|
+
assert_assigned :no_ivar
|
32
|
+
end
|
33
|
+
|
34
|
+
assert_raise Test::Unit::AssertionFailedError do
|
35
|
+
assert_assigned :ivar, 'bad_value'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_deny_assigned
|
40
|
+
deny_assigned :no_ivar
|
41
|
+
|
42
|
+
assert_raise Test::Unit::AssertionFailedError do
|
43
|
+
deny_assigned :ivar
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end if $TESTING_RTC
|
48
|
+
|
@@ -1,6 +1,13 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'test/zentest_assertions'
|
3
|
-
|
3
|
+
|
4
|
+
$TESTING_RTC = true
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'test/rails'
|
8
|
+
rescue LoadError, NameError
|
9
|
+
$TESTING_RTC = false
|
10
|
+
end
|
4
11
|
|
5
12
|
begin
|
6
13
|
module TRHelper
|
@@ -8,7 +15,7 @@ begin
|
|
8
15
|
end
|
9
16
|
class TRHelperTest < Test::Rails::HelperTestCase; end
|
10
17
|
rescue RuntimeError
|
11
|
-
end
|
18
|
+
end if $TESTING_RTC
|
12
19
|
|
13
20
|
begin
|
14
21
|
module Widgets; end
|
@@ -17,23 +24,23 @@ begin
|
|
17
24
|
end
|
18
25
|
class Widgets::SomeHelperTest < Test::Rails::HelperTestCase; end
|
19
26
|
rescue RuntimeError
|
20
|
-
end
|
27
|
+
end if $TESTING_RTC
|
21
28
|
|
22
29
|
class TestRailsHelperTestCase < Test::Unit::TestCase
|
23
30
|
|
24
31
|
def test_self_inherited
|
25
32
|
assert defined? TRHelperTest
|
26
33
|
|
27
|
-
assert_includes TRHelperTest.instance_methods
|
34
|
+
assert_includes 'tr_helper', TRHelperTest.instance_methods
|
28
35
|
end
|
29
36
|
|
30
37
|
def test_self_inherited_namespaced
|
31
38
|
assert defined? Widgets
|
32
39
|
assert defined? Widgets::SomeHelperTest
|
33
40
|
|
34
|
-
assert_includes
|
35
|
-
|
41
|
+
assert_includes 'widgets_some_helper',
|
42
|
+
Widgets::SomeHelperTest.instance_methods
|
36
43
|
end
|
37
44
|
|
38
|
-
end
|
45
|
+
end if $TESTING_RTC
|
39
46
|
|
@@ -1,6 +1,13 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'test/zentest_assertions'
|
3
|
-
|
3
|
+
|
4
|
+
$TESTING_RTC = true
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'test/rails'
|
8
|
+
rescue LoadError, NameError
|
9
|
+
$TESTING_RTC = false
|
10
|
+
end
|
4
11
|
|
5
12
|
class View; end
|
6
13
|
|
@@ -16,13 +23,13 @@ class TestRailsViewTestCase < Test::Rails::ViewTestCase
|
|
16
23
|
end
|
17
24
|
|
18
25
|
def test_assert_text_area
|
19
|
-
@request.body =
|
26
|
+
@request.body = '
|
20
27
|
<form action="/post/save">
|
21
28
|
<textarea id="post_body" name="post[body]">
|
22
|
-
OMG he like hates me and he's like going out with this total skank!~ oh noes!!~
|
29
|
+
OMG he like hates me and he\'s like going out with this total skank!~ oh noes!!~
|
23
30
|
</textarea>
|
24
31
|
</form>
|
25
|
-
|
32
|
+
'
|
26
33
|
|
27
34
|
assert_text_area '/post/save', 'post[body]'
|
28
35
|
|
@@ -50,5 +57,5 @@ OMG he like hates me and he's like going out with this total skank!~ oh noes!!~
|
|
50
57
|
@assert_tag << arg
|
51
58
|
end
|
52
59
|
|
53
|
-
end
|
60
|
+
end if $TESTING_RTC
|
54
61
|
|
data/test/test_unit_diff.rb
CHANGED
@@ -130,7 +130,7 @@ class TestUnitDiff < Test::Unit::TestCase
|
|
130
130
|
def test_unit_diff2
|
131
131
|
input = "Loaded suite ./blah\nStarted\nFF\nFinished in 0.035332 seconds.\n\n 1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n<\"line1\\nline2\\nline3\\n\"> expected but was\n<\"line4\\nline5\\nline6\\n\">.\n\n 2) Failure:\ntest_test2(TestBlah) [./blah.rb:29]:\n<\"line1\"> expected but was\n<\"line2\\nline3\\n\\n\">.\n\n2 tests, 2 assertions, 2 failures, 0 errors\n"
|
132
132
|
|
133
|
-
expected = "Loaded suite ./blah\nStarted\nFF\nFinished in 0.035332 seconds.\n\n1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n1,3c1,3\n< line1\n< line2\n< line3\n---\n> line4\n> line5\n> line6\n\n2) Failure:\ntest_test2(TestBlah) [./blah.rb:29]:\n1c1,4\n< line1\n---\n> line2\n> line3\n
|
133
|
+
expected = "Loaded suite ./blah\nStarted\nFF\nFinished in 0.035332 seconds.\n\n1) Failure:\ntest_test1(TestBlah) [./blah.rb:25]:\n1,3c1,3\n< line1\n< line2\n< line3\n---\n> line4\n> line5\n> line6\n\n2) Failure:\ntest_test2(TestBlah) [./blah.rb:29]:\n1c1,4\n< line1\n---\n> line2\n> line3\n> \n> \n\n2 tests, 2 assertions, 2 failures, 0 errors"
|
134
134
|
|
135
135
|
assert_equal expected, @diff.unit_diff(input)
|
136
136
|
end
|
@@ -154,7 +154,7 @@ class TestUnitDiff < Test::Unit::TestCase
|
|
154
154
|
def test_unit_diff_NOT_suspect_equals
|
155
155
|
input = ".\nFinished in 0.0 seconds.\n\n 1) Failure:\ntest_blah(TestBlah)\n<\"out\"> expected but was\n<\"out\\n\">.\n\n1 tests, 1 assertions, 1 failures, 0 errors"
|
156
156
|
|
157
|
-
expected = ".\nFinished in 0.0 seconds.\n\n1) Failure:\ntest_blah(TestBlah)\n1a2\n
|
157
|
+
expected = ".\nFinished in 0.0 seconds.\n\n1) Failure:\ntest_blah(TestBlah)\n1a2\n> \n\n1 tests, 1 assertions, 1 failures, 0 errors"
|
158
158
|
|
159
159
|
assert_equal expected, @diff.unit_diff(input)
|
160
160
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'test/zentest_assertions'
|
3
3
|
|
4
|
-
class
|
4
|
+
class TestZenTestAssertions < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_assert_empty
|
7
7
|
assert_empty []
|
@@ -37,18 +37,26 @@ class AssertionsTest < Test::Unit::TestCase
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def test_assert_includes
|
40
|
-
assert_includes
|
40
|
+
assert_includes true, [true]
|
41
41
|
|
42
42
|
assert_raise Test::Unit::AssertionFailedError do
|
43
|
-
assert_includes [true]
|
43
|
+
assert_includes false, [true]
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
def test_deny_includes
|
48
|
-
deny_includes [true]
|
48
|
+
deny_includes false, [true]
|
49
49
|
|
50
50
|
assert_raise Test::Unit::AssertionFailedError do
|
51
|
-
deny_includes
|
51
|
+
deny_includes true, [true]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_deny_nil
|
56
|
+
deny_nil false
|
57
|
+
|
58
|
+
assert_raise Test::Unit::AssertionFailedError do
|
59
|
+
deny_nil nil
|
52
60
|
end
|
53
61
|
end
|
54
62
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ZenTest
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 3.4.
|
7
|
-
date: 2006-
|
6
|
+
version: 3.4.2
|
7
|
+
date: 2006-11-09 00:00:00 -05:00
|
8
8
|
summary: "ZenTest provides 4 different tools and 1 library: zentest, unit_diff, autotest, multiruby, and Test::Rails."
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -74,14 +74,24 @@ files:
|
|
74
74
|
- test/test_autotest.rb
|
75
75
|
- test/test_help.rb
|
76
76
|
- test/test_rails_autotest.rb
|
77
|
+
- test/test_rails_controller_test_case.rb
|
78
|
+
- test/test_rails_helper_test_case.rb
|
79
|
+
- test/test_rails_view_test_case.rb
|
80
|
+
- test/test_ruby_fork.rb
|
81
|
+
- test/test_unit_diff.rb
|
82
|
+
- test/test_zentest.rb
|
83
|
+
- test/test_zentest_assertions.rb
|
84
|
+
test_files:
|
85
|
+
- test/test_autotest.rb
|
86
|
+
- test/test_help.rb
|
87
|
+
- test/test_rails_autotest.rb
|
88
|
+
- test/test_rails_controller_test_case.rb
|
77
89
|
- test/test_rails_helper_test_case.rb
|
78
90
|
- test/test_rails_view_test_case.rb
|
79
91
|
- test/test_ruby_fork.rb
|
80
92
|
- test/test_unit_diff.rb
|
81
93
|
- test/test_zentest.rb
|
82
94
|
- test/test_zentest_assertions.rb
|
83
|
-
test_files: []
|
84
|
-
|
85
95
|
rdoc_options: []
|
86
96
|
|
87
97
|
extra_rdoc_files: []
|
@@ -106,5 +116,5 @@ dependencies:
|
|
106
116
|
requirements:
|
107
117
|
- - ">="
|
108
118
|
- !ruby/object:Gem::Version
|
109
|
-
version: 1.1.
|
119
|
+
version: 1.1.3
|
110
120
|
version:
|