test_xml 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +12 -1
- data/CHANGES.md +4 -0
- data/lib/test_xml/mini_test.rb +1 -0
- data/lib/test_xml/test_unit.rb +28 -1
- data/lib/test_xml/version.rb +1 -1
- metadata +1 -2
- data/lib/test_xml/test_unit/assertions.rb +0 -26
data/.gitignore
CHANGED
data/CHANGES.md
CHANGED
data/lib/test_xml/mini_test.rb
CHANGED
data/lib/test_xml/test_unit.rb
CHANGED
@@ -1,6 +1,33 @@
|
|
1
1
|
require "test/unit"
|
2
2
|
require "test_xml"
|
3
3
|
|
4
|
+
module TestXml
|
5
|
+
module TestUnit
|
6
|
+
module Assertions
|
7
|
+
ASSERTIONS.each do |cfg|
|
8
|
+
define_method(cfg.assert_name) do |a, b|
|
9
|
+
correct_assert(MatcherMethods.send(cfg.name, a, b), cfg.message_for_should.call(a, b))
|
10
|
+
end
|
11
|
+
|
12
|
+
define_method(cfg.assert_not_name) do |a, b|
|
13
|
+
correct_assert(! MatcherMethods.send(cfg.name, a, b), cfg.message_for_should_not.call(a, b))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def correct_assert(boolean, message)
|
19
|
+
if RUBY_VERSION =~ /1.9.2/ or defined?(MiniTest)
|
20
|
+
assert(boolean, message)
|
21
|
+
else
|
22
|
+
assert_block(message) do
|
23
|
+
boolean
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
4
31
|
class Test::Unit::TestCase
|
5
32
|
include TestXml::TestUnit::Assertions
|
6
|
-
end
|
33
|
+
end
|
data/lib/test_xml/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -99,7 +99,6 @@ files:
|
|
99
99
|
- lib/test_xml/nokogiri/node.rb
|
100
100
|
- lib/test_xml/spec.rb
|
101
101
|
- lib/test_xml/test_unit.rb
|
102
|
-
- lib/test_xml/test_unit/assertions.rb
|
103
102
|
- lib/test_xml/version.rb
|
104
103
|
- spec/matchers/contain_xml_spec.rb
|
105
104
|
- spec/matchers/contain_xml_structure_spec.rb
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module TestXml
|
2
|
-
module TestUnit
|
3
|
-
module Assertions
|
4
|
-
ASSERTIONS.each do |cfg|
|
5
|
-
define_method(cfg.assert_name) do |a, b|
|
6
|
-
correct_assert(MatcherMethods.send(cfg.name, a, b), cfg.message_for_should.call(a, b))
|
7
|
-
end
|
8
|
-
|
9
|
-
define_method(cfg.assert_not_name) do |a, b|
|
10
|
-
correct_assert(! MatcherMethods.send(cfg.name, a, b), cfg.message_for_should_not.call(a, b))
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
def correct_assert(boolean, message)
|
16
|
-
if RUBY_VERSION =~ /1.9.2/ or defined?(MiniTest)
|
17
|
-
assert(boolean, message)
|
18
|
-
else
|
19
|
-
assert_block(message) do
|
20
|
-
boolean
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|