assert 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/assert.gemspec +1 -0
- data/lib/assert/macros/methods.rb +64 -28
- data/lib/assert/result.rb +2 -2
- data/lib/assert/version.rb +1 -1
- data/test/unit/assert_tests.rb +1 -1
- data/test/unit/macro_tests.rb +1 -1
- data/test/unit/result_tests.rb +2 -2
- data/test/unit/view_tests.rb +1 -1
- metadata +6 -6
data/assert.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.description = %q{Test::Unit style testing framework, just better than Test::Unit.}
|
12
12
|
gem.summary = %q{Test::Unit style testing framework, just better than Test::Unit.}
|
13
13
|
gem.homepage = "http://github.com/redding/assert"
|
14
|
+
gem.license = 'MIT'
|
14
15
|
|
15
16
|
gem.files = `git ls-files`.split($/)
|
16
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -11,13 +11,9 @@ module Assert::Macros
|
|
11
11
|
|
12
12
|
def have_instance_method(*methods)
|
13
13
|
called_from = (methods.last.kind_of?(Array) ? methods.pop : caller).first
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
should "respond to instance method ##{method}", called_from do
|
18
|
-
assert_respond_to method, subject, "#{subject.class.name} does not have instance method ##{method}"
|
19
|
-
end
|
20
|
-
end
|
14
|
+
Assert::Macro.new do
|
15
|
+
methods.each{ |m| _methods_macro_instance_methods << [m, called_from] }
|
16
|
+
_methods_macro_test
|
21
17
|
end
|
22
18
|
end
|
23
19
|
alias_method :have_instance_methods, :have_instance_method
|
@@ -26,13 +22,9 @@ module Assert::Macros
|
|
26
22
|
|
27
23
|
def not_have_instance_method(*methods)
|
28
24
|
called_from = (methods.last.kind_of?(Array) ? methods.pop : caller).first
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
should "not respond to instance method ##{method}", called_from do
|
33
|
-
assert_not_respond_to method, subject, "#{subject.class.name} has instance method ##{method}"
|
34
|
-
end
|
35
|
-
end
|
25
|
+
Assert::Macro.new do
|
26
|
+
methods.each{ |m| _methods_macro_not_instance_methods << [m, called_from] }
|
27
|
+
_methods_macro_test
|
36
28
|
end
|
37
29
|
end
|
38
30
|
alias_method :not_have_instance_methods, :not_have_instance_method
|
@@ -41,13 +33,9 @@ module Assert::Macros
|
|
41
33
|
|
42
34
|
def have_class_method(*methods)
|
43
35
|
called_from = (methods.last.kind_of?(Array) ? methods.pop : caller).first
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
should "respond to class method ##{method}", called_from do
|
48
|
-
assert_respond_to method, subject.class, "#{subject.class.name} does not have class method ##{method}"
|
49
|
-
end
|
50
|
-
end
|
36
|
+
Assert::Macro.new do
|
37
|
+
methods.each{ |m| _methods_macro_class_methods << [m, called_from] }
|
38
|
+
_methods_macro_test
|
51
39
|
end
|
52
40
|
end
|
53
41
|
alias_method :have_class_methods, :have_class_method
|
@@ -56,13 +44,9 @@ module Assert::Macros
|
|
56
44
|
|
57
45
|
def not_have_class_method(*methods)
|
58
46
|
called_from = (methods.last.kind_of?(Array) ? methods.pop : caller).first
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
should "not respond to class method ##{method}", called_from do
|
63
|
-
assert_not_respond_to method, subject.class, "#{subject.class.name} has class method ##{method}"
|
64
|
-
end
|
65
|
-
end
|
47
|
+
Assert::Macro.new do
|
48
|
+
methods.each{ |m| _methods_macro_not_class_methods << [m, called_from] }
|
49
|
+
_methods_macro_test
|
66
50
|
end
|
67
51
|
end
|
68
52
|
alias_method :not_have_class_methods, :not_have_class_method
|
@@ -113,6 +97,58 @@ module Assert::Macros
|
|
113
97
|
end
|
114
98
|
alias_method :not_have_accessors, :not_have_accessor
|
115
99
|
|
100
|
+
# private
|
101
|
+
|
102
|
+
def _methods_macro_test
|
103
|
+
@_methods_macro_test ||= should "respond to methods" do
|
104
|
+
|
105
|
+
self.class._methods_macro_instance_methods.each do |(method, called_from)|
|
106
|
+
msg = "#{subject.class.name} does not have instance method ##{method}"
|
107
|
+
with_backtrace(called_from) do
|
108
|
+
assert_respond_to method, subject, msg
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
self.class._methods_macro_class_methods.each do |(method, called_from)|
|
113
|
+
msg = "#{subject.class.name} does not have class method ##{method}"
|
114
|
+
with_backtrace(called_from) do
|
115
|
+
assert_respond_to method, subject.class, msg
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
self.class._methods_macro_not_instance_methods.each do |(method, called_from)|
|
120
|
+
msg = "#{subject.class.name} has instance method ##{method}"
|
121
|
+
with_backtrace(called_from) do
|
122
|
+
assert_not_respond_to method, subject, msg
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
self.class._methods_macro_not_class_methods.each do |(method, called_from)|
|
127
|
+
msg = "#{subject.class.name} has class method ##{method}"
|
128
|
+
with_backtrace(called_from) do
|
129
|
+
assert_not_respond_to method, subject.class, msg
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def _methods_macro_instance_methods
|
137
|
+
@_methods_macro_instance_methods ||= []
|
138
|
+
end
|
139
|
+
|
140
|
+
def _methods_macro_not_instance_methods
|
141
|
+
@_methods_macro_not_instance_methods ||= []
|
142
|
+
end
|
143
|
+
|
144
|
+
def _methods_macro_class_methods
|
145
|
+
@_methods_macro_class_methods ||= []
|
146
|
+
end
|
147
|
+
|
148
|
+
def _methods_macro_not_class_methods
|
149
|
+
@_methods_macro_not_class_methods ||= []
|
150
|
+
end
|
151
|
+
|
116
152
|
end
|
117
153
|
|
118
154
|
end
|
data/lib/assert/result.rb
CHANGED
@@ -180,8 +180,8 @@ module Assert::Result
|
|
180
180
|
end
|
181
181
|
|
182
182
|
class Backtrace < ::Array
|
183
|
-
def initialize(value=nil)
|
184
|
-
super(value ||
|
183
|
+
def initialize(value = nil)
|
184
|
+
super([*(value || "No backtrace")])
|
185
185
|
end
|
186
186
|
|
187
187
|
def to_s; self.join("\n"); end
|
data/lib/assert/version.rb
CHANGED
data/test/unit/assert_tests.rb
CHANGED
data/test/unit/macro_tests.rb
CHANGED
data/test/unit/result_tests.rb
CHANGED
@@ -30,7 +30,7 @@ module Assert::Result
|
|
30
30
|
|
31
31
|
end
|
32
32
|
|
33
|
-
class
|
33
|
+
class UnitTests < Assert::Context
|
34
34
|
desc "a base result"
|
35
35
|
setup do
|
36
36
|
@test = Factory.test("a test name")
|
@@ -74,7 +74,7 @@ module Assert::Result
|
|
74
74
|
|
75
75
|
end
|
76
76
|
|
77
|
-
class ToStringTests <
|
77
|
+
class ToStringTests < UnitTests
|
78
78
|
|
79
79
|
should "include its test context name in the to_s" do
|
80
80
|
assert subject.to_s.include?(subject.test_name)
|
data/test/unit/view_tests.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 2.3.
|
9
|
+
- 1
|
10
|
+
version: 2.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kelly Redding
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2013-
|
19
|
+
date: 2013-10-03 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: ansi
|
@@ -99,8 +99,8 @@ files:
|
|
99
99
|
- test/unit/view_tests.rb
|
100
100
|
- tmp/.gitkeep
|
101
101
|
homepage: http://github.com/redding/assert
|
102
|
-
licenses:
|
103
|
-
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
104
|
post_install_message:
|
105
105
|
rdoc_options: []
|
106
106
|
|