activesambaldap 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +21 -0
- data/NEWS.en +1 -1
- data/NEWS.ja +1 -1
- data/README.en +12 -8
- data/README.ja +6 -3
- data/Rakefile +27 -121
- data/lib/active_samba_ldap.rb +1 -1
- data/lib/active_samba_ldap/get_text_support.rb +1 -1
- data/lib/active_samba_ldap/version.rb +1 -1
- data/license/lgpl-2.1.txt +165 -0
- data/po/ja/active-samba-ldap.po +2 -2
- data/test/run-test.rb +3 -3
- metadata +145 -277
- data/bin/asl-groupadd.help +0 -16
- data/bin/asl-groupdel.help +0 -13
- data/bin/asl-groupmod.help +0 -19
- data/bin/asl-groupshow.help +0 -11
- data/bin/asl-passwd.help +0 -15
- data/bin/asl-populate.help +0 -28
- data/bin/asl-purge.help +0 -11
- data/bin/asl-samba-computeradd.help +0 -13
- data/bin/asl-samba-groupadd.help +0 -11
- data/bin/asl-samba-groupdel.help +0 -11
- data/bin/asl-samba-groupmod.help +0 -15
- data/bin/asl-samba-useradd.help +0 -13
- data/bin/asl-samba-userdel.help +0 -11
- data/bin/asl-samba-usermod.help +0 -15
- data/bin/asl-useradd.help +0 -49
- data/bin/asl-userdel.help +0 -18
- data/bin/asl-usermod.help +0 -47
- data/bin/asl-usershow.help +0 -11
- data/data/locale/ja/LC_MESSAGES/active-samba-ldap.mo +0 -0
- data/example/asl-admin/README +0 -243
- data/example/asl-admin/Rakefile +0 -10
- data/example/asl-admin/app/controllers/application_controller.rb +0 -10
- data/example/asl-admin/app/controllers/samba_controller.rb +0 -12
- data/example/asl-admin/app/helpers/application_helper.rb +0 -3
- data/example/asl-admin/app/helpers/samba_helper.rb +0 -2
- data/example/asl-admin/app/models/computer.rb +0 -3
- data/example/asl-admin/app/models/dc.rb +0 -3
- data/example/asl-admin/app/models/group.rb +0 -3
- data/example/asl-admin/app/models/idmap.rb +0 -3
- data/example/asl-admin/app/models/ou.rb +0 -3
- data/example/asl-admin/app/models/unix_id_pool.rb +0 -3
- data/example/asl-admin/app/models/user.rb +0 -3
- data/example/asl-admin/app/views/samba/index.html.erb +0 -17
- data/example/asl-admin/app/views/samba/populate.html.erb +0 -15
- data/example/asl-admin/app/views/samba/purge.html.erb +0 -10
- data/example/asl-admin/config/boot.rb +0 -110
- data/example/asl-admin/config/database.yml +0 -22
- data/example/asl-admin/config/environment.rb +0 -48
- data/example/asl-admin/config/environments/development.rb +0 -17
- data/example/asl-admin/config/environments/production.rb +0 -28
- data/example/asl-admin/config/environments/test.rb +0 -28
- data/example/asl-admin/config/initializers/backtrace_silencers.rb +0 -7
- data/example/asl-admin/config/initializers/inflections.rb +0 -10
- data/example/asl-admin/config/initializers/mime_types.rb +0 -5
- data/example/asl-admin/config/initializers/new_rails_defaults.rb +0 -19
- data/example/asl-admin/config/initializers/session_store.rb +0 -15
- data/example/asl-admin/config/ldap.yml.sample +0 -24
- data/example/asl-admin/config/locales/en.yml +0 -5
- data/example/asl-admin/config/routes.rb +0 -43
- data/example/asl-admin/log/test.log +0 -5
- data/example/asl-admin/public/404.html +0 -30
- data/example/asl-admin/public/422.html +0 -30
- data/example/asl-admin/public/500.html +0 -30
- data/example/asl-admin/public/favicon.ico +0 -0
- data/example/asl-admin/public/images/rails.png +0 -0
- data/example/asl-admin/public/index.html +0 -275
- data/example/asl-admin/public/javascripts/application.js +0 -2
- data/example/asl-admin/public/javascripts/controls.js +0 -963
- data/example/asl-admin/public/javascripts/dragdrop.js +0 -973
- data/example/asl-admin/public/javascripts/effects.js +0 -1128
- data/example/asl-admin/public/javascripts/prototype.js +0 -4320
- data/example/asl-admin/public/robots.txt +0 -5
- data/example/asl-admin/script/about +0 -4
- data/example/asl-admin/script/console +0 -3
- data/example/asl-admin/script/dbconsole +0 -3
- data/example/asl-admin/script/destroy +0 -3
- data/example/asl-admin/script/generate +0 -3
- data/example/asl-admin/script/performance/benchmarker +0 -3
- data/example/asl-admin/script/performance/profiler +0 -3
- data/example/asl-admin/script/plugin +0 -3
- data/example/asl-admin/script/runner +0 -3
- data/example/asl-admin/script/server +0 -3
- data/example/asl-admin/test/performance/browsing_test.rb +0 -9
- data/example/asl-admin/test/test_helper.rb +0 -38
- data/po/active-samba-ldap.pot +0 -463
- data/rails_generators/scaffold_active_samba_ldap/scaffold_active_samba_ldap_generator.rb +0 -28
- data/rails_generators/scaffold_active_samba_ldap/templates/computer.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/dc.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/group.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/idmap.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/ldap.yml +0 -24
- data/rails_generators/scaffold_active_samba_ldap/templates/ou.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_controller.rb +0 -12
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_helper.rb +0 -2
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_index.html.erb +0 -17
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_populate.html.erb +0 -15
- data/rails_generators/scaffold_active_samba_ldap/templates/samba_purge.html.erb +0 -10
- data/rails_generators/scaffold_active_samba_ldap/templates/unix_id_pool.rb +0 -3
- data/rails_generators/scaffold_active_samba_ldap/templates/user.rb +0 -3
- data/setup.rb +0 -1585
- data/test-unit/History.txt +0 -107
- data/test-unit/README.txt +0 -52
- data/test-unit/Rakefile +0 -40
- data/test-unit/TODO +0 -5
- data/test-unit/bin/testrb +0 -5
- data/test-unit/lib/test/unit.rb +0 -342
- data/test-unit/lib/test/unit/assertionfailederror.rb +0 -14
- data/test-unit/lib/test/unit/assertions.rb +0 -1149
- data/test-unit/lib/test/unit/attribute.rb +0 -125
- data/test-unit/lib/test/unit/autorunner.rb +0 -344
- data/test-unit/lib/test/unit/collector.rb +0 -43
- data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
- data/test-unit/lib/test/unit/collector/dir.rb +0 -108
- data/test-unit/lib/test/unit/collector/load.rb +0 -137
- data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
- data/test-unit/lib/test/unit/color-scheme.rb +0 -90
- data/test-unit/lib/test/unit/color.rb +0 -96
- data/test-unit/lib/test/unit/diff.rb +0 -538
- data/test-unit/lib/test/unit/error.rb +0 -126
- data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
- data/test-unit/lib/test/unit/failure.rb +0 -110
- data/test-unit/lib/test/unit/fixture.rb +0 -176
- data/test-unit/lib/test/unit/notification.rb +0 -125
- data/test-unit/lib/test/unit/omission.rb +0 -143
- data/test-unit/lib/test/unit/pending.rb +0 -146
- data/test-unit/lib/test/unit/priority.rb +0 -181
- data/test-unit/lib/test/unit/runner/console.rb +0 -52
- data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
- data/test-unit/lib/test/unit/runner/tap.rb +0 -8
- data/test-unit/lib/test/unit/testcase.rb +0 -425
- data/test-unit/lib/test/unit/testresult.rb +0 -89
- data/test-unit/lib/test/unit/testsuite.rb +0 -110
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -278
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -49
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -92
- data/test-unit/lib/test/unit/ui/testrunner.rb +0 -20
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
- data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -41
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
- data/test-unit/lib/test/unit/util/observable.rb +0 -90
- data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
- data/test-unit/lib/test/unit/version.rb +0 -7
- data/test-unit/sample/adder.rb +0 -13
- data/test-unit/sample/subtracter.rb +0 -12
- data/test-unit/sample/tc_adder.rb +0 -18
- data/test-unit/sample/tc_subtracter.rb +0 -18
- data/test-unit/sample/test_user.rb +0 -22
- data/test-unit/sample/ts_examples.rb +0 -7
- data/test-unit/test/collector/test-descendant.rb +0 -135
- data/test-unit/test/collector/test-load.rb +0 -329
- data/test-unit/test/collector/test_dir.rb +0 -406
- data/test-unit/test/collector/test_objectspace.rb +0 -98
- data/test-unit/test/run-test.rb +0 -13
- data/test-unit/test/test-attribute.rb +0 -86
- data/test-unit/test/test-color-scheme.rb +0 -60
- data/test-unit/test/test-color.rb +0 -47
- data/test-unit/test/test-diff.rb +0 -477
- data/test-unit/test/test-emacs-runner.rb +0 -60
- data/test-unit/test/test-fixture.rb +0 -287
- data/test-unit/test/test-notification.rb +0 -33
- data/test-unit/test/test-omission.rb +0 -81
- data/test-unit/test/test-pending.rb +0 -70
- data/test-unit/test/test-priority.rb +0 -119
- data/test-unit/test/test-testcase.rb +0 -507
- data/test-unit/test/test_assertions.rb +0 -1082
- data/test-unit/test/test_error.rb +0 -26
- data/test-unit/test/test_failure.rb +0 -33
- data/test-unit/test/test_testresult.rb +0 -113
- data/test-unit/test/test_testsuite.rb +0 -129
- data/test-unit/test/testunit-test-util.rb +0 -14
- data/test-unit/test/ui/test_testrunmediator.rb +0 -20
- data/test-unit/test/util/test-method-owner-finder.rb +0 -38
- data/test-unit/test/util/test_backtracefilter.rb +0 -41
- data/test-unit/test/util/test_observable.rb +0 -102
- data/test-unit/test/util/test_procwrapper.rb +0 -36
@@ -1,52 +0,0 @@
|
|
1
|
-
module Test
|
2
|
-
module Unit
|
3
|
-
AutoRunner.register_runner(:console) do |auto_runner|
|
4
|
-
require 'test/unit/ui/console/testrunner'
|
5
|
-
Test::Unit::UI::Console::TestRunner
|
6
|
-
end
|
7
|
-
|
8
|
-
AutoRunner.setup_option do |auto_runner, opts|
|
9
|
-
require 'test/unit/ui/console/outputlevel'
|
10
|
-
|
11
|
-
output_levels = [
|
12
|
-
[:silent, UI::Console::OutputLevel::SILENT],
|
13
|
-
[:progress, UI::Console::OutputLevel::PROGRESS_ONLY],
|
14
|
-
[:normal, UI::Console::OutputLevel::NORMAL],
|
15
|
-
[:verbose, UI::Console::OutputLevel::VERBOSE],
|
16
|
-
]
|
17
|
-
opts.on('-v', '--verbose=[LEVEL]', output_levels,
|
18
|
-
"Set the output level (default is verbose).",
|
19
|
-
"(#{auto_runner.keyword_display(output_levels)})") do |level|
|
20
|
-
level ||= output_levels.assoc(:verbose)[1]
|
21
|
-
auto_runner.runner_options[:output_level] = level
|
22
|
-
end
|
23
|
-
|
24
|
-
use_color_options = [
|
25
|
-
[:auto, :auto],
|
26
|
-
["-", false],
|
27
|
-
["no", false],
|
28
|
-
["false", false],
|
29
|
-
["+", true],
|
30
|
-
["yes", true],
|
31
|
-
["true", true],
|
32
|
-
]
|
33
|
-
opts.on("--[no-]use-color=[auto]", use_color_options,
|
34
|
-
"Uses color output",
|
35
|
-
"(default is auto)") do |use_color|
|
36
|
-
case use_color
|
37
|
-
when nil
|
38
|
-
use_color = true
|
39
|
-
when :auto
|
40
|
-
use_color = nil
|
41
|
-
end
|
42
|
-
auto_runner.runner_options[:use_color] = use_color
|
43
|
-
end
|
44
|
-
|
45
|
-
opts.on("--progress-row-max=MAX", Integer,
|
46
|
-
"Uses MAX as max terminal width for progress mark",
|
47
|
-
"(default is auto)") do |max|
|
48
|
-
auto_runner.runner_options[:progress_row_max] = max
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,425 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
#
|
3
|
-
# Author:: Nathaniel Talbott.
|
4
|
-
# Copyright::
|
5
|
-
# * Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
6
|
-
# * Copyright (c) 2008-2009 Kouhei Sutou <tt><kou@clear-code.com></tt>
|
7
|
-
# License:: Ruby license.
|
8
|
-
|
9
|
-
require 'test/unit/attribute'
|
10
|
-
require 'test/unit/fixture'
|
11
|
-
require 'test/unit/exceptionhandler'
|
12
|
-
require 'test/unit/assertions'
|
13
|
-
require 'test/unit/failure'
|
14
|
-
require 'test/unit/error'
|
15
|
-
require 'test/unit/pending'
|
16
|
-
require 'test/unit/omission'
|
17
|
-
require 'test/unit/notification'
|
18
|
-
require 'test/unit/priority'
|
19
|
-
require 'test/unit/testsuite'
|
20
|
-
require 'test/unit/assertionfailederror'
|
21
|
-
require 'test/unit/util/backtracefilter'
|
22
|
-
require 'test/unit/util/method-owner-finder'
|
23
|
-
|
24
|
-
module Test
|
25
|
-
module Unit
|
26
|
-
|
27
|
-
# Ties everything together. If you subclass and add your own
|
28
|
-
# test methods, it takes care of making them into tests and
|
29
|
-
# wrapping those tests into a suite. It also does the
|
30
|
-
# nitty-gritty of actually running an individual test and
|
31
|
-
# collecting its results into a Test::Unit::TestResult object.
|
32
|
-
#
|
33
|
-
# You can run two hooks before/after a TestCase run.
|
34
|
-
#
|
35
|
-
# Example:
|
36
|
-
# class TestMyClass < Test::Unit::TestCase
|
37
|
-
# class << self
|
38
|
-
# def startup
|
39
|
-
# ...
|
40
|
-
# end
|
41
|
-
#
|
42
|
-
# def shutdown
|
43
|
-
# ...
|
44
|
-
# end
|
45
|
-
# end
|
46
|
-
#
|
47
|
-
# def setup
|
48
|
-
# ...
|
49
|
-
# end
|
50
|
-
#
|
51
|
-
# def teardown
|
52
|
-
# ...
|
53
|
-
# end
|
54
|
-
#
|
55
|
-
# def test_my_method1
|
56
|
-
# ...
|
57
|
-
# end
|
58
|
-
#
|
59
|
-
# def test_my_method2
|
60
|
-
# ...
|
61
|
-
# end
|
62
|
-
# end
|
63
|
-
#
|
64
|
-
# Here is a call order:
|
65
|
-
# * startup
|
66
|
-
# * setup
|
67
|
-
# * test_my_method1
|
68
|
-
# * teardown
|
69
|
-
# * setup
|
70
|
-
# * test_my_method2
|
71
|
-
# * teardown
|
72
|
-
# * shutdown
|
73
|
-
class TestCase
|
74
|
-
include Attribute
|
75
|
-
include Fixture
|
76
|
-
include ExceptionHandler
|
77
|
-
include ErrorHandler
|
78
|
-
include FailureHandler
|
79
|
-
include TestCasePendingSupport
|
80
|
-
include TestCaseOmissionSupport
|
81
|
-
include TestCaseNotificationSupport
|
82
|
-
include Priority
|
83
|
-
include Assertions
|
84
|
-
include Util::BacktraceFilter
|
85
|
-
|
86
|
-
STARTED = name + "::STARTED" # :nodoc:
|
87
|
-
FINISHED = name + "::FINISHED" # :nodoc:
|
88
|
-
|
89
|
-
DESCENDANTS = [] # :nodoc:
|
90
|
-
AVAILABLE_ORDERS = [:alphabetic, :random, :defined] # :nodoc:
|
91
|
-
|
92
|
-
class << self
|
93
|
-
def inherited(sub_class) # :nodoc:
|
94
|
-
DESCENDANTS << sub_class
|
95
|
-
end
|
96
|
-
|
97
|
-
@@added_methods = []
|
98
|
-
def method_added(name) # :nodoc:
|
99
|
-
super
|
100
|
-
@@added_methods << name.to_s
|
101
|
-
end
|
102
|
-
|
103
|
-
# Rolls up all of the test* methods in the fixture into
|
104
|
-
# one suite, creating a new instance of the fixture for
|
105
|
-
# each method.
|
106
|
-
def suite
|
107
|
-
suite = TestSuite.new(name, self)
|
108
|
-
collect_test_names.each do |test|
|
109
|
-
catch(:invalid_test) do
|
110
|
-
suite << new(test)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
if suite.empty?
|
114
|
-
catch(:invalid_test) do
|
115
|
-
suite << new("default_test")
|
116
|
-
end
|
117
|
-
end
|
118
|
-
suite
|
119
|
-
end
|
120
|
-
|
121
|
-
# Called before every test case runs. Can be used
|
122
|
-
# to set up fixture information used in test case
|
123
|
-
# scope.
|
124
|
-
#
|
125
|
-
# Here is an example test case:
|
126
|
-
# class TestMyClass < Test::Unit::TestCase
|
127
|
-
# class << self
|
128
|
-
# def startup
|
129
|
-
# ...
|
130
|
-
# end
|
131
|
-
# end
|
132
|
-
#
|
133
|
-
# def setup
|
134
|
-
# ...
|
135
|
-
# end
|
136
|
-
#
|
137
|
-
# def test_my_class1
|
138
|
-
# ...
|
139
|
-
# end
|
140
|
-
#
|
141
|
-
# def test_my_class2
|
142
|
-
# ...
|
143
|
-
# end
|
144
|
-
# end
|
145
|
-
#
|
146
|
-
# Here is a call order:
|
147
|
-
# * startup
|
148
|
-
# * setup
|
149
|
-
# * test_my_class1 (or test_my_class2)
|
150
|
-
# * setup
|
151
|
-
# * test_my_class2 (or test_my_class1)
|
152
|
-
#
|
153
|
-
# Note that you should not assume test order. Tests
|
154
|
-
# should be worked in any order.
|
155
|
-
def startup
|
156
|
-
end
|
157
|
-
|
158
|
-
# Called after every test case runs. Can be used to tear
|
159
|
-
# down fixture information used in test case scope.
|
160
|
-
#
|
161
|
-
# Here is an example test case:
|
162
|
-
# class TestMyClass < Test::Unit::TestCase
|
163
|
-
# class << self
|
164
|
-
# def shutdown
|
165
|
-
# ...
|
166
|
-
# end
|
167
|
-
# end
|
168
|
-
#
|
169
|
-
# def teardown
|
170
|
-
# ...
|
171
|
-
# end
|
172
|
-
#
|
173
|
-
# def test_my_class1
|
174
|
-
# ...
|
175
|
-
# end
|
176
|
-
#
|
177
|
-
# def test_my_class2
|
178
|
-
# ...
|
179
|
-
# end
|
180
|
-
# end
|
181
|
-
#
|
182
|
-
# Here is a call order:
|
183
|
-
# * test_my_class1 (or test_my_class2)
|
184
|
-
# * teardown
|
185
|
-
# * test_my_class2 (or test_my_class1)
|
186
|
-
# * teardown
|
187
|
-
# * shutdown
|
188
|
-
#
|
189
|
-
# Note that you should not assume test order. Tests
|
190
|
-
# should be worked in any order.
|
191
|
-
def shutdown
|
192
|
-
end
|
193
|
-
|
194
|
-
@@test_order = AVAILABLE_ORDERS.first
|
195
|
-
|
196
|
-
# Returns the current test order. This returns
|
197
|
-
# +:alphabetic+ by default.
|
198
|
-
def test_order
|
199
|
-
@@test_order
|
200
|
-
end
|
201
|
-
|
202
|
-
# Sets the current test order.
|
203
|
-
#
|
204
|
-
# Here are the available _order_:
|
205
|
-
# [:alphabetic]
|
206
|
-
# Default. Tests are sorted in alphabetic order.
|
207
|
-
# [:random]
|
208
|
-
# Tests are sorted in random order.
|
209
|
-
# [:defined]
|
210
|
-
# Tests are sorted in defined order.
|
211
|
-
def test_order=(order)
|
212
|
-
@@test_order = order
|
213
|
-
end
|
214
|
-
|
215
|
-
# :stopdoc:
|
216
|
-
private
|
217
|
-
def collect_test_names
|
218
|
-
method_names = public_instance_methods(true).collect do |name|
|
219
|
-
name.to_s
|
220
|
-
end
|
221
|
-
test_names = method_names.find_all do |method_name|
|
222
|
-
method_name =~ /^test./
|
223
|
-
end
|
224
|
-
send("sort_test_names_in_#{test_order}_order", test_names)
|
225
|
-
end
|
226
|
-
|
227
|
-
def sort_test_names_in_alphabetic_order(test_names)
|
228
|
-
test_names.sort
|
229
|
-
end
|
230
|
-
|
231
|
-
def sort_test_names_in_random_order(test_names)
|
232
|
-
test_names.sort_by {rand(test_names.size)}
|
233
|
-
end
|
234
|
-
|
235
|
-
def sort_test_names_in_defined_order(test_names)
|
236
|
-
test_names.sort do |test1, test2|
|
237
|
-
test1_defined_order = @@added_methods.index(test1)
|
238
|
-
test2_defined_order = @@added_methods.index(test2)
|
239
|
-
if test1_defined_order and test2_defined_order
|
240
|
-
test1_defined_order <=> test2_defined_order
|
241
|
-
elsif test1_defined_order
|
242
|
-
1
|
243
|
-
elsif test2_defined_order
|
244
|
-
-1
|
245
|
-
else
|
246
|
-
test1 <=> test2
|
247
|
-
end
|
248
|
-
end
|
249
|
-
end
|
250
|
-
# :startdoc:
|
251
|
-
end
|
252
|
-
|
253
|
-
attr_reader :method_name
|
254
|
-
|
255
|
-
# Creates a new instance of the fixture for running the
|
256
|
-
# test represented by test_method_name.
|
257
|
-
def initialize(test_method_name)
|
258
|
-
throw :invalid_test unless respond_to?(test_method_name)
|
259
|
-
test_method = method(test_method_name)
|
260
|
-
throw :invalid_test if test_method.arity > 0
|
261
|
-
owner = Util::MethodOwnerFinder.find(self, test_method_name)
|
262
|
-
if owner.class != Module and self.class != owner
|
263
|
-
throw :invalid_test
|
264
|
-
end
|
265
|
-
@method_name = test_method_name
|
266
|
-
@test_passed = true
|
267
|
-
@interrupted = false
|
268
|
-
end
|
269
|
-
|
270
|
-
# Runs the individual test method represented by this
|
271
|
-
# instance of the fixture, collecting statistics, failures
|
272
|
-
# and errors in result.
|
273
|
-
def run(result)
|
274
|
-
begin
|
275
|
-
@_result = result
|
276
|
-
yield(STARTED, name)
|
277
|
-
begin
|
278
|
-
run_setup
|
279
|
-
run_test
|
280
|
-
rescue Exception
|
281
|
-
@interrupted = true
|
282
|
-
raise unless handle_exception($!)
|
283
|
-
ensure
|
284
|
-
begin
|
285
|
-
run_teardown
|
286
|
-
rescue Exception
|
287
|
-
raise unless handle_exception($!)
|
288
|
-
end
|
289
|
-
end
|
290
|
-
result.add_run
|
291
|
-
yield(FINISHED, name)
|
292
|
-
ensure
|
293
|
-
# @_result = nil # For test-spec's after_all :<
|
294
|
-
end
|
295
|
-
end
|
296
|
-
|
297
|
-
# Called before every test method runs. Can be used
|
298
|
-
# to set up fixture information.
|
299
|
-
#
|
300
|
-
# You can add additional setup tasks by the following
|
301
|
-
# code:
|
302
|
-
# class TestMyClass < Test::Unit::TestCase
|
303
|
-
# def setup
|
304
|
-
# ...
|
305
|
-
# end
|
306
|
-
#
|
307
|
-
# setup
|
308
|
-
# def my_setup1
|
309
|
-
# ...
|
310
|
-
# end
|
311
|
-
#
|
312
|
-
# setup
|
313
|
-
# def my_setup2
|
314
|
-
# ...
|
315
|
-
# end
|
316
|
-
#
|
317
|
-
# def test_my_class
|
318
|
-
# ...
|
319
|
-
# end
|
320
|
-
# end
|
321
|
-
#
|
322
|
-
# Here is a call order:
|
323
|
-
# * setup
|
324
|
-
# * my_setup1
|
325
|
-
# * my_setup2
|
326
|
-
# * test_my_class
|
327
|
-
def setup
|
328
|
-
end
|
329
|
-
|
330
|
-
# Called after every test method runs. Can be used to tear
|
331
|
-
# down fixture information.
|
332
|
-
#
|
333
|
-
# You can add additional teardown tasks by the following
|
334
|
-
# code:
|
335
|
-
# class TestMyClass < Test::Unit::TestCase
|
336
|
-
# def teardown
|
337
|
-
# ...
|
338
|
-
# end
|
339
|
-
#
|
340
|
-
# teardown
|
341
|
-
# def my_teardown1
|
342
|
-
# ...
|
343
|
-
# end
|
344
|
-
#
|
345
|
-
# teardown
|
346
|
-
# def my_teardown2
|
347
|
-
# ...
|
348
|
-
# end
|
349
|
-
#
|
350
|
-
# def test_my_class
|
351
|
-
# ...
|
352
|
-
# end
|
353
|
-
# end
|
354
|
-
#
|
355
|
-
# Here is a call order:
|
356
|
-
# * test_my_class
|
357
|
-
# * my_teardown2
|
358
|
-
# * my_teardown1
|
359
|
-
# * teardown
|
360
|
-
def teardown
|
361
|
-
end
|
362
|
-
|
363
|
-
def default_test
|
364
|
-
flunk("No tests were specified")
|
365
|
-
end
|
366
|
-
|
367
|
-
def size
|
368
|
-
1
|
369
|
-
end
|
370
|
-
|
371
|
-
# Returns a human-readable name for the specific test that
|
372
|
-
# this instance of TestCase represents.
|
373
|
-
def name
|
374
|
-
"#{@method_name}(#{self.class.name})"
|
375
|
-
end
|
376
|
-
|
377
|
-
# Overridden to return #name.
|
378
|
-
def to_s
|
379
|
-
name
|
380
|
-
end
|
381
|
-
|
382
|
-
# It's handy to be able to compare TestCase instances.
|
383
|
-
def ==(other)
|
384
|
-
return false unless(other.kind_of?(self.class))
|
385
|
-
return false unless(@method_name == other.method_name)
|
386
|
-
self.class == other.class
|
387
|
-
end
|
388
|
-
|
389
|
-
def interrupted?
|
390
|
-
@interrupted
|
391
|
-
end
|
392
|
-
|
393
|
-
private
|
394
|
-
def current_result
|
395
|
-
@_result
|
396
|
-
end
|
397
|
-
|
398
|
-
def run_test
|
399
|
-
__send__(@method_name)
|
400
|
-
end
|
401
|
-
|
402
|
-
def handle_exception(exception)
|
403
|
-
self.class.exception_handlers.each do |handler|
|
404
|
-
return true if send(handler, exception)
|
405
|
-
end
|
406
|
-
false
|
407
|
-
end
|
408
|
-
|
409
|
-
# Returns whether this individual test passed or
|
410
|
-
# not. Primarily for use in teardown so that artifacts
|
411
|
-
# can be left behind if the test fails.
|
412
|
-
def passed?
|
413
|
-
@test_passed
|
414
|
-
end
|
415
|
-
|
416
|
-
def problem_occurred
|
417
|
-
@test_passed = false
|
418
|
-
end
|
419
|
-
|
420
|
-
def add_assertion
|
421
|
-
current_result.add_assertion
|
422
|
-
end
|
423
|
-
end
|
424
|
-
end
|
425
|
-
end
|