test-unit-context 0.1.0
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.
- data/.gitignore +13 -0
- data/Gemfile +3 -0
- data/LICENSE +201 -0
- data/README.md +98 -0
- data/Rakefile +11 -0
- data/lib/test/unit/context.rb +75 -0
- data/lib/test/unit/context/helpers.rb +23 -0
- data/lib/test/unit/context/shared.rb +96 -0
- data/lib/test/unit/context/version.rb +7 -0
- data/test-unit-context.gemspec +26 -0
- data/test/test/unit/context/hooks_test.rb +239 -0
- data/test/test/unit/context/shared_test.rb +139 -0
- data/test/test/unit/context_test.rb +71 -0
- data/test/test_helper.rb +8 -0
- metadata +94 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright (c) 2012 Karol Bucek
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Test::Unit::Context
|
|
2
|
+
|
|
3
|
+
Makes `Test::Unit::TestCase` 'context-able' and thus (subjectively - hopefully)
|
|
4
|
+
much easier to read and write. If you have ever seen RSpec than it's the very
|
|
5
|
+
same *context do ... end* re-invented for **Test::Unit**.
|
|
6
|
+
|
|
7
|
+
Inspired by [gem 'context'](https://github.com/jm/context) that does the same
|
|
8
|
+
for the good 'old' test-unit 1.2.3 bundled with Ruby 1.8.x standard libraries.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Add it to your application's *Gemfile* (along with **test-unit**) e.g. :
|
|
13
|
+
|
|
14
|
+
group :test do
|
|
15
|
+
gem 'test-unit'
|
|
16
|
+
gem 'test-unit-context'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Or install it yourself, if you're not using Bundler :
|
|
20
|
+
|
|
21
|
+
$ gem install test-unit-context
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
# NOTE: do not run try running this at home!
|
|
27
|
+
class ChuckNorrisTest < Test::Unit::TestCase
|
|
28
|
+
|
|
29
|
+
setup do
|
|
30
|
+
@subject = ChuckNorris.new
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
test "can be divided by zero"
|
|
34
|
+
assert_equal @subject * 2, @subject / 0
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
context 'frozen' do
|
|
38
|
+
|
|
39
|
+
setup { @subject.freeze }
|
|
40
|
+
|
|
41
|
+
test "won't answer" do
|
|
42
|
+
assert_raise NoMemoryError do
|
|
43
|
+
@subject.frozen?
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
test "sqrt works"
|
|
48
|
+
assert_nothing_raised do
|
|
49
|
+
Math.sqrt -2
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
shared 'elementary math facts' do
|
|
56
|
+
|
|
57
|
+
test "square root is rational"
|
|
58
|
+
assert_kind_of Rational, Math.sqrt(@subject)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
test "greater than infinity"
|
|
62
|
+
assert @infinity < @subject
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
setup
|
|
68
|
+
def create_infinity
|
|
69
|
+
@infinity = 1 / 0.0
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
uses 'elementary math facts'
|
|
75
|
+
|
|
76
|
+
context 'cloned' do
|
|
77
|
+
|
|
78
|
+
setup do
|
|
79
|
+
@subject = @subject.clone
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
test 'is Arnold Schwarzenegger' do
|
|
83
|
+
assert_instance_of Terminator, @subject
|
|
84
|
+
assert_nil @subject.is_a?(ChuckNorris)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
like 'elementary math facts'
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Copyright
|
|
96
|
+
|
|
97
|
+
Copyright (c) 2012 [Karol Bucek](https://github.com/kares).
|
|
98
|
+
See LICENSE (http://www.apache.org/licenses/LICENSE-2.0) for details.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
require "test/unit"
|
|
2
|
+
require "test/unit/context/helpers"
|
|
3
|
+
require "test/unit/context/version"
|
|
4
|
+
|
|
5
|
+
module Test
|
|
6
|
+
module Unit
|
|
7
|
+
module Context
|
|
8
|
+
|
|
9
|
+
def context_name #:nodoc:
|
|
10
|
+
@context_name ||= ""
|
|
11
|
+
if superclass.respond_to?(:context_name)
|
|
12
|
+
return "#{superclass.context_name} #{@context_name}".gsub(/^\s+/, "")
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def context_name=(val) #:nodoc:
|
|
17
|
+
@context_name = val
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Add a context to a set of tests.
|
|
21
|
+
#
|
|
22
|
+
# context "A new account" do
|
|
23
|
+
# test "does not have users"
|
|
24
|
+
# assert Account.new.users.empty?
|
|
25
|
+
# end
|
|
26
|
+
# end
|
|
27
|
+
#
|
|
28
|
+
# The context name is prepended to the test name, so failures look like this:
|
|
29
|
+
#
|
|
30
|
+
# 1) Failure:
|
|
31
|
+
# test_a_new_account_does_not_have_users() [./test/test_accounts.rb:4]:
|
|
32
|
+
# <false> is not true.
|
|
33
|
+
#
|
|
34
|
+
# Contexts can also be nested like so:
|
|
35
|
+
#
|
|
36
|
+
# context "A new account" do
|
|
37
|
+
# context "created from the web application" do
|
|
38
|
+
# test "has web as its vendor" do
|
|
39
|
+
# assert_equal "web", users(:web_user).vendor
|
|
40
|
+
# end
|
|
41
|
+
# end
|
|
42
|
+
# end
|
|
43
|
+
#
|
|
44
|
+
def context(name, &block)
|
|
45
|
+
klass = Class.new(self)
|
|
46
|
+
klass.context_name = name
|
|
47
|
+
# NOTE: make sure by default we run "inherited" setup/teardown hooks
|
|
48
|
+
# unless context code does re-define the hook method e.g. `def setup`
|
|
49
|
+
# instead of using the `setup do` or the setup method marker syntax :
|
|
50
|
+
klass.class_eval do
|
|
51
|
+
def setup; super; end
|
|
52
|
+
def cleanup; super; end
|
|
53
|
+
def teardown; super; end
|
|
54
|
+
end
|
|
55
|
+
klass.class_eval(&block)
|
|
56
|
+
|
|
57
|
+
#@@context_list << klass # make sure it's not GC-ed ?!
|
|
58
|
+
class_name = Helpers.to_class_name(name)
|
|
59
|
+
const_set("Test#{class_name}#{klass.object_id.abs}", klass)
|
|
60
|
+
klass
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
%w( contexts group ).each { |m| alias_method m, :context }
|
|
64
|
+
|
|
65
|
+
#@@context_list = []
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
Test::Unit::TestCase.extend Test::Unit::Context
|
|
72
|
+
|
|
73
|
+
require "test/unit/context/shared"
|
|
74
|
+
|
|
75
|
+
Test::Unit::TestCase.extend Test::Unit::Context::Shared
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Test::Unit::Context
|
|
2
|
+
module Helpers
|
|
3
|
+
|
|
4
|
+
module_function
|
|
5
|
+
|
|
6
|
+
# Replaces spaces and tabs with _ so we can use the string as a method name
|
|
7
|
+
# Also replace dangerous punctuation
|
|
8
|
+
def to_method_name(str)
|
|
9
|
+
str.downcase.gsub(/[\s:',\.~;!#=\(\)&]+/,'_')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Borrowed from +camelize+ in ActiveSupport
|
|
13
|
+
def to_module_name(str)
|
|
14
|
+
to_method_name(str).gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Borrowed from +camelize+ in ActiveSupport
|
|
18
|
+
def to_class_name(str)
|
|
19
|
+
to_method_name(str).gsub(/\/(.?)/) { "#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
module Test::Unit::Context
|
|
2
|
+
module Shared
|
|
3
|
+
|
|
4
|
+
# Share behavior among different contexts.
|
|
5
|
+
# This creates a module (actually, a Module subclass) that is included
|
|
6
|
+
# using the +use+ method (or one of its aliases) provided by context (or
|
|
7
|
+
# +include+ if you know the module's constant name).
|
|
8
|
+
#
|
|
9
|
+
# ==== Examples
|
|
10
|
+
#
|
|
11
|
+
# shared "aasome-things" do
|
|
12
|
+
# test "does some thing" do
|
|
13
|
+
# # some-thing is awesome
|
|
14
|
+
# end
|
|
15
|
+
# end
|
|
16
|
+
#
|
|
17
|
+
# like "aasome-things"
|
|
18
|
+
# # or
|
|
19
|
+
# use "aasome-things"
|
|
20
|
+
#
|
|
21
|
+
# share_as :client do
|
|
22
|
+
# test "is a client to our server" do
|
|
23
|
+
# # ...
|
|
24
|
+
# end
|
|
25
|
+
# end
|
|
26
|
+
#
|
|
27
|
+
# like_a :client
|
|
28
|
+
# # or
|
|
29
|
+
# uses "client"
|
|
30
|
+
#
|
|
31
|
+
def shared(name, &block)
|
|
32
|
+
if ! name.is_a?(String) && ! name.is_a?(Symbol)
|
|
33
|
+
raise ArgumentError, "use a String or Symbol as the name e.g. " +
|
|
34
|
+
"`shared #{name.to_s.inspect} do ...`"
|
|
35
|
+
end
|
|
36
|
+
module_name = Helpers.to_module_name(name.to_s)
|
|
37
|
+
Object.const_set(module_name, Behavior.create(block))
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
%w( share_as ).each { |m| alias_method m, :shared }
|
|
41
|
+
|
|
42
|
+
# Pull in behavior shared by +shared+ or a module.
|
|
43
|
+
#
|
|
44
|
+
# ==== Examples
|
|
45
|
+
#
|
|
46
|
+
# shared "awesome things" do
|
|
47
|
+
# test "does some thing" do
|
|
48
|
+
# # some-thing is awesome
|
|
49
|
+
# end
|
|
50
|
+
# end
|
|
51
|
+
#
|
|
52
|
+
# like "awesome things"
|
|
53
|
+
#
|
|
54
|
+
# module AwesomeThings
|
|
55
|
+
# # ...
|
|
56
|
+
# end
|
|
57
|
+
#
|
|
58
|
+
# uses AwesomeThings
|
|
59
|
+
#
|
|
60
|
+
def like(shared_name)
|
|
61
|
+
case shared_name
|
|
62
|
+
when String
|
|
63
|
+
module_name = Helpers.to_module_name(shared_name)
|
|
64
|
+
include Object.const_get(module_name)
|
|
65
|
+
when Symbol
|
|
66
|
+
module_name = Helpers.to_module_name(shared_name.to_s)
|
|
67
|
+
include Object.const_get(module_name)
|
|
68
|
+
when Module, Behavior
|
|
69
|
+
include shared_name
|
|
70
|
+
else
|
|
71
|
+
raise ArgumentError, "pass a String or Symbol as the name e.g. " +
|
|
72
|
+
"`like #{shared_name.to_s.inspect} do ...`"
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
%w( like_a use uses ).each { |m| alias_method m, :like }
|
|
77
|
+
|
|
78
|
+
class Behavior < Module
|
|
79
|
+
|
|
80
|
+
def self.create(block) # :nodoc:
|
|
81
|
+
self.new(block)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def initialize(block)
|
|
85
|
+
super()
|
|
86
|
+
@_block = block
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def included(klass) # :nodoc:
|
|
90
|
+
klass.class_eval(&@_block) # @_block.call
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
+
require 'test/unit/context/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |gem|
|
|
6
|
+
gem.name = "test-unit-context"
|
|
7
|
+
gem.version = Test::Unit::Context::VERSION
|
|
8
|
+
gem.authors = ["kares"]
|
|
9
|
+
gem.email = ["self@kares.org"]
|
|
10
|
+
|
|
11
|
+
gem.summary = %q{Context for Test::Unit (2.x)}
|
|
12
|
+
gem.description = %q{Makes Test::Unit::TestCases 'contextable' and thus much
|
|
13
|
+
easier to read and write. If you've seen RSpec than it's the very same 'context
|
|
14
|
+
do ... end' re-invendet for Test::Unit. Inspired by gem 'context' that does the
|
|
15
|
+
same for the 'old' Test::Unit 1.2.3 bundled with Ruby 1.8.x standard libraries.}
|
|
16
|
+
gem.homepage = "http://github.com/kares/test-unit-context"
|
|
17
|
+
|
|
18
|
+
gem.require_paths = ["lib"]
|
|
19
|
+
gem.files = `git ls-files`.split("\n")
|
|
20
|
+
gem.test_files = `git ls-files -- {test}/*`.split("\n")
|
|
21
|
+
|
|
22
|
+
gem.extra_rdoc_files = %w[ README.md LICENSE ]
|
|
23
|
+
|
|
24
|
+
gem.add_dependency 'test-unit', '>= 2.4.0'
|
|
25
|
+
gem.add_development_dependency 'rake'
|
|
26
|
+
end
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
require File.expand_path('../../../test_helper', File.dirname(__FILE__))
|
|
2
|
+
|
|
3
|
+
module Test::Unit::Context
|
|
4
|
+
class TestHooks < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
class << self; alias_method :it, :test; end
|
|
7
|
+
|
|
8
|
+
setup do
|
|
9
|
+
@inherited_before_each_var ||= 0
|
|
10
|
+
@inherited_before_each_var += 1
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
attr_reader :inherited_before_each_var
|
|
14
|
+
|
|
15
|
+
def setup
|
|
16
|
+
@inherited_before_each_var ||= 0
|
|
17
|
+
@inherited_before_each_var_2 ||= 0
|
|
18
|
+
@inherited_before_each_var += 2
|
|
19
|
+
@inherited_before_each_var_2 += 1
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
attr_reader :inherited_before_each_var_2
|
|
23
|
+
|
|
24
|
+
def teardown
|
|
25
|
+
@inherited_after_each_var ||= 0
|
|
26
|
+
@inherited_after_each_var += 1
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
attr_reader :inherited_after_each_var
|
|
30
|
+
|
|
31
|
+
startup do
|
|
32
|
+
@inherited_before_all_var ||= 0
|
|
33
|
+
@inherited_before_all_var += 1
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
attr_reader :inherited_before_all_var
|
|
37
|
+
|
|
38
|
+
shutdown do
|
|
39
|
+
@inherited_after_all_var ||= 0
|
|
40
|
+
@inherited_after_all_var += 1
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
attr_reader :inherited_after_all_var
|
|
44
|
+
|
|
45
|
+
SAMPLE_TEST = context "hooks" do
|
|
46
|
+
|
|
47
|
+
setup do
|
|
48
|
+
@inherited_before_each_var ||= 0
|
|
49
|
+
@inherited_before_each_var += 4
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
teardown do
|
|
53
|
+
@after_each_var ||= 0
|
|
54
|
+
@after_each_var += 1
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
attr_reader :after_each_var
|
|
58
|
+
|
|
59
|
+
teardown :a_method
|
|
60
|
+
|
|
61
|
+
test "foo" do
|
|
62
|
+
assert :foo
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
setup
|
|
68
|
+
def a_setup
|
|
69
|
+
@superclass_before_each_var ||= 0
|
|
70
|
+
@superclass_before_each_var += 1
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
attr_reader :superclass_before_each_var
|
|
74
|
+
|
|
75
|
+
teardown
|
|
76
|
+
def a_teardown
|
|
77
|
+
@superclass_after_each_var ||= 0
|
|
78
|
+
@superclass_after_each_var += 1
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
attr_reader :superclass_after_each_var
|
|
82
|
+
|
|
83
|
+
context "with (inherited) setup/teadown hooks" do
|
|
84
|
+
|
|
85
|
+
it "runs superclass before callbacks in order" do
|
|
86
|
+
assert_equal 1, @test.superclass_before_each_var
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it "runs inherited before callbacks in order" do
|
|
90
|
+
assert_equal 7, @test.inherited_before_each_var
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it "runs before callbacks in order" do
|
|
94
|
+
assert_equal 1, @test.inherited_before_each_var_2
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it "runs superclass after callbacks" do
|
|
98
|
+
assert_equal 1, @test.superclass_after_each_var
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it "runs inherited after callbacks" do
|
|
102
|
+
assert_equal 1, @test.inherited_after_each_var
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it "runs after callbacks" do
|
|
106
|
+
assert_equal 1, @test.after_each_var
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it "runs after callbacks specified with method names, instead of blocks" do
|
|
110
|
+
assert_equal "a method ran", @test.ivar
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
setup do
|
|
114
|
+
@result = Test::Unit::TestResult.new
|
|
115
|
+
@test = SAMPLE_TEST.new("test: hooks foo")
|
|
116
|
+
@test.run(@result) { |inherited_after_each_var, v| }
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
context "with redefined setup/teadown methods" do
|
|
122
|
+
|
|
123
|
+
SAMPLE_TEST.class_eval do
|
|
124
|
+
OLD_SETUP = instance_method(:setup)
|
|
125
|
+
OLD_TEARDOWN = instance_method(:teardown)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
setup do
|
|
129
|
+
SAMPLE_TEST.class_eval do
|
|
130
|
+
def setup
|
|
131
|
+
@superclass_before_each_var ||= 0
|
|
132
|
+
@inherited_before_each_var_2 ||= 9
|
|
133
|
+
end
|
|
134
|
+
def teardown
|
|
135
|
+
@superclass_after_each_var ||= 0
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
@result = Test::Unit::TestResult.new
|
|
140
|
+
@test = SAMPLE_TEST.new("test: hooks foo")
|
|
141
|
+
@test.run(@result) { |inherited_after_each_var, v| }
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
teardown do
|
|
145
|
+
SAMPLE_TEST.class_eval do
|
|
146
|
+
remove_method :setup
|
|
147
|
+
remove_method :teardown
|
|
148
|
+
|
|
149
|
+
define_method(:setup, OLD_SETUP)
|
|
150
|
+
define_method(:teardown, OLD_TEARDOWN)
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
it "runs superclass before callbacks" do
|
|
155
|
+
assert_equal 1, @test.superclass_before_each_var
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
it "runs superclass after callbacks" do
|
|
159
|
+
assert_equal 1, @test.superclass_after_each_var
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
it "does not run inherited (re-defined) setup method" do
|
|
163
|
+
assert_equal 9, @test.inherited_before_each_var_2
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
it "runs inherited before callbacks (except previous setup method)" do
|
|
167
|
+
assert_equal 5, @test.inherited_before_each_var
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# test that we aren't stomping on defined setup method
|
|
173
|
+
context "with setup/teardown methods" do
|
|
174
|
+
|
|
175
|
+
setup
|
|
176
|
+
def custom_setup
|
|
177
|
+
@result = Test::Unit::TestResult.new
|
|
178
|
+
@test = SAMPLE_TEST.new("test: hooks foo")
|
|
179
|
+
|
|
180
|
+
@test.class.setup do
|
|
181
|
+
@one = 1
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
@test.class.teardown do
|
|
185
|
+
@two = 10
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
@test.run(@result) { |inherited_after_each_var, v| }
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
SAMPLE_TEST.class_eval { attr_reader :one, :two }
|
|
192
|
+
|
|
193
|
+
it "runs setup method block a la Shoulda" do
|
|
194
|
+
assert_equal 1, @test.one
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
it "runs setup method block and regular callbacks" do
|
|
198
|
+
assert_equal 7, @test.inherited_before_each_var
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
it "runs teardown method block a la Shoulda" do
|
|
202
|
+
assert_equal 10, @test.two
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
it "runs teardown method block and regular callbacks" do
|
|
206
|
+
assert_equal 1, @test.after_each_var
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def self.startup
|
|
212
|
+
@superclass_before_all_var ||= 0
|
|
213
|
+
@superclass_before_all_var += 1
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def self.shutdown
|
|
217
|
+
@superclass_after_all_var ||= 0
|
|
218
|
+
@superclass_after_all_var += 1
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
context "To be compatible with rails' expectations" do
|
|
222
|
+
setup :a_method
|
|
223
|
+
|
|
224
|
+
test "should accept a symbol for an argument to setup and run that method at setup time" do
|
|
225
|
+
assert_equal "a method ran", @ivar
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
protected
|
|
230
|
+
|
|
231
|
+
attr_reader :ivar
|
|
232
|
+
|
|
233
|
+
def a_method
|
|
234
|
+
@ivar = "a method ran"
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
end
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
require File.expand_path('../../../test_helper', File.dirname(__FILE__))
|
|
2
|
+
|
|
3
|
+
module Test::Unit::Context
|
|
4
|
+
class SharedTest < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
def test_shared_aliases
|
|
7
|
+
#%w(shared_behavior share_as share_behavior_as shared_examples_for).each do |method_alias|
|
|
8
|
+
#assert self.class.respond_to?(method_alias.to_sym)
|
|
9
|
+
#end
|
|
10
|
+
assert self.class.respond_to?(:shared)
|
|
11
|
+
assert self.class.respond_to?(:share_as)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_like_aliases
|
|
15
|
+
#%w(uses it_should_behave_like behaves_like uses_examples_from).each do |method_alias|
|
|
16
|
+
#assert self.class.respond_to?(method_alias.to_sym)
|
|
17
|
+
#end
|
|
18
|
+
assert self.class.respond_to? :like
|
|
19
|
+
assert self.class.respond_to? :use
|
|
20
|
+
assert self.class.respond_to? :uses
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class << self; alias_method :it, :test; end
|
|
24
|
+
|
|
25
|
+
context "A shared group" do
|
|
26
|
+
context "creates a module" do
|
|
27
|
+
test "based on a string name" do
|
|
28
|
+
self.class.shared "things and fun" do
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
assert Object.const_get(:ThingsAndFun)
|
|
32
|
+
assert_equal Shared::Behavior, Object.const_get(:ThingsAndFun).class
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "based on a symbol name" do
|
|
36
|
+
self.class.shared :fun_and_games do
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
assert Object.const_get(:FunAndGames)
|
|
40
|
+
assert_equal Shared::Behavior, Object.const_get(:FunAndGames).class
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "unless the name is not a String or Symbol" do
|
|
44
|
+
assert_raise ArgumentError do
|
|
45
|
+
self.class.shared StandardError do
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
context "should be locatable" do
|
|
52
|
+
shared "hello sir" do
|
|
53
|
+
def amazing!
|
|
54
|
+
puts "back off!"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "by a symbol" do
|
|
59
|
+
assert_nothing_raised do
|
|
60
|
+
self.class.use :hello_sir
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
shared "hello madam" do
|
|
65
|
+
def fantastic!
|
|
66
|
+
puts "you know me!"
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "by a string" do
|
|
71
|
+
assert_nothing_raised do
|
|
72
|
+
self.class.use "hello madam"
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
shared "hi dog" do
|
|
77
|
+
def stupendous!
|
|
78
|
+
puts "hoo hah!"
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it "by direct reference" do
|
|
83
|
+
assert_nothing_raised do
|
|
84
|
+
self.class.use HiDog
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
context "should include its shared behavior" do
|
|
90
|
+
shared "Athos" do
|
|
91
|
+
test "en_garde" do
|
|
92
|
+
true
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
test "no en_garde" do
|
|
97
|
+
assert_raise NoMethodError do
|
|
98
|
+
send("test: en_garde")
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
context 'use by a symbol' do
|
|
103
|
+
|
|
104
|
+
like :athos
|
|
105
|
+
|
|
106
|
+
test "athos" do
|
|
107
|
+
assert_nothing_raised do
|
|
108
|
+
send("test: en_garde")
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
shared "Porthos" do
|
|
115
|
+
def parry!
|
|
116
|
+
true
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
test "by a string" do
|
|
121
|
+
self.class.use "Porthos"
|
|
122
|
+
assert parry!
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
shared "Aramis" do
|
|
126
|
+
def lunge!
|
|
127
|
+
true
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
test "by direct reference" do
|
|
132
|
+
self.class.uses Aramis
|
|
133
|
+
assert lunge!
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
require File.expand_path('../../test_helper', File.dirname(__FILE__))
|
|
2
|
+
|
|
3
|
+
module Test::Unit
|
|
4
|
+
class TestContext < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
def test_test_without_context
|
|
7
|
+
assert true
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
test "another test without a context" do
|
|
11
|
+
assert true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_context_aliases
|
|
15
|
+
assert self.class.respond_to? :context
|
|
16
|
+
assert self.class.respond_to? :contexts
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
context "A new context" do
|
|
20
|
+
|
|
21
|
+
context "when not nested" do
|
|
22
|
+
setup do
|
|
23
|
+
@context =
|
|
24
|
+
Class.new(Test::Unit::TestCase).
|
|
25
|
+
context("When testing") do
|
|
26
|
+
def test_this_thing
|
|
27
|
+
true
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
test "should set the context name" do
|
|
33
|
+
assert_equal "When testing", @context.context_name
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
test "should be a Test::Unit::TestCase" do
|
|
37
|
+
assert @context.ancestors.include?(Test::Unit::TestCase)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
context "when nested" do
|
|
43
|
+
|
|
44
|
+
setup do
|
|
45
|
+
@context = self.class.context("and we're testing") do
|
|
46
|
+
def self.nested
|
|
47
|
+
@nested
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
@nested = context "should be nested" do
|
|
51
|
+
def test_this_thing
|
|
52
|
+
true
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
test "should set a nested context's name" do
|
|
59
|
+
assert_equal "A new context when nested and we're testing should be nested", @context.nested.context_name
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
test "should also be a Test::Unit::TestCase" do
|
|
63
|
+
assert @context.nested.ancestors.include?(Test::Unit::TestCase)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: test-unit-context
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
prerelease:
|
|
5
|
+
version: 0.1.0
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- kares
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
|
|
13
|
+
date: 2012-10-10 00:00:00 Z
|
|
14
|
+
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
16
|
+
name: test-unit
|
|
17
|
+
prerelease: false
|
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
19
|
+
none: false
|
|
20
|
+
requirements:
|
|
21
|
+
- - ">="
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: 2.4.0
|
|
24
|
+
type: :runtime
|
|
25
|
+
version_requirements: *id001
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: rake
|
|
28
|
+
prerelease: false
|
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
30
|
+
none: false
|
|
31
|
+
requirements:
|
|
32
|
+
- - ">="
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: "0"
|
|
35
|
+
type: :development
|
|
36
|
+
version_requirements: *id002
|
|
37
|
+
description: |-
|
|
38
|
+
Makes Test::Unit::TestCases 'contextable' and thus much
|
|
39
|
+
easier to read and write. If you've seen RSpec than it's the very same 'context
|
|
40
|
+
do ... end' re-invendet for Test::Unit. Inspired by gem 'context' that does the
|
|
41
|
+
same for the 'old' Test::Unit 1.2.3 bundled with Ruby 1.8.x standard libraries.
|
|
42
|
+
email:
|
|
43
|
+
- self@kares.org
|
|
44
|
+
executables: []
|
|
45
|
+
|
|
46
|
+
extensions: []
|
|
47
|
+
|
|
48
|
+
extra_rdoc_files:
|
|
49
|
+
- README.md
|
|
50
|
+
- LICENSE
|
|
51
|
+
files:
|
|
52
|
+
- .gitignore
|
|
53
|
+
- Gemfile
|
|
54
|
+
- LICENSE
|
|
55
|
+
- README.md
|
|
56
|
+
- Rakefile
|
|
57
|
+
- lib/test/unit/context.rb
|
|
58
|
+
- lib/test/unit/context/helpers.rb
|
|
59
|
+
- lib/test/unit/context/shared.rb
|
|
60
|
+
- lib/test/unit/context/version.rb
|
|
61
|
+
- test-unit-context.gemspec
|
|
62
|
+
- test/test/unit/context/hooks_test.rb
|
|
63
|
+
- test/test/unit/context/shared_test.rb
|
|
64
|
+
- test/test/unit/context_test.rb
|
|
65
|
+
- test/test_helper.rb
|
|
66
|
+
homepage: http://github.com/kares/test-unit-context
|
|
67
|
+
licenses: []
|
|
68
|
+
|
|
69
|
+
post_install_message:
|
|
70
|
+
rdoc_options: []
|
|
71
|
+
|
|
72
|
+
require_paths:
|
|
73
|
+
- lib
|
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
|
+
none: false
|
|
76
|
+
requirements:
|
|
77
|
+
- - ">="
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: "0"
|
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
|
+
none: false
|
|
82
|
+
requirements:
|
|
83
|
+
- - ">="
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: "0"
|
|
86
|
+
requirements: []
|
|
87
|
+
|
|
88
|
+
rubyforge_project:
|
|
89
|
+
rubygems_version: 1.8.15
|
|
90
|
+
signing_key:
|
|
91
|
+
specification_version: 3
|
|
92
|
+
summary: Context for Test::Unit (2.x)
|
|
93
|
+
test_files: []
|
|
94
|
+
|