assert2 0.5.0 → 0.5.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/rjs.rb +3 -2
- data/lib/assert2/xhtml.rb +13 -4
- metadata +2 -2
data/lib/assert2/rjs.rb
CHANGED
@@ -174,8 +174,9 @@ module Spec; module Matchers
|
|
174
174
|
def matches?(response, &block)
|
175
175
|
@block = block if block
|
176
176
|
sample, asserter = @scope.__interpret_rjs(response, @command, @args, &@block)
|
177
|
-
|
178
|
-
|
177
|
+
@failure_message = asserter.failure_message or
|
178
|
+
@negative_failure_message = "should not find #{sample.inspect} in\n#{asserter.js}" # TODO complaint system
|
179
|
+
return @negative_failure_message
|
179
180
|
end
|
180
181
|
|
181
182
|
attr_reader :failure_message, :negative_failure_message
|
data/lib/assert2/xhtml.rb
CHANGED
@@ -72,10 +72,10 @@ class BeHtmlWith
|
|
72
72
|
:doc,
|
73
73
|
:failure_message,
|
74
74
|
:message,
|
75
|
+
:reference,
|
76
|
+
:references,
|
77
|
+
:sample,
|
75
78
|
:scope
|
76
|
-
attr_reader :references
|
77
|
-
attr_writer :reference,
|
78
|
-
:sample
|
79
79
|
|
80
80
|
def matches?(stwing, &block)
|
81
81
|
@block ||= block # ERGO test that ||= - preferrably with a real RSpec suite!
|
@@ -112,7 +112,7 @@ class BeHtmlWith
|
|
112
112
|
if element.name == 'without!'
|
113
113
|
return 'not( ' + build_predicate(element, 'or') + ' )'
|
114
114
|
else
|
115
|
-
target = element
|
115
|
+
target = translate_tag(element)
|
116
116
|
path = "descendant::#{ target }[ refer(., '#{ count }') "
|
117
117
|
# refer() is first so we collect many samples, despite boolean short-circuiting
|
118
118
|
path << 'and ' if elemental_children(element).any?
|
@@ -121,6 +121,15 @@ class BeHtmlWith
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
+
def translate_tag(element)
|
125
|
+
# p element.name if element.name =~ /\!/
|
126
|
+
if element.name == 'any!'
|
127
|
+
'*'
|
128
|
+
else
|
129
|
+
element.name.sub(/\!$/, '')
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
124
133
|
def build_predicate(element, conjunction = 'and')
|
125
134
|
conjunction = " #{ conjunction } "
|
126
135
|
element_kids = elemental_children(element)
|
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.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phlip
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-12 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|