activeldap 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. data/CHANGES +10 -0
  2. data/README +3 -2
  3. data/data/locale/en/LC_MESSAGES/active-ldap.mo +0 -0
  4. data/data/locale/ja/LC_MESSAGES/active-ldap.mo +0 -0
  5. data/examples/al-admin/po/en/al-admin.po +1 -1
  6. data/examples/al-admin/po/ja/al-admin.po +1 -1
  7. data/examples/al-admin/po/nl/al-admin.po +1 -1
  8. data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifier.rb +7 -8
  9. data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifier_helper.rb +2 -1
  10. data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_environment.rhtml +1 -1
  11. data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_request.rhtml +2 -1
  12. data/lib/active_ldap.rb +9 -3
  13. data/lib/active_ldap/action_controller/ldap_benchmarking.rb +36 -0
  14. data/lib/active_ldap/adapter/jndi.rb +1 -1
  15. data/lib/active_ldap/adapter/jndi_connection.rb +2 -1
  16. data/lib/active_ldap/association/belongs_to_many.rb +10 -2
  17. data/lib/active_ldap/association/collection.rb +10 -0
  18. data/lib/active_ldap/association/has_many_utils.rb +13 -9
  19. data/lib/active_ldap/association/has_many_wrap.rb +10 -2
  20. data/lib/active_ldap/associations.rb +3 -3
  21. data/lib/active_ldap/base.rb +95 -32
  22. data/lib/active_ldap/connection.rb +1 -1
  23. data/lib/active_ldap/distinguished_name.rb +3 -0
  24. data/lib/active_ldap/entry_attribute.rb +2 -2
  25. data/lib/active_ldap/ldif.rb +2 -2
  26. data/lib/active_ldap/operations.rb +7 -3
  27. data/lib/active_ldap/user_password.rb +0 -1
  28. data/lib/active_ldap/validations.rb +2 -0
  29. data/po/en/active-ldap.po +1 -1
  30. data/po/ja/active-ldap.po +1 -1
  31. data/rails/plugin/active_ldap/init.rb +3 -34
  32. data/test-unit/History.txt +32 -0
  33. data/test-unit/Manifest.txt +70 -0
  34. data/test-unit/README.txt +32 -0
  35. data/test-unit/Rakefile +22 -0
  36. data/test-unit/bin/testrb +5 -0
  37. data/test-unit/lib/test/unit.rb +280 -0
  38. data/test-unit/lib/test/unit/assertionfailederror.rb +14 -0
  39. data/test-unit/lib/test/unit/assertions.rb +722 -0
  40. data/test-unit/lib/test/unit/attribute.rb +125 -0
  41. data/test-unit/lib/test/unit/autorunner.rb +250 -0
  42. data/test-unit/lib/test/unit/collector.rb +43 -0
  43. data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
  44. data/test-unit/lib/test/unit/collector/dir.rb +108 -0
  45. data/test-unit/lib/test/unit/collector/load.rb +135 -0
  46. data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
  47. data/test-unit/lib/test/unit/color.rb +61 -0
  48. data/test-unit/lib/test/unit/diff.rb +524 -0
  49. data/test-unit/lib/test/unit/error.rb +124 -0
  50. data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
  51. data/test-unit/lib/test/unit/failure.rb +110 -0
  52. data/test-unit/lib/test/unit/fixture.rb +185 -0
  53. data/test-unit/lib/test/unit/notification.rb +116 -0
  54. data/test-unit/lib/test/unit/omission.rb +129 -0
  55. data/test-unit/lib/test/unit/pending.rb +130 -0
  56. data/test-unit/lib/test/unit/priority.rb +146 -0
  57. data/test-unit/lib/test/unit/runner/console.rb +46 -0
  58. data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
  59. data/test-unit/lib/test/unit/testcase.rb +174 -0
  60. data/test-unit/lib/test/unit/testresult.rb +89 -0
  61. data/test-unit/lib/test/unit/testsuite.rb +110 -0
  62. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
  63. data/test-unit/lib/test/unit/ui/console/testrunner.rb +195 -0
  64. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +49 -0
  65. data/test-unit/lib/test/unit/ui/testrunner.rb +20 -0
  66. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
  67. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
  68. data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
  69. data/test-unit/lib/test/unit/util/observable.rb +90 -0
  70. data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
  71. data/test-unit/lib/test/unit/version.rb +7 -0
  72. data/test-unit/sample/adder.rb +13 -0
  73. data/test-unit/sample/subtracter.rb +12 -0
  74. data/test-unit/sample/tc_adder.rb +18 -0
  75. data/test-unit/sample/tc_subtracter.rb +18 -0
  76. data/test-unit/sample/ts_examples.rb +7 -0
  77. data/test-unit/test/collector/test_descendant.rb +135 -0
  78. data/test-unit/test/collector/test_dir.rb +406 -0
  79. data/test-unit/test/collector/test_load.rb +333 -0
  80. data/test-unit/test/collector/test_objectspace.rb +98 -0
  81. data/test-unit/test/run-test.rb +13 -0
  82. data/test-unit/test/test_assertions.rb +693 -0
  83. data/test-unit/test/test_attribute.rb +86 -0
  84. data/{test-unit-ext → test-unit}/test/test_color.rb +3 -5
  85. data/{test-unit-ext → test-unit}/test/test_diff.rb +18 -16
  86. data/test-unit/test/test_emacs_runner.rb +60 -0
  87. data/test-unit/test/test_error.rb +26 -0
  88. data/test-unit/test/test_failure.rb +33 -0
  89. data/test-unit/test/test_fixture.rb +275 -0
  90. data/{test-unit-ext → test-unit}/test/test_notification.rb +7 -6
  91. data/test-unit/test/test_omission.rb +81 -0
  92. data/{test-unit-ext → test-unit}/test/test_pending.rb +15 -15
  93. data/{test-unit-ext → test-unit}/test/test_priority.rb +4 -3
  94. data/test-unit/test/test_testcase.rb +411 -0
  95. data/test-unit/test/test_testresult.rb +113 -0
  96. data/test-unit/test/test_testsuite.rb +129 -0
  97. data/test-unit/test/testunit_test_util.rb +12 -0
  98. data/test-unit/test/ui/test_testrunmediator.rb +20 -0
  99. data/test-unit/test/util/test_backtracefilter.rb +41 -0
  100. data/test-unit/test/util/test_observable.rb +102 -0
  101. data/test-unit/test/util/test_procwrapper.rb +36 -0
  102. data/test/al-test-utils.rb +4 -4
  103. data/test/command.rb +1 -1
  104. data/test/run-test.rb +5 -4
  105. data/test/test_associations.rb +143 -9
  106. data/test/test_base.rb +25 -1
  107. data/test/test_dn.rb +2 -0
  108. data/test/test_find.rb +8 -1
  109. data/test/test_ldif.rb +51 -114
  110. data/test/test_reflection.rb +4 -8
  111. data/test/test_usermod-lang-add.rb +2 -1
  112. data/test/test_validation.rb +4 -3
  113. metadata +76 -31
  114. data/test-unit-ext/NEWS.en +0 -28
  115. data/test-unit-ext/NEWS.ja +0 -28
  116. data/test-unit-ext/README.en +0 -247
  117. data/test-unit-ext/README.ja +0 -246
  118. data/test-unit-ext/Rakefile +0 -111
  119. data/test-unit-ext/lib/test-unit-ext.rb +0 -16
  120. data/test-unit-ext/lib/test-unit-ext/always-show-result.rb +0 -28
  121. data/test-unit-ext/lib/test-unit-ext/assertions.rb +0 -40
  122. data/test-unit-ext/lib/test-unit-ext/attributes.rb +0 -129
  123. data/test-unit-ext/lib/test-unit-ext/backtrace-filter.rb +0 -17
  124. data/test-unit-ext/lib/test-unit-ext/color.rb +0 -59
  125. data/test-unit-ext/lib/test-unit-ext/colorized-runner.rb +0 -111
  126. data/test-unit-ext/lib/test-unit-ext/diff.rb +0 -516
  127. data/test-unit-ext/lib/test-unit-ext/long-display-for-emacs.rb +0 -25
  128. data/test-unit-ext/lib/test-unit-ext/notification.rb +0 -79
  129. data/test-unit-ext/lib/test-unit-ext/omission.rb +0 -96
  130. data/test-unit-ext/lib/test-unit-ext/pending.rb +0 -97
  131. data/test-unit-ext/lib/test-unit-ext/priority.rb +0 -158
  132. data/test-unit-ext/lib/test-unit-ext/version.rb +0 -3
  133. data/test-unit-ext/lib/test-unit-ext/xml-report.rb +0 -224
  134. data/test-unit-ext/test/run-test.rb +0 -14
  135. data/test-unit-ext/test/test_attributes.rb +0 -139
  136. data/test-unit-ext/test/test_omission.rb +0 -64
  137. data/test-unit-ext/test/test_xml_report.rb +0 -161
