activeldap 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +34 -0
- data/README +13 -0
- data/Rakefile +2 -1
- data/TODO +6 -0
- data/benchmark/bench-al.rb +68 -17
- data/examples/al-admin/app/helpers/application_helper.rb +3 -5
- data/examples/al-admin/app/views/layouts/_footer.html.erb +2 -0
- data/examples/al-admin/config/boot.rb +7 -7
- data/examples/al-admin/config/environment.rb +27 -12
- data/examples/al-admin/config/environments/development.rb +0 -1
- data/examples/al-admin/config/environments/production.rb +6 -1
- data/examples/al-admin/config/environments/test.rb +1 -1
- data/examples/al-admin/config/initializers/gettext.rb +15 -1
- data/examples/al-admin/po/en/al-admin.po +1 -1
- data/examples/al-admin/po/ja/al-admin.po +1 -1
- data/examples/al-admin/po/nl/al-admin.po +1 -1
- data/examples/al-admin/public/dispatch.cgi +0 -0
- data/examples/al-admin/public/dispatch.fcgi +0 -0
- data/examples/al-admin/public/dispatch.rb +0 -0
- data/examples/al-admin/public/javascripts/controls.js +73 -73
- data/examples/al-admin/public/javascripts/dragdrop.js +166 -165
- data/examples/al-admin/public/javascripts/effects.js +174 -166
- data/examples/al-admin/public/javascripts/prototype.js +362 -267
- data/examples/al-admin/script/about +0 -0
- data/examples/al-admin/script/console +0 -0
- data/examples/al-admin/script/dbconsole +3 -0
- data/examples/al-admin/script/destroy +0 -0
- data/examples/al-admin/script/generate +0 -0
- data/examples/al-admin/script/performance/benchmarker +0 -0
- data/examples/al-admin/script/performance/profiler +0 -0
- data/examples/al-admin/script/performance/request +0 -0
- data/examples/al-admin/script/plugin +0 -0
- data/examples/al-admin/script/process/inspector +0 -0
- data/examples/al-admin/script/process/reaper +0 -0
- data/examples/al-admin/script/process/spawner +0 -0
- data/examples/al-admin/script/runner +0 -0
- data/examples/al-admin/script/server +0 -0
- data/examples/al-admin/test/run-test.sh +0 -0
- data/examples/groupadd +0 -0
- data/examples/groupdel +0 -0
- data/examples/groupls +0 -0
- data/examples/groupmod +0 -0
- data/examples/lpasswd +0 -0
- data/examples/ouadd +0 -0
- data/examples/useradd +0 -0
- data/examples/useradd-binary +0 -0
- data/examples/userdel +0 -0
- data/examples/userls +0 -0
- data/examples/usermod +0 -0
- data/examples/usermod-binary-add +0 -0
- data/examples/usermod-binary-add-time +0 -0
- data/examples/usermod-binary-del +0 -0
- data/examples/usermod-lang-add +0 -0
- data/lib/active_ldap.rb +10 -4
- data/lib/active_ldap/action_controller/ldap_benchmarking.rb +28 -9
- data/lib/active_ldap/adapter/base.rb +30 -17
- data/lib/active_ldap/adapter/jndi.rb +5 -1
- data/lib/active_ldap/adapter/ldap.rb +5 -1
- data/lib/active_ldap/association/has_many_utils.rb +7 -1
- data/lib/active_ldap/associations.rb +10 -5
- data/lib/active_ldap/attributes.rb +6 -1
- data/lib/active_ldap/base.rb +154 -52
- data/lib/active_ldap/configuration.rb +1 -1
- data/lib/active_ldap/connection.rb +7 -4
- data/lib/active_ldap/get_text.rb +11 -3
- data/lib/active_ldap/ldif.rb +16 -4
- data/lib/active_ldap/operations.rb +13 -5
- data/lib/active_ldap/schema.rb +6 -2
- data/lib/active_ldap/schema/syntaxes.rb +15 -3
- data/lib/active_ldap/user_password.rb +4 -4
- data/lib/active_ldap/validations.rb +32 -44
- data/lib/active_ldap/xml.rb +125 -0
- data/po/en/active-ldap.po +740 -85
- data/po/ja/active-ldap.po +748 -547
- data/rails/README +54 -0
- data/rails/init.rb +33 -0
- data/rails/plugin/active_ldap/generators/README +2 -0
- data/rails/plugin/active_ldap/generators/model_active_ldap/model_active_ldap_generator.rb +1 -1
- data/rails/plugin/active_ldap/init.rb +3 -0
- data/rails_generators/model_active_ldap/USAGE +17 -0
- data/rails_generators/model_active_ldap/model_active_ldap_generator.rb +69 -0
- data/rails_generators/model_active_ldap/templates/model_active_ldap.rb +3 -0
- data/rails_generators/model_active_ldap/templates/unit_test.rb +8 -0
- data/rails_generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb +7 -0
- data/rails_generators/scaffold_active_ldap/templates/ldap.yml +18 -0
- data/rails_generators/scaffold_al/scaffold_al_generator.rb +20 -0
- data/test-unit/History.txt +50 -1
- data/test-unit/Manifest.txt +22 -12
- data/test-unit/README.txt +31 -12
- data/test-unit/Rakefile +14 -1
- data/test-unit/TODO +5 -0
- data/test-unit/bin/testrb +0 -0
- data/test-unit/lib/test/unit.rb +62 -0
- data/test-unit/lib/test/unit/assertions.rb +419 -75
- data/test-unit/lib/test/unit/autorunner.rb +70 -13
- data/test-unit/lib/test/unit/collector.rb +1 -1
- data/test-unit/lib/test/unit/collector/load.rb +1 -1
- data/test-unit/lib/test/unit/color-scheme.rb +86 -0
- data/test-unit/lib/test/unit/color.rb +40 -5
- data/test-unit/lib/test/unit/diff.rb +14 -0
- data/test-unit/lib/test/unit/fixture.rb +7 -16
- data/test-unit/lib/test/unit/notification.rb +9 -0
- data/test-unit/lib/test/unit/omission.rb +14 -0
- data/test-unit/lib/test/unit/pending.rb +16 -0
- data/test-unit/lib/test/unit/priority.rb +17 -2
- data/test-unit/lib/test/unit/runner/console.rb +8 -2
- data/test-unit/lib/test/unit/testcase.rb +188 -2
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +51 -26
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +28 -0
- data/test-unit/lib/test/unit/version.rb +1 -1
- data/test-unit/sample/test_user.rb +22 -0
- data/test-unit/test/collector/{test_descendant.rb → test-descendant.rb} +0 -0
- data/test-unit/test/collector/{test_load.rb → test-load.rb} +1 -1
- data/test-unit/test/run-test.rb +0 -0
- data/test-unit/test/{test_attribute.rb → test-attribute.rb} +0 -0
- data/test-unit/test/test-color-scheme.rb +56 -0
- data/test-unit/test/{test_color.rb → test-color.rb} +10 -0
- data/test-unit/test/{test_diff.rb → test-diff.rb} +0 -0
- data/test-unit/test/{test_emacs_runner.rb → test-emacs-runner.rb} +0 -0
- data/test-unit/test/test-fixture.rb +287 -0
- data/test-unit/test/{test_notification.rb → test-notification.rb} +4 -4
- data/test-unit/test/{test_omission.rb → test-omission.rb} +6 -6
- data/test-unit/test/{test_pending.rb → test-pending.rb} +12 -6
- data/test-unit/test/{test_priority.rb → test-priority.rb} +30 -0
- data/test-unit/test/test_assertions.rb +411 -69
- data/test-unit/test/test_testcase.rb +70 -3
- data/test-unit/test/{testunit_test_util.rb → testunit-test-util.rb} +4 -2
- data/test-unit/test/ui/test_testrunmediator.rb +1 -1
- data/test-unit/test/util/test-method-owner-finder.rb +38 -0
- data/test/run-test.rb +0 -0
- data/test/test_adapter.rb +3 -0
- data/test/test_associations.rb +50 -7
- data/test/test_base.rb +193 -11
- data/test/test_connection_per_dn.rb +1 -1
- data/test/test_ldif.rb +86 -0
- data/test/test_load.rb +7 -0
- data/test/test_schema.rb +31 -1
- data/test/test_syntax.rb +20 -0
- data/test/test_user_password.rb +22 -14
- data/test/test_validation.rb +70 -29
- metadata +99 -77
- data/data/locale/en/LC_MESSAGES/active-ldap.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/active-ldap.mo +0 -0
- data/examples/al-admin/config/initializers/ralative_url_support.rb +0 -1
- data/examples/al-admin/lib/accept_http_rails_relative_url_root.rb +0 -9
- data/test-unit-ext/misc/rd2html.rb +0 -42
- data/test-unit/test/test_fixture.rb +0 -275
@@ -0,0 +1,28 @@
|
|
1
|
+
module Test
|
2
|
+
module Unit
|
3
|
+
module Util
|
4
|
+
module MethodOwnerFinder
|
5
|
+
module_function
|
6
|
+
def find(object, method_name)
|
7
|
+
method = object.method(method_name)
|
8
|
+
return method.owner if method.respond_to?(:owner)
|
9
|
+
|
10
|
+
if /\((.+?)\)\#/ =~ method.to_s
|
11
|
+
owner_name = $1
|
12
|
+
if /\A#</ =~ owner_name
|
13
|
+
ObjectSpace.each_object(Module) do |mod|
|
14
|
+
return mod if mod.to_s == owner_name
|
15
|
+
end
|
16
|
+
else
|
17
|
+
owner_name.split(/::/).inject(Object) do |parent, name|
|
18
|
+
parent.const_get(name)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
else
|
22
|
+
object.class
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# nested test case example.
|
2
|
+
|
3
|
+
class UserTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@user = "me"
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_full_name
|
9
|
+
assert_equal("me", @user)
|
10
|
+
end
|
11
|
+
|
12
|
+
class ProfileTest < UserTest
|
13
|
+
setup
|
14
|
+
def setup_profile
|
15
|
+
@user += ": profile"
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_has_profile
|
19
|
+
assert_match(/: profile/, @user)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
File without changes
|
data/test-unit/test/run-test.rb
CHANGED
File without changes
|
File without changes
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class TestUnitColorScheme < Test::Unit::TestCase
|
2
|
+
def test_default
|
3
|
+
assert_equal({
|
4
|
+
"success" => color("green", :bold => true),
|
5
|
+
"failure" => color("red", :bold => true),
|
6
|
+
"pending" => color("magenta", :bold => true),
|
7
|
+
"omission" => color("blue", :bold => true),
|
8
|
+
"notification" => color("cyan", :bold => true),
|
9
|
+
"error" => color("yellow", :bold => true) +
|
10
|
+
color("black", :foreground => false),
|
11
|
+
},
|
12
|
+
Test::Unit::ColorScheme.default.to_hash)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_register
|
16
|
+
inverted_scheme_spec = {
|
17
|
+
"success" => {:name => "red"},
|
18
|
+
"failure" => {:name => "green"},
|
19
|
+
}
|
20
|
+
Test::Unit::ColorScheme["inverted"] = inverted_scheme_spec
|
21
|
+
assert_equal({
|
22
|
+
"success" => color("red"),
|
23
|
+
"failure" => color("green"),
|
24
|
+
},
|
25
|
+
Test::Unit::ColorScheme["inverted"].to_hash)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_new_with_colors
|
29
|
+
scheme = Test::Unit::ColorScheme.new(:success => color("blue"),
|
30
|
+
"failure" => color("green",
|
31
|
+
:underline => true))
|
32
|
+
assert_equal({
|
33
|
+
"success" => color("blue"),
|
34
|
+
"failure" => color("green", :underline => true),
|
35
|
+
},
|
36
|
+
scheme.to_hash)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_new_with_spec
|
40
|
+
scheme = Test::Unit::ColorScheme.new(:success => {
|
41
|
+
:name => "blue",
|
42
|
+
:bold => true
|
43
|
+
},
|
44
|
+
"failure" => {:name => "green"})
|
45
|
+
assert_equal({
|
46
|
+
"success" => color("blue", :bold => true),
|
47
|
+
"failure" => color("green"),
|
48
|
+
},
|
49
|
+
scheme.to_hash)
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
def color(name, options={})
|
54
|
+
Test::Unit::Color.new(name, options)
|
55
|
+
end
|
56
|
+
end
|
@@ -20,6 +20,16 @@ class TestUnitColor < Test::Unit::TestCase
|
|
20
20
|
color("none", :underline => true))
|
21
21
|
end
|
22
22
|
|
23
|
+
def test_equal
|
24
|
+
red = color("red")
|
25
|
+
red_bold = color("red", :bold => true)
|
26
|
+
|
27
|
+
assert_operator(red, :==, red)
|
28
|
+
assert_not_equal(red, nil)
|
29
|
+
assert_equal(red, color("red"))
|
30
|
+
assert_not_equal(red, red_bold)
|
31
|
+
end
|
32
|
+
|
23
33
|
private
|
24
34
|
def color(name, options={})
|
25
35
|
Test::Unit::Color.new(name, options)
|
File without changes
|
File without changes
|
@@ -0,0 +1,287 @@
|
|
1
|
+
class TestUnitFixture < Test::Unit::TestCase
|
2
|
+
module EmptyModule
|
3
|
+
end
|
4
|
+
|
5
|
+
def test_setup_without_option
|
6
|
+
expected_setup_calls = [:setup,
|
7
|
+
:custom_setup_method0,
|
8
|
+
:custom_setup_method1,
|
9
|
+
:custom_setup_method3]
|
10
|
+
test_case = assert_setup(expected_setup_calls, [])
|
11
|
+
assert_inherited_setup(expected_setup_calls, test_case)
|
12
|
+
|
13
|
+
assert_inherited_setup([:setup], nil)
|
14
|
+
assert_called_fixtures(expected_setup_calls, test_case)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_setup_with_before_option
|
18
|
+
expected_setup_calls = [:custom_setup_method3,
|
19
|
+
:custom_setup_method0,
|
20
|
+
:custom_setup_method1,
|
21
|
+
:setup]
|
22
|
+
test_case = assert_setup(expected_setup_calls,
|
23
|
+
[[{:before => :append}],
|
24
|
+
[{:before => :append}],
|
25
|
+
[{:before => :prepend}],
|
26
|
+
[{:before => :prepend}]])
|
27
|
+
assert_inherited_setup(expected_setup_calls, test_case)
|
28
|
+
|
29
|
+
assert_inherited_setup([:setup], nil)
|
30
|
+
assert_called_fixtures(expected_setup_calls, test_case)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_setup_with_after_option
|
34
|
+
expected_setup_calls = [:setup,
|
35
|
+
:custom_setup_method3,
|
36
|
+
:custom_setup_method0,
|
37
|
+
:custom_setup_method1]
|
38
|
+
test_case = assert_setup(expected_setup_calls,
|
39
|
+
[[{:after => :append}],
|
40
|
+
[{:after => :append}],
|
41
|
+
[{:after => :prepend}],
|
42
|
+
[{:after => :prepend}]])
|
43
|
+
assert_inherited_setup(expected_setup_calls, test_case)
|
44
|
+
|
45
|
+
assert_inherited_setup([:setup], nil)
|
46
|
+
assert_called_fixtures(expected_setup_calls, test_case)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_setup_with_invalid_option
|
50
|
+
assert_invalid_setup_option(:unknown => true)
|
51
|
+
assert_invalid_setup_option(:before => :unknown)
|
52
|
+
assert_invalid_setup_option(:after => :unknown)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_setup_with_option_to_inherited
|
56
|
+
expected_setup_calls = [:setup]
|
57
|
+
test_case = assert_setup(expected_setup_calls, nil)
|
58
|
+
assert_inherited_setup([:setup,
|
59
|
+
:custom_setup_method0,
|
60
|
+
:custom_setup_method1,
|
61
|
+
:custom_setup_method3],
|
62
|
+
test_case,
|
63
|
+
[])
|
64
|
+
|
65
|
+
assert_inherited_setup([:setup], nil)
|
66
|
+
assert_called_fixtures(expected_setup_calls, test_case)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_teardown_without_option
|
70
|
+
expected_teardown_calls = [:custom_teardown_method3,
|
71
|
+
:custom_teardown_method1,
|
72
|
+
:custom_teardown_method0,
|
73
|
+
:teardown]
|
74
|
+
test_case = assert_teardown(expected_teardown_calls, [])
|
75
|
+
assert_inherited_teardown(expected_teardown_calls, test_case)
|
76
|
+
|
77
|
+
assert_inherited_teardown([:teardown], nil)
|
78
|
+
assert_called_fixtures(expected_teardown_calls, test_case)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_teardown_with_before_option
|
82
|
+
expected_teardown_calls = [:custom_teardown_method3,
|
83
|
+
:custom_teardown_method0,
|
84
|
+
:custom_teardown_method1,
|
85
|
+
:teardown]
|
86
|
+
test_case = assert_teardown(expected_teardown_calls,
|
87
|
+
[[{:before => :append}],
|
88
|
+
[{:before => :append}],
|
89
|
+
[{:before => :prepend}],
|
90
|
+
[{:before => :prepend}]])
|
91
|
+
assert_inherited_teardown(expected_teardown_calls, test_case)
|
92
|
+
|
93
|
+
assert_inherited_teardown([:teardown], nil)
|
94
|
+
assert_called_fixtures(expected_teardown_calls, test_case)
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_teardown_with_after_option
|
98
|
+
expected_teardown_calls = [:teardown,
|
99
|
+
:custom_teardown_method3,
|
100
|
+
:custom_teardown_method0,
|
101
|
+
:custom_teardown_method1]
|
102
|
+
test_case = assert_teardown(expected_teardown_calls,
|
103
|
+
[[{:after => :append}],
|
104
|
+
[{:after => :append}],
|
105
|
+
[{:after => :prepend}],
|
106
|
+
[{:after => :prepend}]])
|
107
|
+
assert_inherited_teardown(expected_teardown_calls, test_case)
|
108
|
+
|
109
|
+
assert_inherited_teardown([:teardown], nil)
|
110
|
+
assert_called_fixtures(expected_teardown_calls, test_case)
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_teardown_with_invalid_option
|
114
|
+
assert_invalid_teardown_option(:unknown => true)
|
115
|
+
assert_invalid_teardown_option(:before => :unknown)
|
116
|
+
assert_invalid_teardown_option(:after => :unknown)
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_teardown_with_option_to_inherited
|
120
|
+
expected_teardown_calls = [:teardown]
|
121
|
+
test_case = assert_teardown(expected_teardown_calls, nil)
|
122
|
+
assert_inherited_teardown([:custom_teardown_method3,
|
123
|
+
:custom_teardown_method1,
|
124
|
+
:custom_teardown_method0,
|
125
|
+
:teardown],
|
126
|
+
test_case, [])
|
127
|
+
|
128
|
+
assert_inherited_teardown([:teardown], nil)
|
129
|
+
assert_called_fixtures(expected_teardown_calls, test_case)
|
130
|
+
end
|
131
|
+
|
132
|
+
private
|
133
|
+
def assert_called_fixtures(expected, test_case)
|
134
|
+
test = test_case.new("test_nothing")
|
135
|
+
test.run(Test::Unit::TestResult.new) {}
|
136
|
+
assert_equal(expected, test.called_ids)
|
137
|
+
end
|
138
|
+
|
139
|
+
def assert_setup_customizable(expected, parent, options)
|
140
|
+
test_case = Class.new(parent || Test::Unit::TestCase) do
|
141
|
+
yield(self, :before) if block_given?
|
142
|
+
|
143
|
+
def called_ids
|
144
|
+
@called_ids ||= []
|
145
|
+
end
|
146
|
+
|
147
|
+
def called(id)
|
148
|
+
called_ids << id
|
149
|
+
end
|
150
|
+
|
151
|
+
def setup
|
152
|
+
called(:setup)
|
153
|
+
end
|
154
|
+
|
155
|
+
setup(*(options[0] || [])) if options
|
156
|
+
def custom_setup_method0
|
157
|
+
called(:custom_setup_method0)
|
158
|
+
end
|
159
|
+
|
160
|
+
def custom_setup_method1
|
161
|
+
called(:custom_setup_method1)
|
162
|
+
end
|
163
|
+
setup(*[:custom_setup_method1, *(options[1] || [])]) if options
|
164
|
+
|
165
|
+
setup(*(options[2] || [])) if options
|
166
|
+
def custom_setup_method2
|
167
|
+
called(:custom_setup_method2)
|
168
|
+
end
|
169
|
+
unregister_setup(:custom_setup_method2) if options
|
170
|
+
|
171
|
+
setup(*(options[3] || [])) if options
|
172
|
+
def custom_setup_method3
|
173
|
+
called(:custom_setup_method3)
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_nothing
|
177
|
+
end
|
178
|
+
|
179
|
+
yield(self, :after) if block_given?
|
180
|
+
end
|
181
|
+
|
182
|
+
assert_called_fixtures(expected, test_case)
|
183
|
+
test_case
|
184
|
+
end
|
185
|
+
|
186
|
+
def assert_setup(expected, options)
|
187
|
+
_test_case = assert_setup_customizable(expected, nil, options)
|
188
|
+
assert_setup_customizable(expected, nil, options) do |test_case, tag|
|
189
|
+
test_case.send(:include, EmptyModule) if tag == :before
|
190
|
+
end
|
191
|
+
_test_case
|
192
|
+
end
|
193
|
+
|
194
|
+
def assert_inherited_setup(expected, parent, options=nil)
|
195
|
+
_test_case = assert_setup_customizable(expected, parent, options)
|
196
|
+
assert_setup_customizable(expected, parent, options) do |test_case, tag|
|
197
|
+
test_case.send(:include, EmptyModule) if tag == :before
|
198
|
+
end
|
199
|
+
_test_case
|
200
|
+
end
|
201
|
+
|
202
|
+
def assert_teardown_customizable(expected, parent, options)
|
203
|
+
test_case = Class.new(parent || Test::Unit::TestCase) do
|
204
|
+
yield(self, :before) if block_given?
|
205
|
+
|
206
|
+
def called_ids
|
207
|
+
@called_ids ||= []
|
208
|
+
end
|
209
|
+
|
210
|
+
def called(id)
|
211
|
+
called_ids << id
|
212
|
+
end
|
213
|
+
|
214
|
+
def teardown
|
215
|
+
called(:teardown)
|
216
|
+
end
|
217
|
+
|
218
|
+
teardown(*(options[0] || [])) if options
|
219
|
+
def custom_teardown_method0
|
220
|
+
called(:custom_teardown_method0)
|
221
|
+
end
|
222
|
+
|
223
|
+
def custom_teardown_method1
|
224
|
+
called(:custom_teardown_method1)
|
225
|
+
end
|
226
|
+
teardown(*[:custom_teardown_method1, *(options[1] || [])]) if options
|
227
|
+
|
228
|
+
teardown(*(options[2] || [])) if options
|
229
|
+
def custom_teardown_method2
|
230
|
+
called(:custom_teardown_method2)
|
231
|
+
end
|
232
|
+
unregister_teardown(:custom_teardown_method2) if options
|
233
|
+
|
234
|
+
teardown(*(options[3] || [])) if options
|
235
|
+
def custom_teardown_method3
|
236
|
+
called(:custom_teardown_method3)
|
237
|
+
end
|
238
|
+
|
239
|
+
def test_nothing
|
240
|
+
end
|
241
|
+
|
242
|
+
yield(self, :after) if block_given?
|
243
|
+
end
|
244
|
+
|
245
|
+
assert_called_fixtures(expected, test_case)
|
246
|
+
test_case
|
247
|
+
end
|
248
|
+
|
249
|
+
def assert_teardown(expected, options)
|
250
|
+
assert_teardown_customizable(expected, nil, options)
|
251
|
+
assert_teardown_customizable(expected, nil, options) do |test_case, tag|
|
252
|
+
test_case.send(:include, EmptyModule) if tag == :before
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
def assert_inherited_teardown(expected, parent, options=nil)
|
257
|
+
assert_teardown_customizable(expected, parent, options)
|
258
|
+
assert_teardown_customizable(expected, parent, options) do |test_case, tag|
|
259
|
+
test_case.send(:include, EmptyModule) if tag == :before
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
def assert_invalid_option(fixture_type, option)
|
264
|
+
exception = assert_raise(ArgumentError) do
|
265
|
+
Class.new(Test::Unit::TestCase) do
|
266
|
+
def test_nothing
|
267
|
+
end
|
268
|
+
|
269
|
+
send(fixture_type, option)
|
270
|
+
def fixture
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
assert_equal("must be {:before => :prepend}, {:before => :append}, " +
|
275
|
+
"{:after => :prepend} or {:after => :append}" +
|
276
|
+
": #{option.inspect}",
|
277
|
+
exception.message)
|
278
|
+
end
|
279
|
+
|
280
|
+
def assert_invalid_setup_option(option)
|
281
|
+
assert_invalid_option(:setup, option)
|
282
|
+
end
|
283
|
+
|
284
|
+
def assert_invalid_teardown_option(option)
|
285
|
+
assert_invalid_option(:teardown, option)
|
286
|
+
end
|
287
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'test/unit'
|
2
|
-
require '
|
2
|
+
require 'testunit-test-util'
|
3
3
|
|
4
|
-
class
|
4
|
+
class TestUnitNotification < Test::Unit::TestCase
|
5
5
|
include TestUnitTestUtil
|
6
6
|
|
7
7
|
class TestCase < Test::Unit::TestCase
|
@@ -18,7 +18,7 @@ class TestNotification < Test::Unit::TestCase
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_notify
|
21
|
-
result =
|
21
|
+
result = _run_test("test_notify")
|
22
22
|
assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, " \
|
23
23
|
"0 omissions, 2 notifications",
|
24
24
|
result.to_s)
|
@@ -27,7 +27,7 @@ class TestNotification < Test::Unit::TestCase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
30
|
-
def
|
30
|
+
def _run_test(name)
|
31
31
|
super(TestCase, name)
|
32
32
|
end
|
33
33
|
end
|