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
data/test-unit/History.txt
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
=== 2.0.3 / 2009-07-19
|
2
|
-
|
3
|
-
* 6 major enhancements
|
4
|
-
* add assert_predicate.
|
5
|
-
* add assert_not_predicate.
|
6
|
-
* [#24210] assert_kind_of supports an array of classes or modules.
|
7
|
-
[Daniel Berger]
|
8
|
-
* assert_instance_of supports an array of classes or modules.
|
9
|
-
* add --default-priority option.
|
10
|
-
* [#26627] add --order option. [Daniel Berger]
|
11
|
-
|
12
|
-
* 4 minor enhancements
|
13
|
-
* use yellow foreground + black background for error.
|
14
|
-
* don't show diff for long string.
|
15
|
-
* accept "*term-color" TERM environment as colorizable terminal.
|
16
|
-
(e.g. Apple's Terminal)
|
17
|
-
* [#26268] add a workaround for test-spec's after_all. [Angelo Lakra]
|
18
|
-
|
19
|
-
* 1 bug fix
|
20
|
-
* [#23586] re-support ruby 1.9.1. [Diego Pettenò]
|
21
|
-
|
22
|
-
* Thanks
|
23
|
-
* Diego Pettenò
|
24
|
-
* Daniel Berger
|
25
|
-
* Angelo Lakra
|
26
|
-
|
27
|
-
=== 2.0.2 / 2008-12-21
|
28
|
-
|
29
|
-
* 2 major enhancements
|
30
|
-
|
31
|
-
* re-support ruby 1.8.5.
|
32
|
-
* improve exception object comparison.
|
33
|
-
|
34
|
-
* 3 bug fixes
|
35
|
-
|
36
|
-
* [#22723]: collector fails on anonymous classes
|
37
|
-
* [#22986]: Test names with '?' blow up on Windows
|
38
|
-
* [#22988]: don't create .test-result on non-priority mode.
|
39
|
-
|
40
|
-
* Thanks
|
41
|
-
|
42
|
-
* Erik Hollensbe
|
43
|
-
* Daniel Berger
|
44
|
-
* Bill Lear
|
45
|
-
|
46
|
-
=== 2.0.1 / 2008-11-09
|
47
|
-
|
48
|
-
* 19 major enhancements
|
49
|
-
|
50
|
-
* support ruby 1.9.1.
|
51
|
-
* add run_test method to be extensible.
|
52
|
-
* improve priority-mode auto off.
|
53
|
-
* improve startup/shutdown RDoc. [Daniel Berger]
|
54
|
-
* add assert_compare. [#20851] [Designing Patterns]
|
55
|
-
* add assert_fail_assertion. [#20851] [Designing Patterns]
|
56
|
-
* add assert_raise_message. [#20851] [Designing Patterns]
|
57
|
-
* support folded diff.
|
58
|
-
* add assert_raise_kind_of. [Daniel Berger]
|
59
|
-
* ingore inherited test for nested test case.
|
60
|
-
* add assert_const_defined.
|
61
|
-
* add assert_not_const_defined.
|
62
|
-
* support assert_raise with an exception object.
|
63
|
-
* support assert_raise with no arguments that asserts any
|
64
|
-
exception is raised. [#22602] [Daniel Berger]
|
65
|
-
* support folded dot progress.
|
66
|
-
* add --progress-row-max option.
|
67
|
-
* support color scheme customize.
|
68
|
-
* support configuration file. (YAML)
|
69
|
-
* recognize test-XXX.rb files as test files not only test_XXX.rb
|
70
|
-
|
71
|
-
* Thanks
|
72
|
-
|
73
|
-
* Daniel Berger
|
74
|
-
* Designing Patterns
|
75
|
-
|
76
|
-
=== 2.0.0 / 2008-06-18
|
77
|
-
|
78
|
-
* 15 major enhancements
|
79
|
-
|
80
|
-
* support startup/shutdown. (test case level setup/teardown)
|
81
|
-
* support multiple setup/teardown.
|
82
|
-
* support pending.
|
83
|
-
* support omission.
|
84
|
-
* support notification.
|
85
|
-
* support colorize.
|
86
|
-
* support diff.
|
87
|
-
* support test attribute.
|
88
|
-
* add assert_boolean.
|
89
|
-
* add assert_true.
|
90
|
-
* add assert_false.
|
91
|
-
* add --priority-mode option.
|
92
|
-
* don't use ObjectSpace to collect test cases.
|
93
|
-
* make more customizable. (additional options, exception handling and so on)
|
94
|
-
* improve Emacs integration.
|
95
|
-
|
96
|
-
* 4 major changes
|
97
|
-
|
98
|
-
* remove GTK+1 support.
|
99
|
-
* split GTK+ runner as another gem.
|
100
|
-
* split FOX runner as another gem.
|
101
|
-
* split Tk runner as another gem.
|
102
|
-
|
103
|
-
=== 1.2.3 / 2008-02-25
|
104
|
-
|
105
|
-
* 1 major enhancement
|
106
|
-
|
107
|
-
* Birthday (as a gem)!
|
data/test-unit/README.txt
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
= Test::Unit 2.x
|
2
|
-
|
3
|
-
* http://rubyforge.org/projects/test-unit/
|
4
|
-
|
5
|
-
== DESCRIPTION
|
6
|
-
|
7
|
-
Test::Unit 2.x - Improved version of Test::Unit bundled in
|
8
|
-
Ruby 1.8.x.
|
9
|
-
|
10
|
-
Ruby 1.9.x bundles minitest not Test::Unit. Test::Unit
|
11
|
-
bundled in Ruby 1.8.x had not been improved but unbundled
|
12
|
-
Test::Unit (Test::Unit 2.x) will be improved actively.
|
13
|
-
|
14
|
-
== FEATURES
|
15
|
-
|
16
|
-
* Test::Unit 1.2.3 is the original Test::Unit, taken
|
17
|
-
straight from the ruby distribution. It is being
|
18
|
-
distributed as a gem to allow tool builders to use it as a
|
19
|
-
stand-alone package. (The test framework in ruby is going
|
20
|
-
to radically change very soon).
|
21
|
-
|
22
|
-
* Test::Unit 2.x will be improved actively and may break
|
23
|
-
compatiblity with Test::Unit 1.2.3. (We will not hope it
|
24
|
-
if it isn't needed.)
|
25
|
-
|
26
|
-
* Some features exist as separated gems like GUI test
|
27
|
-
runner. (Tk, GTK+ and Fox) test-unit-full gem package
|
28
|
-
provides for installing all Test::Unit related gems
|
29
|
-
easily.
|
30
|
-
|
31
|
-
== INSTALL
|
32
|
-
|
33
|
-
% sudo gem install test-unit
|
34
|
-
|
35
|
-
If you want to use full Test::Unit features:
|
36
|
-
|
37
|
-
% sudo gem install test-unit-full
|
38
|
-
|
39
|
-
== LICENSE
|
40
|
-
|
41
|
-
(The Ruby License)
|
42
|
-
|
43
|
-
This software is distributed under the same terms as ruby.
|
44
|
-
|
45
|
-
== Thanks
|
46
|
-
|
47
|
-
* Daniel Berger: Suggestions and bug reports.
|
48
|
-
* Designing Patterns: Suggestions.
|
49
|
-
* Erik Hollensbe: Suggestions.
|
50
|
-
* Bill Lear: A suggestion.
|
51
|
-
* Diego Pettenò: A bug report.
|
52
|
-
* Angelo Lakra: A bug report.
|
data/test-unit/Rakefile
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
gem 'rdoc'
|
5
|
-
require 'hoe'
|
6
|
-
require './lib/test/unit/version.rb'
|
7
|
-
|
8
|
-
ENV["NODOT"] = "yes"
|
9
|
-
|
10
|
-
version = Test::Unit::VERSION
|
11
|
-
ENV["VERSION"] = version
|
12
|
-
Hoe.spec('test-unit') do |p|
|
13
|
-
Hoe::Test::SUPPORTED_TEST_FRAMEWORKS[:testunit2] = "test/run-test.rb"
|
14
|
-
p.version = version
|
15
|
-
p.developer('Kouhei Sutou', 'kou@cozmixng.org')
|
16
|
-
p.developer('Ryan Davis', 'ryand-ruby@zenspider.com')
|
17
|
-
|
18
|
-
# Ex-Parrot:
|
19
|
-
# p.developer('Nathaniel Talbott', 'nathaniel@talbott.ws')
|
20
|
-
end
|
21
|
-
|
22
|
-
task :check_manifest => :clean_test_result
|
23
|
-
task :check_manifest => :clean_coverage
|
24
|
-
|
25
|
-
task :clean_test_result do
|
26
|
-
test_results = Dir.glob("**/.test-result")
|
27
|
-
sh("rm", "-rf", *test_results) unless test_results.empty?
|
28
|
-
end
|
29
|
-
|
30
|
-
task :clean_coverage do
|
31
|
-
sh("rm", "-rf", "coverage")
|
32
|
-
end
|
33
|
-
|
34
|
-
task :tag do
|
35
|
-
message = "Released Test::Unit #{version}!"
|
36
|
-
base = "svn+ssh://#{ENV['USER']}@rubyforge.org/var/svn/test-unit/"
|
37
|
-
sh 'svn', 'copy', '-m', message, "#{base}trunk", "#{base}tags/#{version}"
|
38
|
-
end
|
39
|
-
|
40
|
-
# vim: syntax=Ruby
|
data/test-unit/TODO
DELETED
data/test-unit/bin/testrb
DELETED
data/test-unit/lib/test/unit.rb
DELETED
@@ -1,342 +0,0 @@
|
|
1
|
-
require 'test/unit/testcase'
|
2
|
-
require 'test/unit/autorunner'
|
3
|
-
|
4
|
-
module Test # :nodoc:
|
5
|
-
#
|
6
|
-
# = Test::Unit - Ruby Unit Testing Framework
|
7
|
-
#
|
8
|
-
# == Introduction
|
9
|
-
#
|
10
|
-
# Unit testing is making waves all over the place, largely due to the
|
11
|
-
# fact that it is a core practice of XP. While XP is great, unit testing
|
12
|
-
# has been around for a long time and has always been a good idea. One
|
13
|
-
# of the keys to good unit testing, though, is not just writing tests,
|
14
|
-
# but having tests. What's the difference? Well, if you just _write_ a
|
15
|
-
# test and throw it away, you have no guarantee that something won't
|
16
|
-
# change later which breaks your code. If, on the other hand, you _have_
|
17
|
-
# tests (obviously you have to write them first), and run them as often
|
18
|
-
# as possible, you slowly build up a wall of things that cannot break
|
19
|
-
# without you immediately knowing about it. This is when unit testing
|
20
|
-
# hits its peak usefulness.
|
21
|
-
#
|
22
|
-
# Enter Test::Unit, a framework for unit testing in Ruby, helping you to
|
23
|
-
# design, debug and evaluate your code by making it easy to write and
|
24
|
-
# have tests for it.
|
25
|
-
#
|
26
|
-
#
|
27
|
-
# == Notes
|
28
|
-
#
|
29
|
-
# Test::Unit has grown out of and superceded Lapidary.
|
30
|
-
#
|
31
|
-
#
|
32
|
-
# == Feedback
|
33
|
-
#
|
34
|
-
# I like (and do my best to practice) XP, so I value early releases,
|
35
|
-
# user feedback, and clean, simple, expressive code. There is always
|
36
|
-
# room for improvement in everything I do, and Test::Unit is no
|
37
|
-
# exception. Please, let me know what you think of Test::Unit as it
|
38
|
-
# stands, and what you'd like to see expanded/changed/improved/etc. If
|
39
|
-
# you find a bug, let me know ASAP; one good way to let me know what the
|
40
|
-
# bug is is to submit a new test that catches it :-) Also, I'd love to
|
41
|
-
# hear about any successes you have with Test::Unit, and any
|
42
|
-
# documentation you might add will be greatly appreciated. My contact
|
43
|
-
# info is below.
|
44
|
-
#
|
45
|
-
#
|
46
|
-
# == Contact Information
|
47
|
-
#
|
48
|
-
# A lot of discussion happens about Ruby in general on the ruby-talk
|
49
|
-
# mailing list (http://www.ruby-lang.org/en/ml.html), and you can ask
|
50
|
-
# any questions you might have there. I monitor the list, as do many
|
51
|
-
# other helpful Rubyists, and you're sure to get a quick answer. Of
|
52
|
-
# course, you're also welcome to email me (Nathaniel Talbott) directly
|
53
|
-
# at mailto:testunit@talbott.ws, and I'll do my best to help you out.
|
54
|
-
#
|
55
|
-
#
|
56
|
-
# == Credits
|
57
|
-
#
|
58
|
-
# I'd like to thank...
|
59
|
-
#
|
60
|
-
# Matz, for a great language!
|
61
|
-
#
|
62
|
-
# Masaki Suketa, for his work on RubyUnit, which filled a vital need in
|
63
|
-
# the Ruby world for a very long time. I'm also grateful for his help in
|
64
|
-
# polishing Test::Unit and getting the RubyUnit compatibility layer
|
65
|
-
# right. His graciousness in allowing Test::Unit to supercede RubyUnit
|
66
|
-
# continues to be a challenge to me to be more willing to defer my own
|
67
|
-
# rights.
|
68
|
-
#
|
69
|
-
# Ken McKinlay, for his interest and work on unit testing, and for his
|
70
|
-
# willingness to dialog about it. He was also a great help in pointing
|
71
|
-
# out some of the holes in the RubyUnit compatibility layer.
|
72
|
-
#
|
73
|
-
# Dave Thomas, for the original idea that led to the extremely simple
|
74
|
-
# "require 'test/unit'", plus his code to improve it even more by
|
75
|
-
# allowing the selection of tests from the command-line. Also, without
|
76
|
-
# RDoc, the documentation for Test::Unit would stink a lot more than it
|
77
|
-
# does now.
|
78
|
-
#
|
79
|
-
# Everyone who's helped out with bug reports, feature ideas,
|
80
|
-
# encouragement to continue, etc. It's a real privilege to be a part of
|
81
|
-
# the Ruby community.
|
82
|
-
#
|
83
|
-
# The guys at RoleModel Software, for putting up with me repeating, "But
|
84
|
-
# this would be so much easier in Ruby!" whenever we're coding in Java.
|
85
|
-
#
|
86
|
-
# My Creator, for giving me life, and giving it more abundantly.
|
87
|
-
#
|
88
|
-
#
|
89
|
-
# == License
|
90
|
-
#
|
91
|
-
# Test::Unit is copyright (c) 2000-2003 Nathaniel Talbott. It is free
|
92
|
-
# software, and is distributed under the Ruby license. See the COPYING
|
93
|
-
# file in the standard Ruby distribution for details.
|
94
|
-
#
|
95
|
-
#
|
96
|
-
# == Warranty
|
97
|
-
#
|
98
|
-
# This software is provided "as is" and without any express or
|
99
|
-
# implied warranties, including, without limitation, the implied
|
100
|
-
# warranties of merchantibility and fitness for a particular
|
101
|
-
# purpose.
|
102
|
-
#
|
103
|
-
#
|
104
|
-
# == Author
|
105
|
-
#
|
106
|
-
# Nathaniel Talbott.
|
107
|
-
# Copyright (c) 2000-2003, Nathaniel Talbott
|
108
|
-
#
|
109
|
-
# ----
|
110
|
-
#
|
111
|
-
# = Usage
|
112
|
-
#
|
113
|
-
# The general idea behind unit testing is that you write a _test_
|
114
|
-
# _method_ that makes certain _assertions_ about your code, working
|
115
|
-
# against a _test_ _fixture_. A bunch of these _test_ _methods_ are
|
116
|
-
# bundled up into a _test_ _suite_ and can be run any time the
|
117
|
-
# developer wants. The results of a run are gathered in a _test_
|
118
|
-
# _result_ and displayed to the user through some UI. So, lets break
|
119
|
-
# this down and see how Test::Unit provides each of these necessary
|
120
|
-
# pieces.
|
121
|
-
#
|
122
|
-
#
|
123
|
-
# == Assertions
|
124
|
-
#
|
125
|
-
# These are the heart of the framework. Think of an assertion as a
|
126
|
-
# statement of expected outcome, i.e. "I assert that x should be equal
|
127
|
-
# to y". If, when the assertion is executed, it turns out to be
|
128
|
-
# correct, nothing happens, and life is good. If, on the other hand,
|
129
|
-
# your assertion turns out to be false, an error is propagated with
|
130
|
-
# pertinent information so that you can go back and make your
|
131
|
-
# assertion succeed, and, once again, life is good. For an explanation
|
132
|
-
# of the current assertions, see Test::Unit::Assertions.
|
133
|
-
#
|
134
|
-
#
|
135
|
-
# == Test Method & Test Fixture
|
136
|
-
#
|
137
|
-
# Obviously, these assertions have to be called within a context that
|
138
|
-
# knows about them and can do something meaningful with their
|
139
|
-
# pass/fail value. Also, it's handy to collect a bunch of related
|
140
|
-
# tests, each test represented by a method, into a common test class
|
141
|
-
# that knows how to run them. The tests will be in a separate class
|
142
|
-
# from the code they're testing for a couple of reasons. First of all,
|
143
|
-
# it allows your code to stay uncluttered with test code, making it
|
144
|
-
# easier to maintain. Second, it allows the tests to be stripped out
|
145
|
-
# for deployment, since they're really there for you, the developer,
|
146
|
-
# and your users don't need them. Third, and most importantly, it
|
147
|
-
# allows you to set up a common test fixture for your tests to run
|
148
|
-
# against.
|
149
|
-
#
|
150
|
-
# What's a test fixture? Well, tests do not live in a vacuum; rather,
|
151
|
-
# they're run against the code they are testing. Often, a collection
|
152
|
-
# of tests will run against a common set of data, also called a
|
153
|
-
# fixture. If they're all bundled into the same test class, they can
|
154
|
-
# all share the setting up and tearing down of that data, eliminating
|
155
|
-
# unnecessary duplication and making it much easier to add related
|
156
|
-
# tests.
|
157
|
-
#
|
158
|
-
# Test::Unit::TestCase wraps up a collection of test methods together
|
159
|
-
# and allows you to easily set up and tear down the same test fixture
|
160
|
-
# for each test. This is done by overriding #setup and/or #teardown,
|
161
|
-
# which will be called before and after each test method that is
|
162
|
-
# run. The TestCase also knows how to collect the results of your
|
163
|
-
# assertions into a Test::Unit::TestResult, which can then be reported
|
164
|
-
# back to you... but I'm getting ahead of myself. To write a test,
|
165
|
-
# follow these steps:
|
166
|
-
#
|
167
|
-
# * Make sure Test::Unit is in your library path.
|
168
|
-
# * require 'test/unit' in your test script.
|
169
|
-
# * Create a class that subclasses Test::Unit::TestCase.
|
170
|
-
# * Add a method that begins with "test" to your class.
|
171
|
-
# * Make assertions in your test method.
|
172
|
-
# * Optionally define #setup and/or #teardown to set up and/or tear
|
173
|
-
# down your common test fixture.
|
174
|
-
# * You can now run your test as you would any other Ruby
|
175
|
-
# script... try it and see!
|
176
|
-
#
|
177
|
-
# A really simple test might look like this (#setup and #teardown are
|
178
|
-
# commented out to indicate that they are completely optional):
|
179
|
-
#
|
180
|
-
# require 'test/unit'
|
181
|
-
#
|
182
|
-
# class TC_MyTest < Test::Unit::TestCase
|
183
|
-
# # def setup
|
184
|
-
# # end
|
185
|
-
#
|
186
|
-
# # def teardown
|
187
|
-
# # end
|
188
|
-
#
|
189
|
-
# def test_fail
|
190
|
-
# assert(false, 'Assertion was false.')
|
191
|
-
# end
|
192
|
-
# end
|
193
|
-
#
|
194
|
-
#
|
195
|
-
# == Test Runners
|
196
|
-
#
|
197
|
-
# So, now you have this great test class, but you still need a way to
|
198
|
-
# run it and view any failures that occur during the run. This is
|
199
|
-
# where Test::Unit::UI::Console::TestRunner (and others, such as
|
200
|
-
# Test::Unit::UI::GTK::TestRunner) comes into play. The console test
|
201
|
-
# runner is automatically invoked for you if you require 'test/unit'
|
202
|
-
# and simply run the file. To use another runner, or to manually
|
203
|
-
# invoke a runner, simply call its run class method and pass in an
|
204
|
-
# object that responds to the suite message with a
|
205
|
-
# Test::Unit::TestSuite. This can be as simple as passing in your
|
206
|
-
# TestCase class (which has a class suite method). It might look
|
207
|
-
# something like this:
|
208
|
-
#
|
209
|
-
# require 'test/unit/ui/console/testrunner'
|
210
|
-
# Test::Unit::UI::Console::TestRunner.run(TC_MyTest)
|
211
|
-
#
|
212
|
-
#
|
213
|
-
# == Test Suite
|
214
|
-
#
|
215
|
-
# As more and more unit tests accumulate for a given project, it
|
216
|
-
# becomes a real drag running them one at a time, and it also
|
217
|
-
# introduces the potential to overlook a failing test because you
|
218
|
-
# forget to run it. Suddenly it becomes very handy that the
|
219
|
-
# TestRunners can take any object that returns a Test::Unit::TestSuite
|
220
|
-
# in response to a suite method. The TestSuite can, in turn, contain
|
221
|
-
# other TestSuites or individual tests (typically created by a
|
222
|
-
# TestCase). In other words, you can easily wrap up a group of
|
223
|
-
# TestCases and TestSuites like this:
|
224
|
-
#
|
225
|
-
# require 'test/unit/testsuite'
|
226
|
-
# require 'tc_myfirsttests'
|
227
|
-
# require 'tc_moretestsbyme'
|
228
|
-
# require 'ts_anothersetoftests'
|
229
|
-
#
|
230
|
-
# class TS_MyTests
|
231
|
-
# def self.suite
|
232
|
-
# suite = Test::Unit::TestSuite.new
|
233
|
-
# suite << TC_MyFirstTests.suite
|
234
|
-
# suite << TC_MoreTestsByMe.suite
|
235
|
-
# suite << TS_AnotherSetOfTests.suite
|
236
|
-
# return suite
|
237
|
-
# end
|
238
|
-
# end
|
239
|
-
# Test::Unit::UI::Console::TestRunner.run(TS_MyTests)
|
240
|
-
#
|
241
|
-
# Now, this is a bit cumbersome, so Test::Unit does a little bit more
|
242
|
-
# for you, by wrapping these up automatically when you require
|
243
|
-
# 'test/unit'. What does this mean? It means you could write the above
|
244
|
-
# test case like this instead:
|
245
|
-
#
|
246
|
-
# require 'test/unit'
|
247
|
-
# require 'tc_myfirsttests'
|
248
|
-
# require 'tc_moretestsbyme'
|
249
|
-
# require 'ts_anothersetoftests'
|
250
|
-
#
|
251
|
-
# Test::Unit is smart enough to find all the test cases existing in
|
252
|
-
# the ObjectSpace and wrap them up into a suite for you. It then runs
|
253
|
-
# the dynamic suite using the console TestRunner.
|
254
|
-
#
|
255
|
-
#
|
256
|
-
# == Configuration file
|
257
|
-
#
|
258
|
-
# Test::Unit reads 'test-unit.yml' in the current working
|
259
|
-
# directory as Test::Unit's configuration file. It can
|
260
|
-
# contain the following configurations:
|
261
|
-
#
|
262
|
-
# * color scheme definitions
|
263
|
-
# * test runner to be used
|
264
|
-
# * test runner options
|
265
|
-
# * test collector to be used
|
266
|
-
#
|
267
|
-
# Except color scheme definitions, all of them are
|
268
|
-
# specified by command line option.
|
269
|
-
#
|
270
|
-
# Here are sample color scheme definitions:
|
271
|
-
#
|
272
|
-
# color_schemes:
|
273
|
-
# inverted:
|
274
|
-
# success:
|
275
|
-
# name: red
|
276
|
-
# bold: true
|
277
|
-
# failure:
|
278
|
-
# name: green
|
279
|
-
# bold: true
|
280
|
-
# other_scheme:
|
281
|
-
# ...
|
282
|
-
#
|
283
|
-
# Here are the syntax of color scheme definitions:
|
284
|
-
#
|
285
|
-
# color_schemes:
|
286
|
-
# SCHEME_NAME:
|
287
|
-
# EVENT_NAME:
|
288
|
-
# name: COLOR_NAME
|
289
|
-
# intensity: BOOLEAN
|
290
|
-
# bold: BOOLEAN
|
291
|
-
# italic: BOOLEAN
|
292
|
-
# underline: BOOLEAN
|
293
|
-
# ...
|
294
|
-
# ...
|
295
|
-
#
|
296
|
-
# SCHEME_NAME:: the name of the color scheme
|
297
|
-
# EVENT_NAME:: one of [success, failure, pending,
|
298
|
-
# omission, notification, error]
|
299
|
-
# COLOR_NAME:: one of [black, red, green, yellow, blue,
|
300
|
-
# magenta, cyan, white]
|
301
|
-
# BOOLEAN:: true or false
|
302
|
-
#
|
303
|
-
# You can use the above 'inverted' color scheme with the
|
304
|
-
# following configuration:
|
305
|
-
#
|
306
|
-
# runner: console
|
307
|
-
# console_options:
|
308
|
-
# color_scheme: inverted
|
309
|
-
# color_schemes:
|
310
|
-
# inverted:
|
311
|
-
# success:
|
312
|
-
# name: red
|
313
|
-
# bold: true
|
314
|
-
# failure:
|
315
|
-
# name: green
|
316
|
-
# bold: true
|
317
|
-
#
|
318
|
-
# == Questions?
|
319
|
-
#
|
320
|
-
# I'd really like to get feedback from all levels of Ruby
|
321
|
-
# practitioners about typos, grammatical errors, unclear statements,
|
322
|
-
# missing points, etc., in this document (or any other).
|
323
|
-
#
|
324
|
-
|
325
|
-
module Unit
|
326
|
-
# If set to false Test::Unit will not automatically run at exit.
|
327
|
-
def self.run=(flag)
|
328
|
-
@run = flag
|
329
|
-
end
|
330
|
-
|
331
|
-
# Automatically run tests at exit?
|
332
|
-
def self.run?
|
333
|
-
@run ||= false
|
334
|
-
end
|
335
|
-
end
|
336
|
-
end
|
337
|
-
|
338
|
-
at_exit do
|
339
|
-
unless $! || Test::Unit.run?
|
340
|
-
exit Test::Unit::AutoRunner.run
|
341
|
-
end
|
342
|
-
end
|