@@ -96,15 +96,13 @@ class TestReflection < Test::Unit::TestCase
96
96
  make_temporary_user do |user, password|
97
97
  attributes = user.must.collect(&:name) + user.may.collect(&:name)
98
98
  attributes -= ["objectClass"]
99
- attributes = attributes.collect do |x|
100
- Inflector.underscore(x)
101
- end
99
+ attributes = attributes.collect(&:underscore)
102
100
  assert_equal([], attributes - user.methods)
103
101
  assert_equal([], attributes - user.methods(false))
104
102
 
105
103
  normalize_attributes_list = Proc.new do |*attributes_list|
106
104
  attributes_list.collect do |attrs|
107
- attrs.collect {|x| Inflector.underscore(x)}
105
+ attrs.collect(&:underscore)
108
106
  end
109
107
  end
110
108
  assert_methods_with_only_required_classes(user, attributes,
@@ -115,15 +113,13 @@ class TestReflection < Test::Unit::TestCase
115
113
  user.remove_class("inetOrgPerson")
116
114
  attributes = user.must.collect(&:name) + user.may.collect(&:name)
117
115
  attributes -= ["objectClass"]
118
- attributes = attributes.collect do |x|
119
- Inflector.underscore(x)
120
- end
116
+ attributes = attributes.collect(&:underscore)
121
117
  assert_equal([], attributes - user.methods)
122
118
  assert_equal([], attributes - user.methods(false))
123
119
 
124
120
  normalize_attributes_list = Proc.new do |*attributes_list|
125
121
  attributes_list.collect do |attrs|
126
- attrs.collect {|x| Inflector.underscore(x)}
122
+ attrs.collect(&:underscore)
127
123
  end
128
124
  end
129
125
  assert_methods_with_only_required_classes(user, attributes,
@@ -40,7 +40,8 @@ class TestUsermodLangAdd < Test::Unit::TestCase
40
40
 
41
41
  user = @user_class.find(name)
42
42
  assert_equal(name, user.uid)
43
- assert_equal([cn, {'lang-en-us' => cn}], user.cn)
43
+ assert_equal([cn, {'lang-en-us' => cn}].sort_by(&:inspect),
44
+ user.cn.sort_by(&:inspect))
44
45
  assert_equal(uid.to_i, user.uid_number)
45
46
  assert_equal(uid.to_i, user.gid_number)
46
47
  assert_equal(uid.to_s, user.uid_number_before_type_cast)
@@ -19,7 +19,7 @@ class TestValidation < Test::Unit::TestCase
19
19
  1) % {:fn => la_("objectClass")}
20
20
  message = format % loc_("person")
21
21
  else
22
- message = "ObjectClass has excluded value: person"
22
+ message = "objectClass has excluded value: person"
23
23
  end
24
24
  assert_equal([message], user.errors.full_messages)
25
25
  end
@@ -33,8 +33,9 @@ class TestValidation < Test::Unit::TestCase
33
33
  assert(user.save)
34
34
 
35
35
  user = user.class.find(user.dn)
36
- assert_equal([{"lang-ja" => "ユーザ"}, {"lang-en" => "User"}],
37
- user.display_name)
36
+ assert_equal([{"lang-ja" => "ユーザ"},
37
+ {"lang-en" => "User"}].sort_by {|hash| hash.keys.first},
38
+ user.display_name.sort_by {|hash| hash.keys.first})
38
39
  end
39
40
  end
40
41
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: activeldap
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.0
7
- date: 2008-05-26 00:00:00 -07:00
6
+ version: 1.0.1
7
+ date: 2008-06-15 00:00:00 -07:00
8
8
  summary: Ruby/ActiveLdap is a object-oriented API to LDAP
9
9
  require_paths:
10
10
  - lib
@@ -373,6 +373,7 @@ files:
373
373
  - examples/usermod-binary-del
374
374
  - examples/usermod-lang-add
375
375
  - lib/active_ldap.rb
376
+ - lib/active_ldap/action_controller/ldap_benchmarking.rb
376
377
  - lib/active_ldap/acts/tree.rb
377
378
  - lib/active_ldap/adapter/base.rb
378
379
  - lib/active_ldap/adapter/jndi.rb
@@ -427,36 +428,77 @@ files:
427
428
  - rails/plugin/active_ldap/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb
428
429
  - rails/plugin/active_ldap/generators/scaffold_al/scaffold_al_generator.rb
429
430
  - rails/plugin/active_ldap/init.rb
430
- - test-unit-ext/NEWS.en
431
- - test-unit-ext/NEWS.ja
432
- - test-unit-ext/README.en
433
- - test-unit-ext/README.ja
434
- - test-unit-ext/Rakefile
435
- - test-unit-ext/lib/test-unit-ext.rb
436
- - test-unit-ext/lib/test-unit-ext/always-show-result.rb
437
- - test-unit-ext/lib/test-unit-ext/assertions.rb
438
- - test-unit-ext/lib/test-unit-ext/attributes.rb
439
- - test-unit-ext/lib/test-unit-ext/backtrace-filter.rb
440
- - test-unit-ext/lib/test-unit-ext/color.rb
441
- - test-unit-ext/lib/test-unit-ext/colorized-runner.rb
442
- - test-unit-ext/lib/test-unit-ext/diff.rb
443
- - test-unit-ext/lib/test-unit-ext/long-display-for-emacs.rb
444
- - test-unit-ext/lib/test-unit-ext/notification.rb
445
- - test-unit-ext/lib/test-unit-ext/omission.rb
446
- - test-unit-ext/lib/test-unit-ext/pending.rb
447
- - test-unit-ext/lib/test-unit-ext/priority.rb
448
- - test-unit-ext/lib/test-unit-ext/version.rb
449
- - test-unit-ext/lib/test-unit-ext/xml-report.rb
450
431
  - test-unit-ext/misc/rd2html.rb
451
- - test-unit-ext/test/run-test.rb
452
- - test-unit-ext/test/test_attributes.rb
453
- - test-unit-ext/test/test_color.rb
454
- - test-unit-ext/test/test_diff.rb
455
- - test-unit-ext/test/test_notification.rb
456
- - test-unit-ext/test/test_omission.rb
457
- - test-unit-ext/test/test_pending.rb
458
- - test-unit-ext/test/test_priority.rb
459
- - test-unit-ext/test/test_xml_report.rb
432
+ - test-unit/History.txt
433
+ - test-unit/Manifest.txt
434
+ - test-unit/README.txt
435
+ - test-unit/Rakefile
436
+ - test-unit/bin/testrb
437
+ - test-unit/lib/test/unit.rb
438
+ - test-unit/lib/test/unit/assertionfailederror.rb
439
+ - test-unit/lib/test/unit/assertions.rb
440
+ - test-unit/lib/test/unit/attribute.rb
441
+ - test-unit/lib/test/unit/autorunner.rb
442
+ - test-unit/lib/test/unit/collector.rb
443
+ - test-unit/lib/test/unit/collector/descendant.rb
444
+ - test-unit/lib/test/unit/collector/dir.rb
445
+ - test-unit/lib/test/unit/collector/load.rb
446
+ - test-unit/lib/test/unit/collector/objectspace.rb
447
+ - test-unit/lib/test/unit/color.rb
448
+ - test-unit/lib/test/unit/diff.rb
449
+ - test-unit/lib/test/unit/error.rb
450
+ - test-unit/lib/test/unit/exceptionhandler.rb
451
+ - test-unit/lib/test/unit/failure.rb
452
+ - test-unit/lib/test/unit/fixture.rb
453
+ - test-unit/lib/test/unit/notification.rb
454
+ - test-unit/lib/test/unit/omission.rb
455
+ - test-unit/lib/test/unit/pending.rb
456
+ - test-unit/lib/test/unit/priority.rb
457
+ - test-unit/lib/test/unit/runner/console.rb
458
+ - test-unit/lib/test/unit/runner/emacs.rb
459
+ - test-unit/lib/test/unit/testcase.rb
460
+ - test-unit/lib/test/unit/testresult.rb
461
+ - test-unit/lib/test/unit/testsuite.rb
462
+ - test-unit/lib/test/unit/ui/console/outputlevel.rb
463
+ - test-unit/lib/test/unit/ui/console/testrunner.rb
464
+ - test-unit/lib/test/unit/ui/emacs/testrunner.rb
465
+ - test-unit/lib/test/unit/ui/testrunner.rb
466
+ - test-unit/lib/test/unit/ui/testrunnermediator.rb
467
+ - test-unit/lib/test/unit/ui/testrunnerutilities.rb
468
+ - test-unit/lib/test/unit/util/backtracefilter.rb
469
+ - test-unit/lib/test/unit/util/observable.rb
470
+ - test-unit/lib/test/unit/util/procwrapper.rb
471
+ - test-unit/lib/test/unit/version.rb
472
+ - test-unit/sample/adder.rb
473
+ - test-unit/sample/subtracter.rb
474
+ - test-unit/sample/tc_adder.rb
475
+ - test-unit/sample/tc_subtracter.rb
476
+ - test-unit/sample/ts_examples.rb
477
+ - test-unit/test/collector/test_descendant.rb
478
+ - test-unit/test/collector/test_dir.rb
479
+ - test-unit/test/collector/test_load.rb
480
+ - test-unit/test/collector/test_objectspace.rb
481
+ - test-unit/test/run-test.rb
482
+ - test-unit/test/test_assertions.rb
483
+ - test-unit/test/test_attribute.rb
484
+ - test-unit/test/test_color.rb
485
+ - test-unit/test/test_diff.rb
486
+ - test-unit/test/test_emacs_runner.rb
487
+ - test-unit/test/test_error.rb
488
+ - test-unit/test/test_failure.rb
489
+ - test-unit/test/test_fixture.rb
490
+ - test-unit/test/test_notification.rb
491
+ - test-unit/test/test_omission.rb
492
+ - test-unit/test/test_pending.rb
493
+ - test-unit/test/test_priority.rb
494
+ - test-unit/test/test_testcase.rb
495
+ - test-unit/test/test_testresult.rb
496
+ - test-unit/test/test_testsuite.rb
497
+ - test-unit/test/testunit_test_util.rb
498
+ - test-unit/test/ui/test_testrunmediator.rb
499
+ - test-unit/test/util/test_backtracefilter.rb
500
+ - test-unit/test/util/test_observable.rb
501
+ - test-unit/test/util/test_procwrapper.rb
460
502
  - test/al-test-utils.rb
461
503
  - test/command.rb
462
504
  - test/config.yaml.sample
@@ -541,6 +583,9 @@ rdoc_options:
541
583
  - lib/active_ldap.rb
542
584
  extra_rdoc_files:
543
585
  - examples/al-admin/public/robots.txt
586
+ - test-unit/History.txt
587
+ - test-unit/Manifest.txt
588
+ - test-unit/README.txt
544
589
  executables: []
545
590
 
546
591
  extensions: []
@@ -1,28 +0,0 @@
1
- # -*- rd -*-
2
-
3
- = NEWS
4
-
5
- == 0.5.0: 2008-04-07
6
-
7
- * Update document.
8
- * Support pend.
9
- * Support notify.
10
-
11
- == 0.4.0: 2008-03-17
12
-
13
- * Changed XML report format.
14
-
15
- == 0.3.0: 2008-03-10
16
-
17
- * Changed XML report format.
18
- * Improved search method to find test result directory.
19
-
20
- == 0.2.0: 2008-03-03
21
-
22
- * Supported XML report.
23
- * Added --xml-report option.
24
- * Supported diff output for assert_equal.
25
-
26
- == 0.1.0: 2008-02-21
27
-
28
- * Initial release.
@@ -1,28 +0,0 @@
1
- # -*- rd -*-
2
-
3
- = NEWS.ja
4
-
5
- == 0.5.0: 2008-04-07
6
-
7
- * ドキュメントの更新
8
- * pend(保留)のサポート
9
- * notify(通知)のサポート
10
-
11
- == 0.4.0: 2008-03-17
12
-
13
- * XML出力形式の変更
14
-
15
- == 0.3.0: 2008-03-10
16
-
17
- * XML出力形式の変更
18
- * テスト結果を保存するディレクトリの検索処理を改良
19
-
20
- == 0.2.0: 2008-03-03
21
-
22
- * XML出力のサポート。
23
- * --xml-reportオプションの追加。
24
- * assert_equal時のdiff出力のサポート。
25
-
26
- == 0.1.0: 2008-02-21
27
-
28
- * 最初のリリース。
@@ -1,247 +0,0 @@
1
- # -*- rd -*-
2
-
3
- = README
4
-
5
- == Name
6
-
7
- TestUnitExt
8
-
9
- == What's this?
10
-
11
- TestUnitExt extends the standard Test::Unit.
12
-
13
- TestUnitExt provides some useful features:
14
-
15
- * Emacs friendly backtrace format.
16
- * runs tests depending on priority.
17
- * supports attributes for each test.
18
- * always shows tests result even if tests are interrupted.
19
- * colorized output.
20
- * outputs diff between expected and actual value.
21
- * reports test result as XML format.
22
- * adds pending/omission/notification methods.
23
-
24
- == Author
25
-
26
- Kouhei Sutou <kou@cozmixng.org>
27
-
28
- == Licence
29
-
30
- Ruby's.
31
-
32
- # == Mailing list
33
- #
34
- # None. needed?
35
-
36
- == Reference manual
37
-
38
- ((<URL:http://test-unit-ext.rubyforge.org/doc/>))
39
-
40
- == Dependency libraries
41
-
42
- None
43
-
44
- == Usage
45
-
46
- require 'test-unit-ext'
47
-
48
- == Reference
49
-
50
- === Attributes
51
-
52
- You can add attributes to your test to get more useful
53
- information on failure. For example, you can add Bug ID like
54
- the following
55
-
56
- class MyTest < Test::Unit::TestCase
57
- bug 123
58
- def test_invalid_input
59
- assert_equal("OK", input)
60
- end
61
- end
62
-
63
- In the above example, test_invalid_input test has an
64
- attribute that the test is for Bug #123.
65
-
66
- You can also write like the following:
67
-
68
- class MyTest < Test::Unit::TestCase
69
- attribute :bug, 123
70
- def test_invalid_input
71
- assert_equal("OK", input)
72
- end
73
- end
74
-
75
- That is, bug method is a convenience method. You can add any
76
- attributes to your test if you use attribute method.
77
-
78
- === Priority
79
-
80
- It will be difficult that you drop into test and develop
81
- cycle when you have many tests and the tests take much
82
- time. To reduce the problem, you can select some tests from
83
- all tests and reduce elapsed time each test. It's a problem
84
- that which tests are selected in each test.
85
-
86
- In TestUnitExt, each test has its priority and runs tests
87
- are selected by probabilistic method. --priority command
88
- line option enables this feature.
89
-
90
- A test that has higher priority will be ran in higher
91
- ratio. Each test doesn't run all tests but tests that are
92
- ran each test are changed in each test. All tests will be
93
- ran after some test and develop cycles.
94
-
95
- Tests that aren't succeeded in the previous test are ran in
96
- the current test in spite of its priority. This means that
97
- important tests are ran without you do something. You will
98
- keep your lightweight test and develop cycles without
99
- additional works.
100
-
101
- Here are a sample priority specification. Priority
102
- specification effects followed tests like public and
103
- private.
104
-
105
- class MyTest < Test::Unit::TestCase
106
- priority :must
107
- def test_must
108
- # will be always ran
109
- end
110
-
111
- def test_must2
112
- # will be always ran too
113
- end
114
-
115
- priority :import
116
- def test_import
117
- # will be almost ran
118
- end
119
-
120
- priority :high
121
- def test_high
122
- # will be ran in high probability
123
- end
124
-
125
- priority :normal
126
- def test_normal
127
- # will be ran in fifty-fifty probability
128
- # tests without priority specification has normal priority
129
- end
130
-
131
- priority :low
132
- def test_low
133
- # will be sometimes ran
134
- end
135
-
136
- priority :never
137
- def test_never
138
- # never be ran
139
- end
140
- end
141
-
142
- === Pending
143
-
144
- You may write a test for a function that is not
145
- implemented. In the case, the test will be failed. It's
146
- correct that the test is failed but the test means 'the
147
- function is not implemented'. To state your intent, pend
148
- method is provided.
149
-
150
- Please state your intent by your test code by using the
151
- method.
152
-
153
- class MyTest < Test::Unit::TestCase
154
- def test_minor_function
155
- pend("Should implement")
156
- assert_equal("Good!", MyModule.minor_function)
157
- end
158
- end
159
-
160
- === Omission
161
-
162
- You may write a test only for a special environment. In the
163
- case, the test will not work on a standard environment and you
164
- know that before you run the test. You will omit the test on
165
- a standard environment. To state your intent, omit method is
166
- provided.
167
-
168
- Please state your intent by your test code by using the method.
169
-
170
- class MyTest < Test::Unit::TestCase
171
- def test_special_function
172
- omit("Only for special environment") unless MyModule.special_environment?
173
- assert_equal("Good!", MyModule.special_function)
174
- end
175
- end
176
-
177
-
178
- === Notification
179
-
180
- You may put some messages in test. For example, "this test
181
- is omitted because XXX module is not found on the
182
- environment."
183
-
184
- Those messages can be displayed by puts but it causes test
185
- result output. To prevent this, notify method is
186
- provided. notify method doesn't display those messages in
187
- the place but display those messages in test result summary
188
- like "failure", "error" and so on. You can leave those
189
- messages without breaking test result output by using notify
190
- method.
191
-
192
- class MyTest < Test::Unit::TestCase
193
- def test_with_other_module
194
- unless MyModule.have_XXX?
195
- notify("XXX module isn't found. skip this test.")
196
- return
197
- end
198
- assert_equal("XXX Module!!!", MyModule.use_XXX)
199
- end
200
- end
201
-
202
- === XML report
203
-
204
- Test result can be reported as XML format if --xml-report
205
- option is specified. A reported XML has the following
206
- structure:
207
-
208
- <report>
209
- <result>
210
- <test-case>
211
- <name>TEST CASE NAME</name>
212
- <description>DESCRIPTION OF TEST CASE (if exists)</description>
213
- </test-case>
214
- <test>
215
- <name>TEST NAME</name>
216
- <description>DESCRIPTION OF TEST CASE (if exists)</description>
217
- <option><!-- ATTRIBUTE INFORMATION (if exists) -->
218
- <name>ATTRIBUTE NAME (e.g.: bug)</name>
219
- <value>ATTRIBUTE VALUE (e.g.: 1234)</value>
220
- </option>
221
- <option>
222
- ...
223
- </option>
224
- </test>
225
- <status>TEST RESULT ([success|failure|error|pending|notification])</status>
226
- <detail>DETAIL OF TEST RESULT (if exists)</detail>
227
- <backtrace><!-- BACKTRACE (if exists) -->
228
- <entry>
229
- <file>FILE NAME</file>
230
- <line>LINE</line>
231
- <info>ADDITIONAL INFORMATION</info>
232
- </entry>
233
- <entry>
234
- ...
235
- </entry>
236
- </backtrace>
237
- <elapsed>ELAPSED TIME (e.g.: 0.000010)</elapsed>
238
- </result>
239
- <result>
240
- ...
241
- </result>
242
- ...
243
- </report>
244
-
245
- == Thanks
246
-
247
- * ...