test-unit-context 0.1.0 → 0.2.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/.travis.yml +6 -0
- data/README.md +4 -0
- data/lib/test/unit/context.rb +13 -62
- data/lib/test/unit/context/context.rb +85 -0
- data/lib/test/unit/context/helpers.rb +11 -13
- data/lib/test/unit/context/shared.rb +55 -15
- data/lib/test/unit/context/version.rb +2 -2
- data/test/test/unit/context/shared_test.rb +27 -7
- data/test/test/unit/context_test.rb +153 -36
- metadata +78 -74
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Test::Unit::Context
|
2
2
|
|
3
|
+
[![Build Status][0]](http://travis-ci.org/kares/test-unit-context)
|
4
|
+
|
3
5
|
Makes `Test::Unit::TestCase` 'context-able' and thus (subjectively - hopefully)
|
4
6
|
much easier to read and write. If you have ever seen RSpec than it's the very
|
5
7
|
same *context do ... end* re-invented for **Test::Unit**.
|
@@ -96,3 +98,5 @@ end
|
|
96
98
|
|
97
99
|
Copyright (c) 2012 [Karol Bucek](https://github.com/kares).
|
98
100
|
See LICENSE (http://www.apache.org/licenses/LICENSE-2.0) for details.
|
101
|
+
|
102
|
+
[0]: https://secure.travis-ci.org/kares/test-unit-context.png
|
data/lib/test/unit/context.rb
CHANGED
@@ -1,75 +1,26 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'test/unit'
|
2
|
+
require 'test/unit/context/helpers'
|
3
|
+
require 'test/unit/context/version'
|
4
4
|
|
5
5
|
module Test
|
6
6
|
module Unit
|
7
7
|
module Context
|
8
|
-
|
9
|
-
def context_name
|
10
|
-
@context_name ||= ""
|
8
|
+
|
9
|
+
def context_name
|
11
10
|
if superclass.respond_to?(:context_name)
|
12
|
-
|
11
|
+
"#{superclass.context_name} #{@context_name}".gsub(/^\s+/, "")
|
12
|
+
else
|
13
|
+
@context_name
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
|
-
def context_name=(
|
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 = []
|
17
|
+
def context_name=(name); @context_name=name; end
|
66
18
|
|
67
19
|
end
|
68
20
|
end
|
69
21
|
end
|
70
22
|
|
71
|
-
|
72
|
-
|
73
|
-
require
|
74
|
-
|
75
|
-
Test::Unit::TestCase.extend Test::Unit::Context::Shared
|
23
|
+
require 'test/unit/context/context'
|
24
|
+
Test::Unit::TestCase.extend Test::Unit::Context::Context
|
25
|
+
require 'test/unit/context/shared'
|
26
|
+
Test::Unit::TestCase.extend Test::Unit::Context::Shared
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
3
|
+
module Test::Unit::Context
|
4
|
+
module Context
|
5
|
+
|
6
|
+
# Add a context to a set of tests.
|
7
|
+
#
|
8
|
+
# context "A new account" do
|
9
|
+
# test "does not have users"
|
10
|
+
# assert Account.new.users.empty?
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# The context name is prepended to the test name, so failures look like this:
|
15
|
+
#
|
16
|
+
# 1) Failure:
|
17
|
+
# test_a_new_account_does_not_have_users() [./test/test_accounts.rb:4]:
|
18
|
+
# <false> is not true.
|
19
|
+
#
|
20
|
+
# Contexts can also be nested like so:
|
21
|
+
#
|
22
|
+
# context "A new account" do
|
23
|
+
# context "created from the web application" do
|
24
|
+
# test "has web as its vendor" do
|
25
|
+
# assert_equal "web", users(:web_user).vendor
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
# Context should have unique names within a given scope, otherwise they
|
31
|
+
# end-up being merged as if it where one single context declaration.
|
32
|
+
# Anonymous (un-named) contexts are supported as well - contrary they
|
33
|
+
# never get merged (a unique name is generated for each such context).
|
34
|
+
#
|
35
|
+
def context(name = nil, &block)
|
36
|
+
name ||= Helpers.generate_uuid
|
37
|
+
# context "created with defaults" ... 'ContextCreatedWithDefaults'
|
38
|
+
class_name = Helpers.to_const_name(name.to_s, 'Context')
|
39
|
+
if const_defined?(class_name)
|
40
|
+
klass = const_get(class_name)
|
41
|
+
if ( klass.superclass == self rescue nil )
|
42
|
+
warn "duplicate context definition with the name #{name.inspect} " <<
|
43
|
+
"found at #{caller.first} it is going to be merged with " <<
|
44
|
+
"the previous context definition"
|
45
|
+
else
|
46
|
+
raise "could not create a context with the name #{name.inspect} " <<
|
47
|
+
"as a constant #{class_name} is already defined and is not " <<
|
48
|
+
"another context definition"
|
49
|
+
end
|
50
|
+
else
|
51
|
+
klass = Class.new(self)
|
52
|
+
klass.extend Test::Unit::Context
|
53
|
+
klass.context_name = name
|
54
|
+
# NOTE: make sure by default we run "inherited" setup/teardown hooks
|
55
|
+
# unless context code does re-define the hook method e.g. `def setup`
|
56
|
+
# instead of using the `setup do` or the setup method marker syntax :
|
57
|
+
klass.class_eval do
|
58
|
+
def setup; super; end
|
59
|
+
def cleanup; super; end
|
60
|
+
def teardown; super; end
|
61
|
+
end
|
62
|
+
const_set(class_name, klass)
|
63
|
+
end
|
64
|
+
context_definitions << klass
|
65
|
+
klass.class_eval(&block)
|
66
|
+
klass
|
67
|
+
end
|
68
|
+
|
69
|
+
%w( contexts group ).each { |m| alias_method m, :context }
|
70
|
+
|
71
|
+
def context_definitions(nested = false)
|
72
|
+
@_context_definitions ||= []
|
73
|
+
if nested
|
74
|
+
contexts = @_context_definitions.dup
|
75
|
+
@_context_definitions.each do |context|
|
76
|
+
contexts.push *context.context_definitions(nested)
|
77
|
+
end
|
78
|
+
contexts
|
79
|
+
else
|
80
|
+
@_context_definitions
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
@@ -3,20 +3,18 @@ module Test::Unit::Context
|
|
3
3
|
|
4
4
|
module_function
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
def to_const_name(str, prefix = nil)
|
7
|
+
name = prefix ? str.dup : str.lstrip
|
8
|
+
name.gsub!(/[\s:',\.~;!#=\(\)&]+/, '_')
|
9
|
+
name.gsub!(/\/(.?)/) { $1.upcase }
|
10
|
+
name.gsub!(/(?:^|_)(.)/) { $1.upcase }
|
11
|
+
prefix ? "#{prefix}#{name}" : name
|
10
12
|
end
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
# Borrowed from +camelize+ in ActiveSupport
|
18
|
-
def to_class_name(str)
|
19
|
-
to_method_name(str).gsub(/\/(.?)/) { "#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
13
|
+
|
14
|
+
def generate_uuid
|
15
|
+
uuid = [ (Time.now.to_f * 1000).to_i % 10 ]
|
16
|
+
15.times { uuid << rand(16).to_s(16) }
|
17
|
+
uuid.join
|
20
18
|
end
|
21
19
|
|
22
20
|
end
|
@@ -33,8 +33,30 @@ module Test::Unit::Context
|
|
33
33
|
raise ArgumentError, "use a String or Symbol as the name e.g. " +
|
34
34
|
"`shared #{name.to_s.inspect} do ...`"
|
35
35
|
end
|
36
|
-
|
37
|
-
|
36
|
+
const_name = Helpers.to_const_name(name.to_s)
|
37
|
+
if Behavior.const_defined?(const_name)
|
38
|
+
const = Behavior.const_get(const_name)
|
39
|
+
if Behavior === const
|
40
|
+
raise "duplicate shared definition with the name #{name.inspect} " <<
|
41
|
+
"found at #{caller.first} please provide an unique name"
|
42
|
+
else
|
43
|
+
raise "could not create a shared definition with the name " <<
|
44
|
+
"#{name.inspect} as a constant #{Behavior.name}::#{const_name} " <<
|
45
|
+
"already exists"
|
46
|
+
end
|
47
|
+
else
|
48
|
+
behavior = Behavior.new(name, block)
|
49
|
+
Behavior.const_set(const_name, behavior)
|
50
|
+
# expose at current top-level test-case as a constant as well :
|
51
|
+
test_case = self
|
52
|
+
while test_case.is_a?(Test::Unit::Context)
|
53
|
+
test_case = test_case.superclass
|
54
|
+
end
|
55
|
+
unless test_case.const_defined?(const_name)
|
56
|
+
test_case.const_set(const_name, behavior)
|
57
|
+
end
|
58
|
+
behavior
|
59
|
+
end
|
38
60
|
end
|
39
61
|
|
40
62
|
%w( share_as ).each { |m| alias_method m, :shared }
|
@@ -59,13 +81,20 @@ module Test::Unit::Context
|
|
59
81
|
#
|
60
82
|
def like(shared_name)
|
61
83
|
case shared_name
|
62
|
-
when String
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
84
|
+
when String, Symbol
|
85
|
+
const_name = Helpers.to_const_name(shared_name.to_s)
|
86
|
+
if Behavior.const_defined?(const_name)
|
87
|
+
const = Behavior.const_get(const_name)
|
88
|
+
if Behavior === const
|
89
|
+
include const
|
90
|
+
else
|
91
|
+
raise "#{shared_name.inspect} does not resolve into a shared " <<
|
92
|
+
"behavior instance but to a #{const.inspect}"
|
93
|
+
end
|
94
|
+
else
|
95
|
+
raise "shared behavior with name #{shared_name.inspect} not defined"
|
96
|
+
end
|
97
|
+
when Behavior, Module
|
69
98
|
include shared_name
|
70
99
|
else
|
71
100
|
raise ArgumentError, "pass a String or Symbol as the name e.g. " +
|
@@ -75,14 +104,25 @@ module Test::Unit::Context
|
|
75
104
|
|
76
105
|
%w( like_a use uses ).each { |m| alias_method m, :like }
|
77
106
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
107
|
+
# Returns all available shared definitions.
|
108
|
+
def shared_definitions
|
109
|
+
shareds = []
|
110
|
+
constants.each do |name|
|
111
|
+
const = const_get(name)
|
112
|
+
if const.is_a?(Behavior)
|
113
|
+
shareds << const
|
114
|
+
end
|
82
115
|
end
|
83
|
-
|
84
|
-
|
116
|
+
shareds
|
117
|
+
end
|
118
|
+
|
119
|
+
class Behavior < Module
|
120
|
+
|
121
|
+
attr_reader :shared_name
|
122
|
+
|
123
|
+
def initialize(name, block)
|
85
124
|
super()
|
125
|
+
@shared_name = name
|
86
126
|
@_block = block
|
87
127
|
end
|
88
128
|
|
@@ -24,28 +24,30 @@ module Test::Unit::Context
|
|
24
24
|
|
25
25
|
context "A shared group" do
|
26
26
|
context "creates a module" do
|
27
|
+
|
27
28
|
test "based on a string name" do
|
28
29
|
self.class.shared "things and fun" do
|
29
30
|
end
|
30
31
|
|
31
|
-
assert
|
32
|
-
|
32
|
+
assert Shared::Behavior.const_defined?(:ThingsAndFun)
|
33
|
+
assert_instance_of Shared::Behavior, Shared::Behavior.const_get(:ThingsAndFun)
|
33
34
|
end
|
34
35
|
|
35
|
-
|
36
|
+
test "based on a symbol name" do
|
36
37
|
self.class.shared :fun_and_games do
|
37
38
|
end
|
38
39
|
|
39
|
-
assert
|
40
|
-
|
40
|
+
assert Shared::Behavior.const_defined?(:FunAndGames)
|
41
|
+
assert_instance_of Shared::Behavior, Shared::Behavior.const_get(:FunAndGames)
|
41
42
|
end
|
42
43
|
|
43
|
-
|
44
|
+
test "unless the name is not a String or Symbol" do
|
44
45
|
assert_raise ArgumentError do
|
45
|
-
self.class.shared
|
46
|
+
self.class.shared 42 do
|
46
47
|
end
|
47
48
|
end
|
48
49
|
end
|
50
|
+
|
49
51
|
end
|
50
52
|
|
51
53
|
context "should be locatable" do
|
@@ -84,6 +86,12 @@ module Test::Unit::Context
|
|
84
86
|
self.class.use HiDog
|
85
87
|
end
|
86
88
|
end
|
89
|
+
|
90
|
+
it "by behavior reference" do
|
91
|
+
assert_nothing_raised do
|
92
|
+
self.class.use Shared::Behavior::HiDog
|
93
|
+
end
|
94
|
+
end
|
87
95
|
end
|
88
96
|
|
89
97
|
context "should include its shared behavior" do
|
@@ -134,6 +142,18 @@ module Test::Unit::Context
|
|
134
142
|
end
|
135
143
|
|
136
144
|
end
|
145
|
+
|
146
|
+
test "locates all shared behaviors with their names" do
|
147
|
+
assert_not_nil shareds = self.class.shared_definitions
|
148
|
+
assert shareds.size >= 4, shareds.inspect
|
149
|
+
assert_include shareds, Test::Unit::Context::Shared::Behavior::HiDog
|
150
|
+
assert_equal 'hi dog', Test::Unit::Context::Shared::Behavior::HiDog.shared_name
|
151
|
+
[ :Athos, :Porthos, :Aramis ].each do |name|
|
152
|
+
assert_include shareds, behavior = self.class.const_get(name)
|
153
|
+
assert_equal name.to_s, behavior.shared_name
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
137
157
|
end
|
138
158
|
end
|
139
159
|
end
|
@@ -16,56 +16,173 @@ module Test::Unit
|
|
16
16
|
assert self.class.respond_to? :contexts
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
@context =
|
24
|
-
Class.new(Test::Unit::TestCase).
|
25
|
-
context("When testing") do
|
26
|
-
def test_this_thing
|
27
|
-
true
|
28
|
-
end
|
29
|
-
end
|
19
|
+
class Default < Test::Unit::TestCase
|
20
|
+
CONTEXT = context "When testing" do
|
21
|
+
def test_this_thing
|
22
|
+
true
|
30
23
|
end
|
24
|
+
end
|
25
|
+
context "More testing" do
|
26
|
+
# @todo implement more tests here ...
|
27
|
+
end
|
28
|
+
end
|
31
29
|
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
setup do
|
31
|
+
@default_context = Default::CONTEXT
|
32
|
+
end
|
33
|
+
|
34
|
+
test "[default context] sets the context name" do
|
35
|
+
assert_equal "When testing", @default_context.context_name
|
36
|
+
end
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
+
test "[default context] is a Test::Unit::TestCase" do
|
39
|
+
assert @default_context.ancestors.include?(Test::Unit::TestCase)
|
40
|
+
end
|
41
|
+
|
42
|
+
test "[default context] is defived from the test class" do
|
43
|
+
assert_equal Default, @default_context.superclass
|
44
|
+
end
|
45
|
+
|
46
|
+
test "[default context] reports among test case's context defs" do
|
47
|
+
assert Default.respond_to?(:context_definitions)
|
48
|
+
assert_include Default.context_definitions, @default_context
|
49
|
+
assert_equal 2, Default.context_definitions.size
|
50
|
+
end
|
51
|
+
|
52
|
+
test "has a (context name derived) class name" do
|
53
|
+
namespace = 'Test::Unit::TestContext::Default::'
|
54
|
+
assert_equal "#{namespace}ContextWhenTesting", @default_context.name
|
55
|
+
end
|
56
|
+
|
57
|
+
class Anonymous < Test::Unit::TestCase
|
58
|
+
CONTEXT = context do
|
59
|
+
def test_some_thing
|
60
|
+
true
|
38
61
|
end
|
39
|
-
|
40
62
|
end
|
63
|
+
context do
|
64
|
+
test 'another_thing' do
|
65
|
+
end
|
66
|
+
end
|
67
|
+
context do
|
68
|
+
#
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
setup do
|
73
|
+
@anonymous_context = Anonymous::CONTEXT
|
74
|
+
end
|
41
75
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
76
|
+
test "[anonymous context] has a generated context name" do
|
77
|
+
assert_not_nil @anonymous_context.name
|
78
|
+
end
|
79
|
+
|
80
|
+
test "[anonymous context] is defived from the test class" do
|
81
|
+
assert_equal Anonymous, @anonymous_context.superclass
|
82
|
+
end
|
83
|
+
|
84
|
+
test "[anonymous context] reports among test case's context defs" do
|
85
|
+
assert Anonymous.respond_to?(:context_definitions)
|
86
|
+
assert_include Anonymous.context_definitions, @anonymous_context
|
87
|
+
assert_equal 3, Anonymous.context_definitions.size
|
88
|
+
assert_equal 3, Anonymous.context_definitions(true).size
|
89
|
+
end
|
90
|
+
|
91
|
+
test "[anonymous context] has a (context name derived) class name" do
|
92
|
+
namespace = 'Test::Unit::TestContext::Anonymous::'
|
93
|
+
context_name = @anonymous_context.context_name
|
94
|
+
assert_equal "#{namespace}Context#{context_name}", @anonymous_context.name
|
95
|
+
end
|
96
|
+
|
97
|
+
class Nested < Test::Unit::TestCase
|
98
|
+
CONTEXT = context "and we're testing" do
|
99
|
+
@nested = context "should be nested" do
|
100
|
+
def test_a_thing
|
101
|
+
true
|
55
102
|
end
|
56
103
|
end
|
104
|
+
def self.nested; @nested; end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
setup do
|
109
|
+
@parent_context = Nested::CONTEXT
|
110
|
+
@nested_context = Nested::CONTEXT.nested
|
111
|
+
end
|
112
|
+
|
113
|
+
test "[nested context] sets a nested context name" do
|
114
|
+
assert_equal "and we're testing should be nested", @nested_context.context_name
|
115
|
+
end
|
57
116
|
|
58
|
-
|
59
|
-
|
117
|
+
test "[nested context] is also a Test::Unit::TestCase" do
|
118
|
+
assert @nested_context.ancestors.include?(Test::Unit::TestCase)
|
119
|
+
end
|
120
|
+
|
121
|
+
test "[nested context] is defived from the prev context class" do
|
122
|
+
assert_equal @parent_context, @nested_context.superclass
|
123
|
+
end
|
124
|
+
|
125
|
+
test "[nested context] reports context defs correctly" do
|
126
|
+
assert Nested.respond_to?(:context_definitions)
|
127
|
+
assert_equal 1, Nested.context_definitions.size
|
128
|
+
assert_equal 1, @parent_context.context_definitions.size
|
129
|
+
assert_equal 0, @nested_context.context_definitions.size
|
130
|
+
assert_equal 2, Nested.context_definitions(true).size
|
131
|
+
end
|
132
|
+
|
133
|
+
test "[nested context] has a (context name derived) class name" do
|
134
|
+
namespace = 'Test::Unit::TestContext::Nested::'
|
135
|
+
assert_equal "#{namespace}ContextAndWeReTesting::ContextShouldBeNested",
|
136
|
+
@nested_context.name
|
137
|
+
end
|
138
|
+
|
139
|
+
class Redefined < Test::Unit::TestCase
|
140
|
+
CONTEXT = context 42 do
|
141
|
+
def test_everything
|
142
|
+
true
|
60
143
|
end
|
144
|
+
end
|
145
|
+
@@warns = nil
|
146
|
+
def self.warn(message)
|
147
|
+
( @@warns ||= [] ) << message
|
148
|
+
super
|
149
|
+
end
|
150
|
+
def self.warns; @@warns; end
|
151
|
+
def self.reset_warns; @@warns = nil; end
|
152
|
+
end
|
153
|
+
|
154
|
+
setup do
|
155
|
+
@redefined_context = Redefined::CONTEXT
|
156
|
+
end
|
157
|
+
|
158
|
+
test "[redefined context] sets the context name" do
|
159
|
+
assert_equal 42, @redefined_context.context_name
|
160
|
+
end
|
61
161
|
|
62
|
-
|
63
|
-
|
162
|
+
test "[redefined context] warns when same context name used" do
|
163
|
+
assert_nil Redefined.warns
|
164
|
+
class Redefined
|
165
|
+
context 42 do
|
166
|
+
def test_something_else
|
167
|
+
assert true
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
assert_not_nil Redefined.warns
|
172
|
+
assert_equal 2, @redefined_context.instance_methods(false).grep(/test/).size
|
173
|
+
|
174
|
+
Redefined.reset_warns
|
175
|
+
|
176
|
+
assert_nil Redefined.warns
|
177
|
+
class Redefined
|
178
|
+
context '42' do # same class-name
|
179
|
+
def test_a_little_thing
|
180
|
+
end
|
64
181
|
end
|
65
|
-
|
66
182
|
end
|
183
|
+
assert_not_nil Redefined.warns
|
184
|
+
assert_equal 3, @redefined_context.instance_methods(false).grep(/test/).size
|
67
185
|
end
|
68
186
|
|
69
187
|
end
|
70
|
-
|
71
188
|
end
|
metadata
CHANGED
@@ -1,94 +1,98 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-unit-context
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.1.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
7
|
+
authors:
|
8
|
+
- kares
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
12
|
+
date: 2012-10-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: test-unit
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.4.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.4.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: ! "Makes Test::Unit::TestCases 'contextable' and thus much\neasier to
|
47
|
+
read and write. If you've seen RSpec than it's the very same 'context \ndo ... end'
|
48
|
+
re-invendet for Test::Unit. Inspired by gem 'context' that does the\nsame for the
|
49
|
+
'old' Test::Unit 1.2.3 bundled with Ruby 1.8.x standard libraries."
|
50
|
+
email:
|
51
|
+
- self@kares.org
|
44
52
|
executables: []
|
45
|
-
|
46
53
|
extensions: []
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
54
|
+
extra_rdoc_files:
|
55
|
+
- README.md
|
56
|
+
- LICENSE
|
57
|
+
files:
|
58
|
+
- .gitignore
|
59
|
+
- .travis.yml
|
60
|
+
- Gemfile
|
61
|
+
- LICENSE
|
62
|
+
- README.md
|
63
|
+
- Rakefile
|
64
|
+
- lib/test/unit/context.rb
|
65
|
+
- lib/test/unit/context/context.rb
|
66
|
+
- lib/test/unit/context/helpers.rb
|
67
|
+
- lib/test/unit/context/shared.rb
|
68
|
+
- lib/test/unit/context/version.rb
|
69
|
+
- test-unit-context.gemspec
|
70
|
+
- test/test/unit/context/hooks_test.rb
|
71
|
+
- test/test/unit/context/shared_test.rb
|
72
|
+
- test/test/unit/context_test.rb
|
73
|
+
- test/test_helper.rb
|
66
74
|
homepage: http://github.com/kares/test-unit-context
|
67
75
|
licenses: []
|
68
|
-
|
69
76
|
post_install_message:
|
70
77
|
rdoc_options: []
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
81
|
none: false
|
76
|
-
requirements:
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
87
|
none: false
|
82
|
-
requirements:
|
83
|
-
|
84
|
-
|
85
|
-
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
86
92
|
requirements: []
|
87
|
-
|
88
93
|
rubyforge_project:
|
89
|
-
rubygems_version: 1.8.
|
94
|
+
rubygems_version: 1.8.24
|
90
95
|
signing_key:
|
91
96
|
specification_version: 3
|
92
97
|
summary: Context for Test::Unit (2.x)
|
93
98
|
test_files: []
|
94
|
-
|