vigiles 0.1.0.pre.beta3 → 0.1.0.pre.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -1
- data/lib/vigiles/archive/extras.rb +4 -3
- data/lib/vigiles/archive/metadata.rb +3 -2
- data/lib/vigiles/archive/request.rb +18 -4
- data/lib/vigiles/archive.rb +15 -3
- data/lib/vigiles/constants.rb +7 -0
- data/lib/vigiles/middleware/record_conversation.rb +6 -22
- data/lib/vigiles/spec.rb +1 -1
- data/lib/vigiles/utilities/uri.rb +18 -0
- data/lib/vigiles/version.rb +1 -1
- data/lib/vigiles.rb +4 -1
- data/sorbet/rbi/gems/{activemodel@7.0.5.rbi → actioncable@7.1.3.3.rbi} +2 -2
- data/sorbet/rbi/gems/actionmailbox@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/{activerecord@7.0.5.rbi → actionmailer@7.1.3.3.rbi} +2 -2
- data/sorbet/rbi/gems/actionpack@7.1.3.3.rbi +20046 -0
- data/sorbet/rbi/gems/actiontext@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/actionview@7.1.3.3.rbi +15953 -0
- data/sorbet/rbi/gems/activejob@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/activemodel@7.1.3.3.rbi +6657 -0
- data/sorbet/rbi/gems/activerecord@7.1.3.3.rbi +41520 -0
- data/sorbet/rbi/gems/activestorage@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/activesupport@7.1.3.3.rbi +20570 -0
- data/sorbet/rbi/gems/base64@0.2.0.rbi +508 -0
- data/sorbet/rbi/gems/bigdecimal@3.1.8.rbi +77 -0
- data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
- data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +8 -0
- data/sorbet/rbi/gems/crass@1.0.6.rbi +622 -0
- data/sorbet/rbi/gems/date@3.3.4.rbi +74 -0
- data/sorbet/rbi/gems/drb@2.2.1.rbi +1346 -0
- data/sorbet/rbi/gems/globalid@1.2.1.rbi +8 -0
- data/sorbet/rbi/gems/i18n@1.14.5.rbi +2358 -0
- data/sorbet/rbi/gems/io-console@0.7.2.rbi +8 -0
- data/sorbet/rbi/gems/loofah@2.22.0.rbi +1080 -0
- data/sorbet/rbi/gems/{i18n@1.14.1.rbi → mail@2.8.1.rbi} +2 -2
- data/sorbet/rbi/gems/marcel@1.0.4.rbi +8 -0
- data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +8 -0
- data/sorbet/rbi/gems/mutex_m@0.2.0.rbi +93 -0
- data/sorbet/rbi/gems/net-imap@0.4.11.rbi +8 -0
- data/sorbet/rbi/gems/net-pop@0.1.2.rbi +8 -0
- data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +291 -0
- data/sorbet/rbi/gems/net-smtp@0.5.0.rbi +8 -0
- data/sorbet/rbi/gems/nio4r@2.7.3.rbi +8 -0
- data/sorbet/rbi/gems/nokogiri@1.16.5.rbi +7310 -0
- data/sorbet/rbi/gems/psych@5.1.2.rbi +1768 -0
- data/sorbet/rbi/gems/rack-session@2.0.0.rbi +729 -0
- data/sorbet/rbi/gems/rack-test@2.1.0.rbi +749 -0
- data/sorbet/rbi/gems/rack@3.0.11.rbi +5195 -0
- data/sorbet/rbi/gems/rackup@2.1.0.rbi +406 -0
- data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +691 -0
- data/sorbet/rbi/gems/rails-html-sanitizer@1.6.0.rbi +721 -0
- data/sorbet/rbi/gems/rails@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/railties@7.1.3.3.rbi +2167 -0
- data/sorbet/rbi/gems/rdoc@6.6.3.1.rbi +12715 -0
- data/sorbet/rbi/gems/reline@0.5.7.rbi +8 -0
- data/sorbet/rbi/gems/stringio@3.1.0.rbi +8 -0
- data/sorbet/rbi/gems/timeout@0.4.1.rbi +148 -0
- data/sorbet/rbi/gems/webrick@1.8.1.rbi +2606 -0
- data/sorbet/rbi/gems/websocket-driver@0.7.6.rbi +8 -0
- data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +8 -0
- data/sorbet/rbi/gems/zeitwerk@2.6.13.rbi +1003 -0
- data/vigiles.gemspec +1 -1
- metadata +54 -7
- data/sorbet/rbi/gems/activesupport@7.0.5.rbi +0 -14
@@ -0,0 +1,691 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `rails-dom-testing` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem rails-dom-testing`.
|
6
|
+
|
7
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#3
|
8
|
+
module Rails
|
9
|
+
class << self
|
10
|
+
# source://railties/7.1.3.3/lib/rails/deprecator.rb#4
|
11
|
+
def deprecator; end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#4
|
16
|
+
module Rails::Dom; end
|
17
|
+
|
18
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#5
|
19
|
+
module Rails::Dom::Testing
|
20
|
+
# source://rails-dom-testing//lib/rails/dom/testing.rb#12
|
21
|
+
def default_html_version; end
|
22
|
+
|
23
|
+
# source://rails-dom-testing//lib/rails/dom/testing.rb#12
|
24
|
+
def default_html_version=(val); end
|
25
|
+
|
26
|
+
class << self
|
27
|
+
# source://rails-dom-testing//lib/rails/dom/testing.rb#12
|
28
|
+
def default_html_version; end
|
29
|
+
|
30
|
+
# source://rails-dom-testing//lib/rails/dom/testing.rb#12
|
31
|
+
def default_html_version=(val); end
|
32
|
+
|
33
|
+
# @return [Boolean]
|
34
|
+
#
|
35
|
+
# source://rails-dom-testing//lib/rails/dom/testing.rb#15
|
36
|
+
def html5_support?; end
|
37
|
+
|
38
|
+
# source://rails-dom-testing//lib/rails/dom/testing.rb#19
|
39
|
+
def html_document(html_version: T.unsafe(nil)); end
|
40
|
+
|
41
|
+
# source://rails-dom-testing//lib/rails/dom/testing.rb#26
|
42
|
+
def html_document_fragment(html_version: T.unsafe(nil)); end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
# source://rails-dom-testing//lib/rails/dom/testing.rb#34
|
47
|
+
def choose_html_parser(parser_classes, html_version: T.unsafe(nil)); end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#6
|
52
|
+
module Rails::Dom::Testing::Assertions
|
53
|
+
include ::Rails::Dom::Testing::Assertions::DomAssertions
|
54
|
+
include ::Rails::Dom::Testing::Assertions::SelectorAssertions
|
55
|
+
end
|
56
|
+
|
57
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#7
|
58
|
+
module Rails::Dom::Testing::Assertions::DomAssertions
|
59
|
+
# \Test two HTML strings for equivalency (e.g., equal even when attributes are in another order)
|
60
|
+
#
|
61
|
+
# # assert that the referenced method generates the appropriate HTML string
|
62
|
+
# assert_dom_equal(
|
63
|
+
# '<a href="http://www.example.com">Apples</a>',
|
64
|
+
# link_to("Apples", "http://www.example.com"),
|
65
|
+
# )
|
66
|
+
#
|
67
|
+
# By default, the matcher will not pay attention to whitespace in text nodes (e.g., spaces
|
68
|
+
# and newlines). If you want stricter matching with exact matching for whitespace, pass
|
69
|
+
# <tt>strict: true</tt>:
|
70
|
+
#
|
71
|
+
# # these assertions will both pass
|
72
|
+
# assert_dom_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: false
|
73
|
+
# assert_dom_not_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: true
|
74
|
+
#
|
75
|
+
# The DOMs are created using an HTML parser specified by
|
76
|
+
# Rails::Dom::Testing.default_html_version (either :html4 or :html5).
|
77
|
+
#
|
78
|
+
# When testing in a Rails application, the parser default can also be set by setting
|
79
|
+
# +Rails.application.config.dom_testing_default_html_version+.
|
80
|
+
#
|
81
|
+
# If you want to specify the HTML parser just for a particular assertion, pass
|
82
|
+
# <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
|
83
|
+
#
|
84
|
+
# assert_dom_equal expected, actual, html_version: :html5
|
85
|
+
#
|
86
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#35
|
87
|
+
def assert_dom_equal(expected, actual, message = T.unsafe(nil), strict: T.unsafe(nil), html_version: T.unsafe(nil)); end
|
88
|
+
|
89
|
+
# The negated form of +assert_dom_equal+.
|
90
|
+
#
|
91
|
+
# # assert that the referenced method does not generate the specified HTML string
|
92
|
+
# assert_dom_not_equal(
|
93
|
+
# '<a href="http://www.example.com">Apples</a>',
|
94
|
+
# link_to("Oranges", "http://www.example.com"),
|
95
|
+
# )
|
96
|
+
#
|
97
|
+
# By default, the matcher will not pay attention to whitespace in text nodes (e.g., spaces
|
98
|
+
# and newlines). If you want stricter matching with exact matching for whitespace, pass
|
99
|
+
# <tt>strict: true</tt>:
|
100
|
+
#
|
101
|
+
# # these assertions will both pass
|
102
|
+
# assert_dom_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: false
|
103
|
+
# assert_dom_not_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: true
|
104
|
+
#
|
105
|
+
# The DOMs are created using an HTML parser specified by
|
106
|
+
# Rails::Dom::Testing.default_html_version (either :html4 or :html5).
|
107
|
+
#
|
108
|
+
# When testing in a Rails application, the parser default can also be set by setting
|
109
|
+
# +Rails.application.config.dom_testing_default_html_version+.
|
110
|
+
#
|
111
|
+
# If you want to specify the HTML parser just for a particular assertion, pass
|
112
|
+
# <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
|
113
|
+
#
|
114
|
+
# assert_dom_not_equal expected, actual, html_version: :html5
|
115
|
+
#
|
116
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#68
|
117
|
+
def assert_dom_not_equal(expected, actual, message = T.unsafe(nil), strict: T.unsafe(nil), html_version: T.unsafe(nil)); end
|
118
|
+
|
119
|
+
protected
|
120
|
+
|
121
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#75
|
122
|
+
def compare_doms(expected, actual, strict); end
|
123
|
+
|
124
|
+
# @return [Boolean]
|
125
|
+
#
|
126
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#128
|
127
|
+
def equal_attribute?(attr, other_attr); end
|
128
|
+
|
129
|
+
# @return [Boolean]
|
130
|
+
#
|
131
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#115
|
132
|
+
def equal_attribute_nodes?(nodes, other_nodes); end
|
133
|
+
|
134
|
+
# @return [Boolean]
|
135
|
+
#
|
136
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#107
|
137
|
+
def equal_child?(child, other_child, strict); end
|
138
|
+
|
139
|
+
# @return [Boolean]
|
140
|
+
#
|
141
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#95
|
142
|
+
def equal_children?(child, other_child, strict); end
|
143
|
+
|
144
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#87
|
145
|
+
def extract_children(node, strict); end
|
146
|
+
|
147
|
+
private
|
148
|
+
|
149
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#133
|
150
|
+
def fragment(text, html_version: T.unsafe(nil)); end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Adds the +assert_dom+ method for use in Rails functional
|
154
|
+
# test cases, which can be used to make assertions on the response HTML of a controller
|
155
|
+
# action. You can also call +assert_dom+ within another +assert_dom+ to
|
156
|
+
# make assertions on elements selected by the enclosing assertion.
|
157
|
+
#
|
158
|
+
# Use +css_select+ to select elements without making an assertions, either
|
159
|
+
# from the response HTML or elements selected by the enclosing assertion.
|
160
|
+
#
|
161
|
+
# In addition to HTML responses, you can make the following assertions:
|
162
|
+
#
|
163
|
+
# * +assert_dom_encoded+ - Assertions on HTML encoded inside XML, for example for dealing with feed item descriptions.
|
164
|
+
# * +assert_dom_email+ - Assertions on the HTML body of an e-mail.
|
165
|
+
#
|
166
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#7
|
167
|
+
module Rails::Dom::Testing::Assertions::SelectorAssertions
|
168
|
+
# An assertion that selects elements and makes one or more equality tests.
|
169
|
+
#
|
170
|
+
# If the first argument is an element, selects all matching elements
|
171
|
+
# starting from (and including) that element and all its children in
|
172
|
+
# depth-first order.
|
173
|
+
#
|
174
|
+
# If no element is specified +assert_dom+ selects from
|
175
|
+
# the element returned in +document_root_element+
|
176
|
+
# unless +assert_dom+ is called from within an +assert_dom+ block.
|
177
|
+
# Override +document_root_element+ to tell +assert_dom+ what to select from.
|
178
|
+
# The default implementation raises an exception explaining this.
|
179
|
+
#
|
180
|
+
# When called with a block +assert_dom+ passes an array of selected elements
|
181
|
+
# to the block. Calling +assert_dom+ from the block, with no element specified,
|
182
|
+
# runs the assertion on the complete set of elements selected by the enclosing assertion.
|
183
|
+
# Alternatively the array may be iterated through so that +assert_dom+ can be called
|
184
|
+
# separately for each element.
|
185
|
+
#
|
186
|
+
#
|
187
|
+
# ==== Example
|
188
|
+
# If the response contains two ordered lists, each with four list elements then:
|
189
|
+
# assert_dom "ol" do |elements|
|
190
|
+
# elements.each do |element|
|
191
|
+
# assert_dom element, "li", 4
|
192
|
+
# end
|
193
|
+
# end
|
194
|
+
#
|
195
|
+
# will pass, as will:
|
196
|
+
# assert_dom "ol" do
|
197
|
+
# assert_dom "li", 8
|
198
|
+
# end
|
199
|
+
#
|
200
|
+
# The selector may be a CSS selector expression (String, Symbol, or Numeric) or an expression
|
201
|
+
# with substitution values (Array).
|
202
|
+
# Substitution uses a custom pseudo class match. Pass in whatever attribute you want to match (enclosed in quotes) and a ? for the substitution.
|
203
|
+
# assert_dom returns nil if called with an invalid css selector.
|
204
|
+
#
|
205
|
+
# assert_dom "div:match('id', ?)", "id_string"
|
206
|
+
# assert_dom "div:match('id', ?)", :id_string
|
207
|
+
# assert_dom "div:match('id', ?)", 1
|
208
|
+
# assert_dom "div:match('id', ?)", /\d+/
|
209
|
+
#
|
210
|
+
# === Equality Tests
|
211
|
+
#
|
212
|
+
# The equality test may be one of the following:
|
213
|
+
# * <tt>true</tt> - Assertion is true if at least one element selected.
|
214
|
+
# * <tt>false</tt> - Assertion is true if no element selected.
|
215
|
+
# * <tt>String/Regexp</tt> - Assertion is true if the text value of at least
|
216
|
+
# one element matches the string or regular expression.
|
217
|
+
# * <tt>Integer</tt> - Assertion is true if exactly that number of
|
218
|
+
# elements are selected.
|
219
|
+
# * <tt>Range</tt> - Assertion is true if the number of selected
|
220
|
+
# elements fit the range.
|
221
|
+
# If no equality test specified, the assertion is true if at least one
|
222
|
+
# element selected.
|
223
|
+
#
|
224
|
+
# To perform more than one equality tests, use a hash with the following keys:
|
225
|
+
# * <tt>:text</tt> - Narrow the selection to elements that have this text
|
226
|
+
# value (string or regexp).
|
227
|
+
# * <tt>:html</tt> - Narrow the selection to elements that have this HTML
|
228
|
+
# content (string or regexp).
|
229
|
+
# * <tt>:count</tt> - Assertion is true if the number of selected elements
|
230
|
+
# is equal to this value.
|
231
|
+
# * <tt>:minimum</tt> - Assertion is true if the number of selected
|
232
|
+
# elements is at least this value.
|
233
|
+
# * <tt>:maximum</tt> - Assertion is true if the number of selected
|
234
|
+
# elements is at most this value.
|
235
|
+
#
|
236
|
+
# If the method is called with a block, once all equality tests are
|
237
|
+
# evaluated the block is called with an array of all matched elements.
|
238
|
+
#
|
239
|
+
# # At least one form element
|
240
|
+
# assert_dom "form"
|
241
|
+
#
|
242
|
+
# # Form element includes four input fields
|
243
|
+
# assert_dom "form input", 4
|
244
|
+
#
|
245
|
+
# # Page title is "Welcome"
|
246
|
+
# assert_dom "title", "Welcome"
|
247
|
+
#
|
248
|
+
# # Page title is "Welcome" and there is only one title element
|
249
|
+
# assert_dom "title", {count: 1, text: "Welcome"},
|
250
|
+
# "Wrong title or more than one title element"
|
251
|
+
#
|
252
|
+
# # Page contains no forms
|
253
|
+
# assert_dom "form", false, "This page must contain no forms"
|
254
|
+
#
|
255
|
+
# # Test the content and style
|
256
|
+
# assert_dom "body div.header ul.menu"
|
257
|
+
#
|
258
|
+
# # Use substitution values
|
259
|
+
# assert_dom "ol>li:match('id', ?)", /item-\d+/
|
260
|
+
#
|
261
|
+
# # All input fields in the form have a name
|
262
|
+
# assert_dom "form input" do
|
263
|
+
# assert_dom ":match('name', ?)", /.+/ # Not empty
|
264
|
+
# end
|
265
|
+
#
|
266
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#163
|
267
|
+
def assert_dom(*args, &block); end
|
268
|
+
|
269
|
+
# Extracts the body of an email and runs nested assertions on it.
|
270
|
+
#
|
271
|
+
# You must enable deliveries for this assertion to work, use:
|
272
|
+
# ActionMailer::Base.perform_deliveries = true
|
273
|
+
#
|
274
|
+
# Example usage:
|
275
|
+
#
|
276
|
+
# assert_dom_email do
|
277
|
+
# assert_dom "h1", "Email alert"
|
278
|
+
# end
|
279
|
+
#
|
280
|
+
# assert_dom_email do
|
281
|
+
# items = assert_dom "ol>li"
|
282
|
+
# items.each do
|
283
|
+
# # Work with items here...
|
284
|
+
# end
|
285
|
+
# end
|
286
|
+
#
|
287
|
+
# The DOM is created using an HTML parser specified by
|
288
|
+
# Rails::Dom::Testing.default_html_version (either :html4 or :html5).
|
289
|
+
#
|
290
|
+
# When testing in a Rails application, the parser default can also be set by setting
|
291
|
+
# +Rails.application.config.dom_testing_default_html_version+.
|
292
|
+
#
|
293
|
+
# If you want to specify the HTML parser just for a particular assertion, pass
|
294
|
+
# <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
|
295
|
+
#
|
296
|
+
# assert_dom_email(html_version: :html5) do
|
297
|
+
# assert_dom "h1", "Email alert"
|
298
|
+
# end
|
299
|
+
#
|
300
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#285
|
301
|
+
def assert_dom_email(html_version: T.unsafe(nil), &block); end
|
302
|
+
|
303
|
+
# Extracts the content of an element, treats it as encoded HTML and runs
|
304
|
+
# nested assertion on it.
|
305
|
+
#
|
306
|
+
# You typically call this method within another assertion to operate on
|
307
|
+
# all currently selected elements. You can also pass an element or array
|
308
|
+
# of elements.
|
309
|
+
#
|
310
|
+
# The content of each element is un-encoded, and wrapped in the root
|
311
|
+
# element +encoded+. It then calls the block with all un-encoded elements.
|
312
|
+
#
|
313
|
+
# # Selects all bold tags from within the title of an Atom feed's entries (perhaps to nab a section name prefix)
|
314
|
+
# assert_dom "feed[xmlns='http://www.w3.org/2005/Atom']" do
|
315
|
+
# # Select each entry item and then the title item
|
316
|
+
# assert_dom "entry>title" do
|
317
|
+
# # Run assertions on the encoded title elements
|
318
|
+
# assert_dom_encoded do
|
319
|
+
# assert_dom "b"
|
320
|
+
# end
|
321
|
+
# end
|
322
|
+
# end
|
323
|
+
#
|
324
|
+
#
|
325
|
+
# # Selects all paragraph tags from within the description of an RSS feed
|
326
|
+
# assert_dom "rss[version=2.0]" do
|
327
|
+
# # Select description element of each feed item.
|
328
|
+
# assert_dom "channel>item>description" do
|
329
|
+
# # Run assertions on the encoded elements.
|
330
|
+
# assert_dom_encoded do
|
331
|
+
# assert_dom "p"
|
332
|
+
# end
|
333
|
+
# end
|
334
|
+
# end
|
335
|
+
#
|
336
|
+
# The DOM is created using an HTML parser specified by
|
337
|
+
# Rails::Dom::Testing.default_html_version (either :html4 or :html5).
|
338
|
+
#
|
339
|
+
# When testing in a Rails application, the parser default can also be set by setting
|
340
|
+
# +Rails.application.config.dom_testing_default_html_version+.
|
341
|
+
#
|
342
|
+
# If you want to specify the HTML parser just for a particular assertion, pass
|
343
|
+
# <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
|
344
|
+
#
|
345
|
+
# assert_dom "feed[xmlns='http://www.w3.org/2005/Atom']" do
|
346
|
+
# assert_dom "entry>title" do
|
347
|
+
# assert_dom_encoded(html_version: :html5) do
|
348
|
+
# assert_dom "b"
|
349
|
+
# end
|
350
|
+
# end
|
351
|
+
# end
|
352
|
+
#
|
353
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#232
|
354
|
+
def assert_dom_encoded(element = T.unsafe(nil), html_version: T.unsafe(nil), &block); end
|
355
|
+
|
356
|
+
# An assertion that selects elements and makes one or more equality tests.
|
357
|
+
#
|
358
|
+
# If the first argument is an element, selects all matching elements
|
359
|
+
# starting from (and including) that element and all its children in
|
360
|
+
# depth-first order.
|
361
|
+
#
|
362
|
+
# If no element is specified +assert_dom+ selects from
|
363
|
+
# the element returned in +document_root_element+
|
364
|
+
# unless +assert_dom+ is called from within an +assert_dom+ block.
|
365
|
+
# Override +document_root_element+ to tell +assert_dom+ what to select from.
|
366
|
+
# The default implementation raises an exception explaining this.
|
367
|
+
#
|
368
|
+
# When called with a block +assert_dom+ passes an array of selected elements
|
369
|
+
# to the block. Calling +assert_dom+ from the block, with no element specified,
|
370
|
+
# runs the assertion on the complete set of elements selected by the enclosing assertion.
|
371
|
+
# Alternatively the array may be iterated through so that +assert_dom+ can be called
|
372
|
+
# separately for each element.
|
373
|
+
#
|
374
|
+
#
|
375
|
+
# ==== Example
|
376
|
+
# If the response contains two ordered lists, each with four list elements then:
|
377
|
+
# assert_dom "ol" do |elements|
|
378
|
+
# elements.each do |element|
|
379
|
+
# assert_dom element, "li", 4
|
380
|
+
# end
|
381
|
+
# end
|
382
|
+
#
|
383
|
+
# will pass, as will:
|
384
|
+
# assert_dom "ol" do
|
385
|
+
# assert_dom "li", 8
|
386
|
+
# end
|
387
|
+
#
|
388
|
+
# The selector may be a CSS selector expression (String, Symbol, or Numeric) or an expression
|
389
|
+
# with substitution values (Array).
|
390
|
+
# Substitution uses a custom pseudo class match. Pass in whatever attribute you want to match (enclosed in quotes) and a ? for the substitution.
|
391
|
+
# assert_dom returns nil if called with an invalid css selector.
|
392
|
+
#
|
393
|
+
# assert_dom "div:match('id', ?)", "id_string"
|
394
|
+
# assert_dom "div:match('id', ?)", :id_string
|
395
|
+
# assert_dom "div:match('id', ?)", 1
|
396
|
+
# assert_dom "div:match('id', ?)", /\d+/
|
397
|
+
#
|
398
|
+
# === Equality Tests
|
399
|
+
#
|
400
|
+
# The equality test may be one of the following:
|
401
|
+
# * <tt>true</tt> - Assertion is true if at least one element selected.
|
402
|
+
# * <tt>false</tt> - Assertion is true if no element selected.
|
403
|
+
# * <tt>String/Regexp</tt> - Assertion is true if the text value of at least
|
404
|
+
# one element matches the string or regular expression.
|
405
|
+
# * <tt>Integer</tt> - Assertion is true if exactly that number of
|
406
|
+
# elements are selected.
|
407
|
+
# * <tt>Range</tt> - Assertion is true if the number of selected
|
408
|
+
# elements fit the range.
|
409
|
+
# If no equality test specified, the assertion is true if at least one
|
410
|
+
# element selected.
|
411
|
+
#
|
412
|
+
# To perform more than one equality tests, use a hash with the following keys:
|
413
|
+
# * <tt>:text</tt> - Narrow the selection to elements that have this text
|
414
|
+
# value (string or regexp).
|
415
|
+
# * <tt>:html</tt> - Narrow the selection to elements that have this HTML
|
416
|
+
# content (string or regexp).
|
417
|
+
# * <tt>:count</tt> - Assertion is true if the number of selected elements
|
418
|
+
# is equal to this value.
|
419
|
+
# * <tt>:minimum</tt> - Assertion is true if the number of selected
|
420
|
+
# elements is at least this value.
|
421
|
+
# * <tt>:maximum</tt> - Assertion is true if the number of selected
|
422
|
+
# elements is at most this value.
|
423
|
+
#
|
424
|
+
# If the method is called with a block, once all equality tests are
|
425
|
+
# evaluated the block is called with an array of all matched elements.
|
426
|
+
#
|
427
|
+
# # At least one form element
|
428
|
+
# assert_dom "form"
|
429
|
+
#
|
430
|
+
# # Form element includes four input fields
|
431
|
+
# assert_dom "form input", 4
|
432
|
+
#
|
433
|
+
# # Page title is "Welcome"
|
434
|
+
# assert_dom "title", "Welcome"
|
435
|
+
#
|
436
|
+
# # Page title is "Welcome" and there is only one title element
|
437
|
+
# assert_dom "title", {count: 1, text: "Welcome"},
|
438
|
+
# "Wrong title or more than one title element"
|
439
|
+
#
|
440
|
+
# # Page contains no forms
|
441
|
+
# assert_dom "form", false, "This page must contain no forms"
|
442
|
+
#
|
443
|
+
# # Test the content and style
|
444
|
+
# assert_dom "body div.header ul.menu"
|
445
|
+
#
|
446
|
+
# # Use substitution values
|
447
|
+
# assert_dom "ol>li:match('id', ?)", /item-\d+/
|
448
|
+
#
|
449
|
+
# # All input fields in the form have a name
|
450
|
+
# assert_dom "form input" do
|
451
|
+
# assert_dom ":match('name', ?)", /.+/ # Not empty
|
452
|
+
# end
|
453
|
+
#
|
454
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#163
|
455
|
+
def assert_select(*args, &block); end
|
456
|
+
|
457
|
+
# Extracts the body of an email and runs nested assertions on it.
|
458
|
+
#
|
459
|
+
# You must enable deliveries for this assertion to work, use:
|
460
|
+
# ActionMailer::Base.perform_deliveries = true
|
461
|
+
#
|
462
|
+
# Example usage:
|
463
|
+
#
|
464
|
+
# assert_dom_email do
|
465
|
+
# assert_dom "h1", "Email alert"
|
466
|
+
# end
|
467
|
+
#
|
468
|
+
# assert_dom_email do
|
469
|
+
# items = assert_dom "ol>li"
|
470
|
+
# items.each do
|
471
|
+
# # Work with items here...
|
472
|
+
# end
|
473
|
+
# end
|
474
|
+
#
|
475
|
+
# The DOM is created using an HTML parser specified by
|
476
|
+
# Rails::Dom::Testing.default_html_version (either :html4 or :html5).
|
477
|
+
#
|
478
|
+
# When testing in a Rails application, the parser default can also be set by setting
|
479
|
+
# +Rails.application.config.dom_testing_default_html_version+.
|
480
|
+
#
|
481
|
+
# If you want to specify the HTML parser just for a particular assertion, pass
|
482
|
+
# <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
|
483
|
+
#
|
484
|
+
# assert_dom_email(html_version: :html5) do
|
485
|
+
# assert_dom "h1", "Email alert"
|
486
|
+
# end
|
487
|
+
#
|
488
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#285
|
489
|
+
def assert_select_email(html_version: T.unsafe(nil), &block); end
|
490
|
+
|
491
|
+
# Extracts the content of an element, treats it as encoded HTML and runs
|
492
|
+
# nested assertion on it.
|
493
|
+
#
|
494
|
+
# You typically call this method within another assertion to operate on
|
495
|
+
# all currently selected elements. You can also pass an element or array
|
496
|
+
# of elements.
|
497
|
+
#
|
498
|
+
# The content of each element is un-encoded, and wrapped in the root
|
499
|
+
# element +encoded+. It then calls the block with all un-encoded elements.
|
500
|
+
#
|
501
|
+
# # Selects all bold tags from within the title of an Atom feed's entries (perhaps to nab a section name prefix)
|
502
|
+
# assert_dom "feed[xmlns='http://www.w3.org/2005/Atom']" do
|
503
|
+
# # Select each entry item and then the title item
|
504
|
+
# assert_dom "entry>title" do
|
505
|
+
# # Run assertions on the encoded title elements
|
506
|
+
# assert_dom_encoded do
|
507
|
+
# assert_dom "b"
|
508
|
+
# end
|
509
|
+
# end
|
510
|
+
# end
|
511
|
+
#
|
512
|
+
#
|
513
|
+
# # Selects all paragraph tags from within the description of an RSS feed
|
514
|
+
# assert_dom "rss[version=2.0]" do
|
515
|
+
# # Select description element of each feed item.
|
516
|
+
# assert_dom "channel>item>description" do
|
517
|
+
# # Run assertions on the encoded elements.
|
518
|
+
# assert_dom_encoded do
|
519
|
+
# assert_dom "p"
|
520
|
+
# end
|
521
|
+
# end
|
522
|
+
# end
|
523
|
+
#
|
524
|
+
# The DOM is created using an HTML parser specified by
|
525
|
+
# Rails::Dom::Testing.default_html_version (either :html4 or :html5).
|
526
|
+
#
|
527
|
+
# When testing in a Rails application, the parser default can also be set by setting
|
528
|
+
# +Rails.application.config.dom_testing_default_html_version+.
|
529
|
+
#
|
530
|
+
# If you want to specify the HTML parser just for a particular assertion, pass
|
531
|
+
# <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
|
532
|
+
#
|
533
|
+
# assert_dom "feed[xmlns='http://www.w3.org/2005/Atom']" do
|
534
|
+
# assert_dom "entry>title" do
|
535
|
+
# assert_dom_encoded(html_version: :html5) do
|
536
|
+
# assert_dom "b"
|
537
|
+
# end
|
538
|
+
# end
|
539
|
+
# end
|
540
|
+
#
|
541
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#232
|
542
|
+
def assert_select_encoded(element = T.unsafe(nil), html_version: T.unsafe(nil), &block); end
|
543
|
+
|
544
|
+
# Select and return all matching elements.
|
545
|
+
#
|
546
|
+
# If called with a single argument, uses that argument as a selector.
|
547
|
+
# Called without an element +css_select+ selects from
|
548
|
+
# the element returned in +document_root_element+
|
549
|
+
#
|
550
|
+
# The default implementation of +document_root_element+ raises an exception explaining this.
|
551
|
+
#
|
552
|
+
# Returns an empty Nokogiri::XML::NodeSet if no match is found.
|
553
|
+
#
|
554
|
+
# If called with two arguments, uses the first argument as the root
|
555
|
+
# element and the second argument as the selector. Attempts to match the
|
556
|
+
# root element and any of its children.
|
557
|
+
# Returns an empty Nokogiri::XML::NodeSet if no match is found.
|
558
|
+
#
|
559
|
+
# The selector may be a CSS selector expression (String).
|
560
|
+
# css_select returns nil if called with an invalid css selector.
|
561
|
+
#
|
562
|
+
# # Selects all div tags
|
563
|
+
# divs = css_select("div")
|
564
|
+
#
|
565
|
+
# # Selects all paragraph tags and does something interesting
|
566
|
+
# pars = css_select("p")
|
567
|
+
# pars.each do |par|
|
568
|
+
# # Do something fun with paragraphs here...
|
569
|
+
# end
|
570
|
+
#
|
571
|
+
# # Selects all list items in unordered lists
|
572
|
+
# items = css_select("ul>li")
|
573
|
+
#
|
574
|
+
# # Selects all form tags and then all inputs inside the form
|
575
|
+
# forms = css_select("form")
|
576
|
+
# forms.each do |form|
|
577
|
+
# inputs = css_select(form, "input")
|
578
|
+
# ...
|
579
|
+
# end
|
580
|
+
#
|
581
|
+
# @raise [ArgumentError]
|
582
|
+
#
|
583
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#58
|
584
|
+
def css_select(*args); end
|
585
|
+
|
586
|
+
private
|
587
|
+
|
588
|
+
# +equals+ must contain :minimum, :maximum and :count keys
|
589
|
+
#
|
590
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#307
|
591
|
+
def assert_size_match!(size, equals, css_selector, message = T.unsafe(nil)); end
|
592
|
+
|
593
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#319
|
594
|
+
def count_description(min, max, count); end
|
595
|
+
|
596
|
+
# @raise [NotImplementedError]
|
597
|
+
#
|
598
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#301
|
599
|
+
def document_root_element; end
|
600
|
+
|
601
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#335
|
602
|
+
def nest_selection(selection); end
|
603
|
+
|
604
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#344
|
605
|
+
def nodeset(node); end
|
606
|
+
|
607
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#331
|
608
|
+
def pluralize_element(quantity); end
|
609
|
+
end
|
610
|
+
|
611
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#12
|
612
|
+
class Rails::Dom::Testing::Assertions::SelectorAssertions::HTMLSelector
|
613
|
+
include ::Minitest::Assertions
|
614
|
+
|
615
|
+
# @return [HTMLSelector] a new instance of HTMLSelector
|
616
|
+
#
|
617
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#17
|
618
|
+
def initialize(values, previous_selection = T.unsafe(nil), &root_fallback); end
|
619
|
+
|
620
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#46
|
621
|
+
def context; end
|
622
|
+
|
623
|
+
# Returns the value of attribute css_selector.
|
624
|
+
#
|
625
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#13
|
626
|
+
def css_selector; end
|
627
|
+
|
628
|
+
# Returns the value of attribute message.
|
629
|
+
#
|
630
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#13
|
631
|
+
def message; end
|
632
|
+
|
633
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#39
|
634
|
+
def select; end
|
635
|
+
|
636
|
+
# @return [Boolean]
|
637
|
+
#
|
638
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#33
|
639
|
+
def selecting_no_body?; end
|
640
|
+
|
641
|
+
# Returns the value of attribute tests.
|
642
|
+
#
|
643
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#13
|
644
|
+
def tests; end
|
645
|
+
|
646
|
+
private
|
647
|
+
|
648
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#100
|
649
|
+
def extract_equality_tests; end
|
650
|
+
|
651
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#72
|
652
|
+
def extract_root(previous_selection, root_fallback); end
|
653
|
+
|
654
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#89
|
655
|
+
def extract_selectors; end
|
656
|
+
|
657
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#48
|
658
|
+
def filter(matches); end
|
659
|
+
|
660
|
+
class << self
|
661
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#46
|
662
|
+
def context; end
|
663
|
+
end
|
664
|
+
end
|
665
|
+
|
666
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#44
|
667
|
+
Rails::Dom::Testing::Assertions::SelectorAssertions::HTMLSelector::NO_STRIP = T.let(T.unsafe(nil), Array)
|
668
|
+
|
669
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#8
|
670
|
+
class Rails::Dom::Testing::Assertions::SelectorAssertions::SubstitutionContext
|
671
|
+
# @return [SubstitutionContext] a new instance of SubstitutionContext
|
672
|
+
#
|
673
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#9
|
674
|
+
def initialize; end
|
675
|
+
|
676
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#20
|
677
|
+
def match(matches, attribute, matcher); end
|
678
|
+
|
679
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#13
|
680
|
+
def substitute!(selector, values, format_for_presentation = T.unsafe(nil)); end
|
681
|
+
|
682
|
+
private
|
683
|
+
|
684
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#25
|
685
|
+
def matcher_for(value, format_for_presentation); end
|
686
|
+
|
687
|
+
# @return [Boolean]
|
688
|
+
#
|
689
|
+
# source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#36
|
690
|
+
def substitutable?(value); end
|
691
|
+
end
|