test_xml 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ module TestXml
6
6
  equal_text?(element)
7
7
  else
8
8
  contains_elements_of?(element) &&
9
- !element.elements.find {|el| not at(el.name).match?(el, compare_value) }
9
+ element.elements.all? {|el| matches_at_least_one?(el, compare_value) }
10
10
  end
11
11
  end
12
12
 
@@ -30,6 +30,11 @@ module TestXml
30
30
  def contains?(element)
31
31
  children.find {|node| node.element? && node.name == element.name }
32
32
  end
33
+
34
+ def matches_at_least_one?(element, compare_value)
35
+ search(element.name).find { |el| el.match?(element, compare_value) }
36
+ end
37
+
33
38
  end
34
39
  end
35
40
  end
@@ -1,3 +1,3 @@
1
1
  module TestXml
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -53,4 +53,29 @@ describe "match_xml(xml)" do
53
53
  XML
54
54
  end
55
55
  end
56
+
57
+ context "when xml has elements with the same name within parent element" do
58
+ subject {
59
+ <<-XML
60
+ <xml>
61
+ <errors>
62
+ <error>one</error>
63
+ <error>two</error>
64
+ </errors>
65
+ </xml>
66
+ XML
67
+ }
68
+
69
+ it "should pass" do
70
+ should match_xml(<<-XML)
71
+ <xml>
72
+ <errors>
73
+ <error>one</error>
74
+ <error>two</error>
75
+ </errors>
76
+ </xml>
77
+ XML
78
+ end
79
+ end
80
+
56
81
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_xml
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 3
9
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
10
11
  platform: ruby
11
12
  authors:
12
13
  - Pavel Gabriel
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-06-07 00:00:00 +03:00
18
+ date: 2010-10-15 00:00:00 +03:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: nokogiri
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 31
27
30
  segments:
28
31
  - 1
29
32
  - 3
@@ -73,23 +76,27 @@ rdoc_options:
73
76
  require_paths:
74
77
  - lib
75
78
  required_ruby_version: !ruby/object:Gem::Requirement
79
+ none: false
76
80
  requirements:
77
81
  - - ">="
78
82
  - !ruby/object:Gem::Version
83
+ hash: 3
79
84
  segments:
80
85
  - 0
81
86
  version: "0"
82
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
+ none: false
83
89
  requirements:
84
90
  - - ">="
85
91
  - !ruby/object:Gem::Version
92
+ hash: 3
86
93
  segments:
87
94
  - 0
88
95
  version: "0"
89
96
  requirements: []
90
97
 
91
98
  rubyforge_project:
92
- rubygems_version: 1.3.6
99
+ rubygems_version: 1.3.7
93
100
  signing_key:
94
101
  specification_version: 3
95
102
  summary: test_xml allows you to test xml with RSpec, Test::Unit, Cucumber