assert2 0.4.0 → 0.4.1

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/lib/assert2/xhtml.rb CHANGED
@@ -79,10 +79,14 @@ end
79
79
 
80
80
  class BeHtmlWith
81
81
 
82
+ def deAmpAmp(stwing)
83
+ stwing.gsub('&', '&').gsub('&', '&')
84
+ end # ERGO await a fix in Nokogiri, and hope nobody actually means & !!!
85
+
82
86
  def get_texts(element)
83
87
  element.xpath('text()').map{|x|x.to_s.strip}.reject{|x|x==''}.compact
84
88
  end
85
-
89
+
86
90
  def match_text(ref, sam)
87
91
  ref_text = get_texts(ref)
88
92
  # TODO regices?
@@ -91,7 +95,7 @@ class BeHtmlWith
91
95
 
92
96
  def match_attributes_and_text(reference, sample)
93
97
  reference.attribute_nodes.each do |attr|
94
- sample[attr.name] == attr.value or return false
98
+ deAmpAmp(sample[attr.name]) == deAmpAmp(attr.value) or return false
95
99
  end
96
100
 
97
101
  return match_text(reference, sample)
@@ -51,7 +51,7 @@ requirements:
51
51
  must match
52
52
  - the specification only requires the attributes and structural
53
53
  elements that its matcher demands; we skip the rest -
54
- such as the <ol> and <li> fields. They can change
54
+ such as the <ol> and <li> elements. They can change
55
55
  freely as our website upgrades
56
56
  - at fault time, the matcher prints out the failing elements
57
57
  and their immediate context.
@@ -79,10 +79,15 @@ end
79
79
 
80
80
  class BeHtmlWith
81
81
 
82
+ def deAmpAmp(stwing)
83
+ p stwing
84
+ stwing.gsub('&amp;amp;', '&').gsub('&amp;', '&')
85
+ end # ERGO await a fix in Nokogiri, and hope nobody actually means &amp;amp; !!!
86
+
82
87
  def get_texts(element)
83
88
  element.xpath('text()').map{|x|x.to_s.strip}.reject{|x|x==''}.compact
84
89
  end
85
-
90
+
86
91
  def match_text(ref, sam)
87
92
  ref_text = get_texts(ref)
88
93
  # TODO regices?
@@ -91,7 +96,8 @@ class BeHtmlWith
91
96
 
92
97
  def match_attributes_and_text(reference, sample)
93
98
  reference.attribute_nodes.each do |attr|
94
- sample[attr.name] == attr.value or return false
99
+ p sample[attr.name]
100
+ deAmpAmp(sample[attr.name]) == deAmpAmp(attr.value) or return false
95
101
  end
96
102
 
97
103
  return match_text(reference, sample)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assert2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phlip