rails_type_id 0.1.0

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.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +25 -0
  3. data/.ruby-version +1 -0
  4. data/README.md +46 -0
  5. data/Rakefile +16 -0
  6. data/lib/rails_type_id/concern.rb +129 -0
  7. data/lib/rails_type_id/require.rb +6 -0
  8. data/lib/rails_type_id/test_helper.rb +16 -0
  9. data/lib/rails_type_id/version.rb +6 -0
  10. data/lib/rails_type_id.rb +9 -0
  11. data/lib/tapioca/dsl/compilers/rails_type_id_compiler.rb +49 -0
  12. data/sig/rails_type_id.rbs +4 -0
  13. data/sorbet/config +4 -0
  14. data/sorbet/rbi/annotations/.gitattributes +1 -0
  15. data/sorbet/rbi/annotations/actionmailer.rbi +10 -0
  16. data/sorbet/rbi/annotations/actionpack.rbi +430 -0
  17. data/sorbet/rbi/annotations/actionview.rbi +75 -0
  18. data/sorbet/rbi/annotations/activejob.rbi +44 -0
  19. data/sorbet/rbi/annotations/activemodel.rbi +89 -0
  20. data/sorbet/rbi/annotations/activerecord.rbi +98 -0
  21. data/sorbet/rbi/annotations/activesupport.rbi +468 -0
  22. data/sorbet/rbi/annotations/globalid.rbi +30 -0
  23. data/sorbet/rbi/annotations/minitest.rbi +119 -0
  24. data/sorbet/rbi/annotations/railties.rbi +61 -0
  25. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  26. data/sorbet/rbi/dsl/.gitattributes +1 -0
  27. data/sorbet/rbi/dsl/active_model/validations/callbacks.rbi +21 -0
  28. data/sorbet/rbi/dsl/active_model/validations.rbi +26 -0
  29. data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
  30. data/sorbet/rbi/dsl/rails_type_id/concern.rbi +22 -0
  31. data/sorbet/rbi/gems/.gitattributes +1 -0
  32. data/sorbet/rbi/gems/actioncable@8.0.2.rbi +3133 -0
  33. data/sorbet/rbi/gems/actionmailbox@8.0.2.rbi +991 -0
  34. data/sorbet/rbi/gems/actionmailer@8.0.2.rbi +2775 -0
  35. data/sorbet/rbi/gems/actionpack@8.0.2.rbi +21167 -0
  36. data/sorbet/rbi/gems/actiontext@8.0.2.rbi +1449 -0
  37. data/sorbet/rbi/gems/actionview@8.0.2.rbi +15789 -0
  38. data/sorbet/rbi/gems/activejob@8.0.2.rbi +2864 -0
  39. data/sorbet/rbi/gems/activemodel@8.0.2.rbi +6946 -0
  40. data/sorbet/rbi/gems/activerecord@8.0.2.rbi +42458 -0
  41. data/sorbet/rbi/gems/activestorage@8.0.2.rbi +2156 -0
  42. data/sorbet/rbi/gems/activesupport@8.0.2.rbi +21274 -0
  43. data/sorbet/rbi/gems/ast@2.4.3.rbi +586 -0
  44. data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
  45. data/sorbet/rbi/gems/benchmark@0.4.1.rbi +619 -0
  46. data/sorbet/rbi/gems/bigdecimal@3.2.2.rbi +275 -0
  47. data/sorbet/rbi/gems/builder@3.3.0.rbi +9 -0
  48. data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +11734 -0
  49. data/sorbet/rbi/gems/connection_pool@2.5.3.rbi +9 -0
  50. data/sorbet/rbi/gems/crass@1.0.6.rbi +623 -0
  51. data/sorbet/rbi/gems/date@3.4.1.rbi +403 -0
  52. data/sorbet/rbi/gems/drb@2.2.3.rbi +1661 -0
  53. data/sorbet/rbi/gems/erb@5.0.2.rbi +878 -0
  54. data/sorbet/rbi/gems/erubi@1.13.1.rbi +157 -0
  55. data/sorbet/rbi/gems/globalid@1.2.1.rbi +742 -0
  56. data/sorbet/rbi/gems/i18n@1.14.7.rbi +2383 -0
  57. data/sorbet/rbi/gems/io-console@0.8.1.rbi +9 -0
  58. data/sorbet/rbi/gems/json@2.12.2.rbi +2287 -0
  59. data/sorbet/rbi/gems/language_server-protocol@3.17.0.5.rbi +9 -0
  60. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +323 -0
  61. data/sorbet/rbi/gems/logger@1.7.0.rbi +963 -0
  62. data/sorbet/rbi/gems/loofah@2.24.1.rbi +1105 -0
  63. data/sorbet/rbi/gems/mail@2.8.1.rbi +8890 -0
  64. data/sorbet/rbi/gems/marcel@1.0.4.rbi +239 -0
  65. data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +173 -0
  66. data/sorbet/rbi/gems/minitest@5.25.5.rbi +2231 -0
  67. data/sorbet/rbi/gems/net-imap@0.5.9.rbi +10285 -0
  68. data/sorbet/rbi/gems/net-pop@0.1.2.rbi +927 -0
  69. data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +292 -0
  70. data/sorbet/rbi/gems/net-smtp@0.5.1.rbi +1240 -0
  71. data/sorbet/rbi/gems/netrc@0.11.0.rbi +177 -0
  72. data/sorbet/rbi/gems/nio4r@2.7.4.rbi +388 -0
  73. data/sorbet/rbi/gems/nokogiri@1.18.9.rbi +8548 -0
  74. data/sorbet/rbi/gems/parallel@1.27.0.rbi +291 -0
  75. data/sorbet/rbi/gems/parser@3.3.9.0.rbi +5537 -0
  76. data/sorbet/rbi/gems/pp@0.6.2.rbi +368 -0
  77. data/sorbet/rbi/gems/prettyprint@0.2.0.rbi +477 -0
  78. data/sorbet/rbi/gems/prism@1.4.0.rbi +41790 -0
  79. data/sorbet/rbi/gems/psych@5.2.6.rbi +2542 -0
  80. data/sorbet/rbi/gems/racc@1.8.1.rbi +168 -0
  81. data/sorbet/rbi/gems/rack-session@2.1.1.rbi +722 -0
  82. data/sorbet/rbi/gems/rack-test@2.2.0.rbi +729 -0
  83. data/sorbet/rbi/gems/rack@3.2.0.rbi +5054 -0
  84. data/sorbet/rbi/gems/rackup@2.2.1.rbi +230 -0
  85. data/sorbet/rbi/gems/rails-dom-testing@2.3.0.rbi +790 -0
  86. data/sorbet/rbi/gems/rails-html-sanitizer@1.6.2.rbi +645 -0
  87. data/sorbet/rbi/gems/rails@8.0.2.rbi +9 -0
  88. data/sorbet/rbi/gems/railties@8.0.2.rbi +4014 -0
  89. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
  90. data/sorbet/rbi/gems/rake@13.3.0.rbi +3039 -0
  91. data/sorbet/rbi/gems/rbi@0.3.6.rbi +5162 -0
  92. data/sorbet/rbi/gems/rbs@4.0.0.dev.4.rbi +7895 -0
  93. data/sorbet/rbi/gems/rdoc@6.14.2.rbi +12944 -0
  94. data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +3833 -0
  95. data/sorbet/rbi/gems/reline@0.6.2.rbi +9 -0
  96. data/sorbet/rbi/gems/require-hooks@0.2.2.rbi +110 -0
  97. data/sorbet/rbi/gems/rexml@3.4.1.rbi +5205 -0
  98. data/sorbet/rbi/gems/rubocop-ast@1.46.0.rbi +7473 -0
  99. data/sorbet/rbi/gems/rubocop-sorbet@0.10.5.rbi +2386 -0
  100. data/sorbet/rbi/gems/rubocop@1.79.1.rbi +63674 -0
  101. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
  102. data/sorbet/rbi/gems/securerandom@0.4.1.rbi +75 -0
  103. data/sorbet/rbi/gems/spoom@1.7.5.rbi +5832 -0
  104. data/sorbet/rbi/gems/sqlite3@2.7.3.rbi +1989 -0
  105. data/sorbet/rbi/gems/stringio@3.1.7.rbi +9 -0
  106. data/sorbet/rbi/gems/tapioca@0.17.7.rbi +3692 -0
  107. data/sorbet/rbi/gems/thor@1.4.0.rbi +4399 -0
  108. data/sorbet/rbi/gems/timeout@0.4.3.rbi +157 -0
  109. data/sorbet/rbi/gems/typeid@0.2.2.rbi +239 -0
  110. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5919 -0
  111. data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +132 -0
  112. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +251 -0
  113. data/sorbet/rbi/gems/uri@1.0.3.rbi +2354 -0
  114. data/sorbet/rbi/gems/useragent@0.16.11.rbi +9 -0
  115. data/sorbet/rbi/gems/uuid7@0.2.0.rbi +60 -0
  116. data/sorbet/rbi/gems/websocket-driver@0.8.0.rbi +1065 -0
  117. data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +117 -0
  118. data/sorbet/rbi/gems/with_model@2.2.0.rbi +282 -0
  119. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +430 -0
  120. data/sorbet/rbi/gems/yard@0.9.37.rbi +18512 -0
  121. data/sorbet/rbi/gems/zeitwerk@2.7.3.rbi +1196 -0
  122. data/sorbet/tapioca/config.yml +13 -0
  123. data/sorbet/tapioca/require.rb +13 -0
  124. metadata +208 -0
@@ -0,0 +1,790 @@
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
+
8
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#3
9
+ module Rails; end
10
+
11
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#4
12
+ module Rails::Dom; end
13
+
14
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#5
15
+ module Rails::Dom::Testing
16
+ # source://rails-dom-testing//lib/rails/dom/testing.rb#12
17
+ def default_html_version; end
18
+
19
+ # source://rails-dom-testing//lib/rails/dom/testing.rb#12
20
+ def default_html_version=(val); end
21
+
22
+ class << self
23
+ # source://rails-dom-testing//lib/rails/dom/testing.rb#12
24
+ def default_html_version; end
25
+
26
+ # source://rails-dom-testing//lib/rails/dom/testing.rb#12
27
+ def default_html_version=(val); end
28
+
29
+ # @return [Boolean]
30
+ #
31
+ # source://rails-dom-testing//lib/rails/dom/testing.rb#15
32
+ def html5_support?; end
33
+
34
+ # source://rails-dom-testing//lib/rails/dom/testing.rb#19
35
+ def html_document(html_version: T.unsafe(nil)); end
36
+
37
+ # source://rails-dom-testing//lib/rails/dom/testing.rb#26
38
+ def html_document_fragment(html_version: T.unsafe(nil)); end
39
+
40
+ private
41
+
42
+ # source://rails-dom-testing//lib/rails/dom/testing.rb#34
43
+ def choose_html_parser(parser_classes, html_version: T.unsafe(nil)); end
44
+ end
45
+ end
46
+
47
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#6
48
+ module Rails::Dom::Testing::Assertions
49
+ include ::Rails::Dom::Testing::Assertions::DomAssertions
50
+ include ::Rails::Dom::Testing::Assertions::SelectorAssertions
51
+ end
52
+
53
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#7
54
+ module Rails::Dom::Testing::Assertions::DomAssertions
55
+ # \Test two HTML strings for equivalency (e.g., equal even when attributes are in another order)
56
+ #
57
+ # # assert that the referenced method generates the appropriate HTML string
58
+ # assert_dom_equal(
59
+ # '<a href="http://www.example.com">Apples</a>',
60
+ # link_to("Apples", "http://www.example.com"),
61
+ # )
62
+ #
63
+ # By default, the matcher will not pay attention to whitespace in text nodes (e.g., spaces
64
+ # and newlines). If you want stricter matching with exact matching for whitespace, pass
65
+ # <tt>strict: true</tt>:
66
+ #
67
+ # # these assertions will both pass
68
+ # assert_dom_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: false
69
+ # assert_dom_not_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: true
70
+ #
71
+ # The DOMs are created using an HTML parser specified by
72
+ # Rails::Dom::Testing.default_html_version (either :html4 or :html5).
73
+ #
74
+ # When testing in a Rails application, the parser default can also be set by setting
75
+ # +Rails.application.config.dom_testing_default_html_version+.
76
+ #
77
+ # If you want to specify the HTML parser just for a particular assertion, pass
78
+ # <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
79
+ #
80
+ # assert_dom_equal expected, actual, html_version: :html5
81
+ #
82
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#35
83
+ def assert_dom_equal(expected, actual, message = T.unsafe(nil), strict: T.unsafe(nil), html_version: T.unsafe(nil)); end
84
+
85
+ # The negated form of +assert_dom_equal+.
86
+ #
87
+ # # assert that the referenced method does not generate the specified HTML string
88
+ # assert_dom_not_equal(
89
+ # '<a href="http://www.example.com">Apples</a>',
90
+ # link_to("Oranges", "http://www.example.com"),
91
+ # )
92
+ #
93
+ # By default, the matcher will not pay attention to whitespace in text nodes (e.g., spaces
94
+ # and newlines). If you want stricter matching with exact matching for whitespace, pass
95
+ # <tt>strict: true</tt>:
96
+ #
97
+ # # these assertions will both pass
98
+ # assert_dom_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: false
99
+ # assert_dom_not_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: true
100
+ #
101
+ # The DOMs are created using an HTML parser specified by
102
+ # Rails::Dom::Testing.default_html_version (either :html4 or :html5).
103
+ #
104
+ # When testing in a Rails application, the parser default can also be set by setting
105
+ # +Rails.application.config.dom_testing_default_html_version+.
106
+ #
107
+ # If you want to specify the HTML parser just for a particular assertion, pass
108
+ # <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
109
+ #
110
+ # assert_dom_not_equal expected, actual, html_version: :html5
111
+ #
112
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#68
113
+ def assert_dom_not_equal(expected, actual, message = T.unsafe(nil), strict: T.unsafe(nil), html_version: T.unsafe(nil)); end
114
+
115
+ # The negated form of +assert_dom_equal+.
116
+ #
117
+ # # assert that the referenced method does not generate the specified HTML string
118
+ # assert_dom_not_equal(
119
+ # '<a href="http://www.example.com">Apples</a>',
120
+ # link_to("Oranges", "http://www.example.com"),
121
+ # )
122
+ #
123
+ # By default, the matcher will not pay attention to whitespace in text nodes (e.g., spaces
124
+ # and newlines). If you want stricter matching with exact matching for whitespace, pass
125
+ # <tt>strict: true</tt>:
126
+ #
127
+ # # these assertions will both pass
128
+ # assert_dom_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: false
129
+ # assert_dom_not_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: true
130
+ #
131
+ # The DOMs are created using an HTML parser specified by
132
+ # Rails::Dom::Testing.default_html_version (either :html4 or :html5).
133
+ #
134
+ # When testing in a Rails application, the parser default can also be set by setting
135
+ # +Rails.application.config.dom_testing_default_html_version+.
136
+ #
137
+ # If you want to specify the HTML parser just for a particular assertion, pass
138
+ # <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
139
+ #
140
+ # assert_dom_not_equal expected, actual, html_version: :html5
141
+ #
142
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#73
143
+ def refute_dom_equal(expected, actual, message = T.unsafe(nil), strict: T.unsafe(nil), html_version: T.unsafe(nil)); end
144
+
145
+ protected
146
+
147
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#76
148
+ def compare_doms(expected, actual, strict); end
149
+
150
+ # @return [Boolean]
151
+ #
152
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#129
153
+ def equal_attribute?(attr, other_attr); end
154
+
155
+ # @return [Boolean]
156
+ #
157
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#116
158
+ def equal_attribute_nodes?(nodes, other_nodes); end
159
+
160
+ # @return [Boolean]
161
+ #
162
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#108
163
+ def equal_child?(child, other_child, strict); end
164
+
165
+ # @return [Boolean]
166
+ #
167
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#96
168
+ def equal_children?(child, other_child, strict); end
169
+
170
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#88
171
+ def extract_children(node, strict); end
172
+
173
+ private
174
+
175
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/dom_assertions.rb#134
176
+ def fragment(text, html_version: T.unsafe(nil)); end
177
+ end
178
+
179
+ # Adds the +assert_dom+ method for use in Rails functional
180
+ # test cases, which can be used to make assertions on the response HTML of a controller
181
+ # action. You can also call +assert_dom+ within another +assert_dom+ to
182
+ # make assertions on elements selected by the enclosing assertion.
183
+ #
184
+ # Use +css_select+ to select elements without making an assertions, either
185
+ # from the response HTML or elements selected by the enclosing assertion.
186
+ #
187
+ # In addition to HTML responses, you can make the following assertions:
188
+ #
189
+ # * +assert_dom_encoded+ - Assertions on HTML encoded inside XML, for example for dealing with feed item descriptions.
190
+ # * +assert_dom_email+ - Assertions on the HTML body of an e-mail.
191
+ #
192
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#7
193
+ module Rails::Dom::Testing::Assertions::SelectorAssertions
194
+ # An assertion that selects elements and makes one or more equality tests.
195
+ #
196
+ # If the first argument is an element, selects all matching elements
197
+ # starting from (and including) that element and all its children in
198
+ # depth-first order.
199
+ #
200
+ # If no element is specified +assert_dom+ selects from
201
+ # the element returned in +document_root_element+
202
+ # unless +assert_dom+ is called from within an +assert_dom+ block.
203
+ # Override +document_root_element+ to tell +assert_dom+ what to select from.
204
+ # The default implementation raises an exception explaining this.
205
+ #
206
+ # When called with a block +assert_dom+ passes an array of selected elements
207
+ # to the block. Calling +assert_dom+ from the block, with no element specified,
208
+ # runs the assertion on the complete set of elements selected by the enclosing assertion.
209
+ # Alternatively the array may be iterated through so that +assert_dom+ can be called
210
+ # separately for each element.
211
+ #
212
+ #
213
+ # ==== Example
214
+ # If the response contains two ordered lists, each with four list elements then:
215
+ # assert_dom "ol" do |elements|
216
+ # elements.each do |element|
217
+ # assert_dom element, "li", 4
218
+ # end
219
+ # end
220
+ #
221
+ # will pass, as will:
222
+ # assert_dom "ol" do
223
+ # assert_dom "li", 8
224
+ # end
225
+ #
226
+ # The selector may be a CSS selector expression (String, Symbol, or Numeric) or an expression
227
+ # with substitution values (Array).
228
+ # Substitution uses a custom pseudo class match. Pass in whatever attribute you want to match (enclosed in quotes) and a ? for the substitution.
229
+ # assert_dom returns nil if called with an invalid css selector.
230
+ #
231
+ # assert_dom "div:match('id', ?)", "id_string"
232
+ # assert_dom "div:match('id', ?)", :id_string
233
+ # assert_dom "div:match('id', ?)", 1
234
+ # assert_dom "div:match('id', ?)", /\d+/
235
+ #
236
+ # === Equality Tests
237
+ #
238
+ # The equality test may be one of the following:
239
+ # * <tt>true</tt> - Assertion is true if at least one element selected.
240
+ # * <tt>false</tt> - Assertion is true if no element selected.
241
+ # * <tt>String/Regexp</tt> - Assertion is true if the text value of at least
242
+ # one element matches the string or regular expression.
243
+ # * <tt>Integer</tt> - Assertion is true if exactly that number of
244
+ # elements are selected.
245
+ # * <tt>Range</tt> - Assertion is true if the number of selected
246
+ # elements fit the range.
247
+ # If no equality test specified, the assertion is true if at least one
248
+ # element selected.
249
+ #
250
+ # To perform more than one equality tests, use a hash with the following keys:
251
+ # * <tt>:text</tt> - Narrow the selection to elements that have this text
252
+ # value (string or regexp).
253
+ # * <tt>:html</tt> - Narrow the selection to elements that have this HTML
254
+ # content (string or regexp).
255
+ # * <tt>:count</tt> - Assertion is true if the number of selected elements
256
+ # is equal to this value.
257
+ # * <tt>:minimum</tt> - Assertion is true if the number of selected
258
+ # elements is at least this value.
259
+ # * <tt>:maximum</tt> - Assertion is true if the number of selected
260
+ # elements is at most this value.
261
+ #
262
+ # If the method is called with a block, once all equality tests are
263
+ # evaluated the block is called with an array of all matched elements.
264
+ #
265
+ # # At least one form element
266
+ # assert_dom "form"
267
+ #
268
+ # # Form element includes four input fields
269
+ # assert_dom "form input", 4
270
+ #
271
+ # # Page title is "Welcome"
272
+ # assert_dom "title", "Welcome"
273
+ #
274
+ # # Page title is "Welcome" and there is only one title element
275
+ # assert_dom "title", {count: 1, text: "Welcome"},
276
+ # "Wrong title or more than one title element"
277
+ #
278
+ # # Page contains no forms
279
+ # assert_dom "form", false, "This page must contain no forms"
280
+ #
281
+ # # Test the content and style
282
+ # assert_dom "body div.header ul.menu"
283
+ #
284
+ # # Use substitution values
285
+ # assert_dom "ol>li:match('id', ?)", /item-\d+/
286
+ #
287
+ # # All input fields in the form have a name
288
+ # assert_dom "form input" do
289
+ # assert_dom ":match('name', ?)", /.+/ # Not empty
290
+ # end
291
+ #
292
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#163
293
+ def assert_dom(*args, &block); end
294
+
295
+ # Extracts the body of an email and runs nested assertions on it.
296
+ #
297
+ # You must enable deliveries for this assertion to work, use:
298
+ # ActionMailer::Base.perform_deliveries = true
299
+ #
300
+ # Example usage:
301
+ #
302
+ # assert_dom_email do
303
+ # assert_dom "h1", "Email alert"
304
+ # end
305
+ #
306
+ # assert_dom_email do
307
+ # items = assert_dom "ol>li"
308
+ # items.each do
309
+ # # Work with items here...
310
+ # end
311
+ # end
312
+ #
313
+ # The DOM is created using an HTML parser specified by
314
+ # Rails::Dom::Testing.default_html_version (either :html4 or :html5).
315
+ #
316
+ # When testing in a Rails application, the parser default can also be set by setting
317
+ # +Rails.application.config.dom_testing_default_html_version+.
318
+ #
319
+ # If you want to specify the HTML parser just for a particular assertion, pass
320
+ # <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
321
+ #
322
+ # assert_dom_email(html_version: :html5) do
323
+ # assert_dom "h1", "Email alert"
324
+ # end
325
+ #
326
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#318
327
+ def assert_dom_email(html_version: T.unsafe(nil), &block); end
328
+
329
+ # Extracts the content of an element, treats it as encoded HTML and runs
330
+ # nested assertion on it.
331
+ #
332
+ # You typically call this method within another assertion to operate on
333
+ # all currently selected elements. You can also pass an element or array
334
+ # of elements.
335
+ #
336
+ # The content of each element is un-encoded, and wrapped in the root
337
+ # element +encoded+. It then calls the block with all un-encoded elements.
338
+ #
339
+ # # Selects all bold tags from within the title of an Atom feed's entries (perhaps to nab a section name prefix)
340
+ # assert_dom "feed[xmlns='http://www.w3.org/2005/Atom']" do
341
+ # # Select each entry item and then the title item
342
+ # assert_dom "entry>title" do
343
+ # # Run assertions on the encoded title elements
344
+ # assert_dom_encoded do
345
+ # assert_dom "b"
346
+ # end
347
+ # end
348
+ # end
349
+ #
350
+ #
351
+ # # Selects all paragraph tags from within the description of an RSS feed
352
+ # assert_dom "rss[version=2.0]" do
353
+ # # Select description element of each feed item.
354
+ # assert_dom "channel>item>description" do
355
+ # # Run assertions on the encoded elements.
356
+ # assert_dom_encoded do
357
+ # assert_dom "p"
358
+ # end
359
+ # end
360
+ # end
361
+ #
362
+ # The DOM is created using an HTML parser specified by
363
+ # Rails::Dom::Testing.default_html_version (either :html4 or :html5).
364
+ #
365
+ # When testing in a Rails application, the parser default can also be set by setting
366
+ # +Rails.application.config.dom_testing_default_html_version+.
367
+ #
368
+ # If you want to specify the HTML parser just for a particular assertion, pass
369
+ # <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
370
+ #
371
+ # assert_dom "feed[xmlns='http://www.w3.org/2005/Atom']" do
372
+ # assert_dom "entry>title" do
373
+ # assert_dom_encoded(html_version: :html5) do
374
+ # assert_dom "b"
375
+ # end
376
+ # end
377
+ # end
378
+ #
379
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#265
380
+ def assert_dom_encoded(element = T.unsafe(nil), html_version: T.unsafe(nil), &block); end
381
+
382
+ # The negated form of +assert_dom+.
383
+ #
384
+ # === Equality Tests
385
+ #
386
+ # Supports the same equality tests as +assert_dom+ except for:
387
+ # * <tt>true</tt>
388
+ # * <tt>false</tt>
389
+ # * <tt>Integer</tt>
390
+ # * <tt>Range</tt>
391
+ # * <tt>:count</tt>
392
+ # * <tt>:minimum</tt>
393
+ # * <tt>:maximum</tt>
394
+ #
395
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#183
396
+ def assert_not_dom(*args, &block); end
397
+
398
+ # The negated form of +assert_dom+.
399
+ #
400
+ # === Equality Tests
401
+ #
402
+ # Supports the same equality tests as +assert_dom+ except for:
403
+ # * <tt>true</tt>
404
+ # * <tt>false</tt>
405
+ # * <tt>Integer</tt>
406
+ # * <tt>Range</tt>
407
+ # * <tt>:count</tt>
408
+ # * <tt>:minimum</tt>
409
+ # * <tt>:maximum</tt>
410
+ #
411
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#190
412
+ def assert_not_select(*args, &block); end
413
+
414
+ # An assertion that selects elements and makes one or more equality tests.
415
+ #
416
+ # If the first argument is an element, selects all matching elements
417
+ # starting from (and including) that element and all its children in
418
+ # depth-first order.
419
+ #
420
+ # If no element is specified +assert_dom+ selects from
421
+ # the element returned in +document_root_element+
422
+ # unless +assert_dom+ is called from within an +assert_dom+ block.
423
+ # Override +document_root_element+ to tell +assert_dom+ what to select from.
424
+ # The default implementation raises an exception explaining this.
425
+ #
426
+ # When called with a block +assert_dom+ passes an array of selected elements
427
+ # to the block. Calling +assert_dom+ from the block, with no element specified,
428
+ # runs the assertion on the complete set of elements selected by the enclosing assertion.
429
+ # Alternatively the array may be iterated through so that +assert_dom+ can be called
430
+ # separately for each element.
431
+ #
432
+ #
433
+ # ==== Example
434
+ # If the response contains two ordered lists, each with four list elements then:
435
+ # assert_dom "ol" do |elements|
436
+ # elements.each do |element|
437
+ # assert_dom element, "li", 4
438
+ # end
439
+ # end
440
+ #
441
+ # will pass, as will:
442
+ # assert_dom "ol" do
443
+ # assert_dom "li", 8
444
+ # end
445
+ #
446
+ # The selector may be a CSS selector expression (String, Symbol, or Numeric) or an expression
447
+ # with substitution values (Array).
448
+ # Substitution uses a custom pseudo class match. Pass in whatever attribute you want to match (enclosed in quotes) and a ? for the substitution.
449
+ # assert_dom returns nil if called with an invalid css selector.
450
+ #
451
+ # assert_dom "div:match('id', ?)", "id_string"
452
+ # assert_dom "div:match('id', ?)", :id_string
453
+ # assert_dom "div:match('id', ?)", 1
454
+ # assert_dom "div:match('id', ?)", /\d+/
455
+ #
456
+ # === Equality Tests
457
+ #
458
+ # The equality test may be one of the following:
459
+ # * <tt>true</tt> - Assertion is true if at least one element selected.
460
+ # * <tt>false</tt> - Assertion is true if no element selected.
461
+ # * <tt>String/Regexp</tt> - Assertion is true if the text value of at least
462
+ # one element matches the string or regular expression.
463
+ # * <tt>Integer</tt> - Assertion is true if exactly that number of
464
+ # elements are selected.
465
+ # * <tt>Range</tt> - Assertion is true if the number of selected
466
+ # elements fit the range.
467
+ # If no equality test specified, the assertion is true if at least one
468
+ # element selected.
469
+ #
470
+ # To perform more than one equality tests, use a hash with the following keys:
471
+ # * <tt>:text</tt> - Narrow the selection to elements that have this text
472
+ # value (string or regexp).
473
+ # * <tt>:html</tt> - Narrow the selection to elements that have this HTML
474
+ # content (string or regexp).
475
+ # * <tt>:count</tt> - Assertion is true if the number of selected elements
476
+ # is equal to this value.
477
+ # * <tt>:minimum</tt> - Assertion is true if the number of selected
478
+ # elements is at least this value.
479
+ # * <tt>:maximum</tt> - Assertion is true if the number of selected
480
+ # elements is at most this value.
481
+ #
482
+ # If the method is called with a block, once all equality tests are
483
+ # evaluated the block is called with an array of all matched elements.
484
+ #
485
+ # # At least one form element
486
+ # assert_dom "form"
487
+ #
488
+ # # Form element includes four input fields
489
+ # assert_dom "form input", 4
490
+ #
491
+ # # Page title is "Welcome"
492
+ # assert_dom "title", "Welcome"
493
+ #
494
+ # # Page title is "Welcome" and there is only one title element
495
+ # assert_dom "title", {count: 1, text: "Welcome"},
496
+ # "Wrong title or more than one title element"
497
+ #
498
+ # # Page contains no forms
499
+ # assert_dom "form", false, "This page must contain no forms"
500
+ #
501
+ # # Test the content and style
502
+ # assert_dom "body div.header ul.menu"
503
+ #
504
+ # # Use substitution values
505
+ # assert_dom "ol>li:match('id', ?)", /item-\d+/
506
+ #
507
+ # # All input fields in the form have a name
508
+ # assert_dom "form input" do
509
+ # assert_dom ":match('name', ?)", /.+/ # Not empty
510
+ # end
511
+ #
512
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#169
513
+ def assert_select(*args, &block); end
514
+
515
+ # Extracts the body of an email and runs nested assertions on it.
516
+ #
517
+ # You must enable deliveries for this assertion to work, use:
518
+ # ActionMailer::Base.perform_deliveries = true
519
+ #
520
+ # Example usage:
521
+ #
522
+ # assert_dom_email do
523
+ # assert_dom "h1", "Email alert"
524
+ # end
525
+ #
526
+ # assert_dom_email do
527
+ # items = assert_dom "ol>li"
528
+ # items.each do
529
+ # # Work with items here...
530
+ # end
531
+ # end
532
+ #
533
+ # The DOM is created using an HTML parser specified by
534
+ # Rails::Dom::Testing.default_html_version (either :html4 or :html5).
535
+ #
536
+ # When testing in a Rails application, the parser default can also be set by setting
537
+ # +Rails.application.config.dom_testing_default_html_version+.
538
+ #
539
+ # If you want to specify the HTML parser just for a particular assertion, pass
540
+ # <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
541
+ #
542
+ # assert_dom_email(html_version: :html5) do
543
+ # assert_dom "h1", "Email alert"
544
+ # end
545
+ #
546
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#331
547
+ def assert_select_email(html_version: T.unsafe(nil), &block); end
548
+
549
+ # Extracts the content of an element, treats it as encoded HTML and runs
550
+ # nested assertion on it.
551
+ #
552
+ # You typically call this method within another assertion to operate on
553
+ # all currently selected elements. You can also pass an element or array
554
+ # of elements.
555
+ #
556
+ # The content of each element is un-encoded, and wrapped in the root
557
+ # element +encoded+. It then calls the block with all un-encoded elements.
558
+ #
559
+ # # Selects all bold tags from within the title of an Atom feed's entries (perhaps to nab a section name prefix)
560
+ # assert_dom "feed[xmlns='http://www.w3.org/2005/Atom']" do
561
+ # # Select each entry item and then the title item
562
+ # assert_dom "entry>title" do
563
+ # # Run assertions on the encoded title elements
564
+ # assert_dom_encoded do
565
+ # assert_dom "b"
566
+ # end
567
+ # end
568
+ # end
569
+ #
570
+ #
571
+ # # Selects all paragraph tags from within the description of an RSS feed
572
+ # assert_dom "rss[version=2.0]" do
573
+ # # Select description element of each feed item.
574
+ # assert_dom "channel>item>description" do
575
+ # # Run assertions on the encoded elements.
576
+ # assert_dom_encoded do
577
+ # assert_dom "p"
578
+ # end
579
+ # end
580
+ # end
581
+ #
582
+ # The DOM is created using an HTML parser specified by
583
+ # Rails::Dom::Testing.default_html_version (either :html4 or :html5).
584
+ #
585
+ # When testing in a Rails application, the parser default can also be set by setting
586
+ # +Rails.application.config.dom_testing_default_html_version+.
587
+ #
588
+ # If you want to specify the HTML parser just for a particular assertion, pass
589
+ # <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
590
+ #
591
+ # assert_dom "feed[xmlns='http://www.w3.org/2005/Atom']" do
592
+ # assert_dom "entry>title" do
593
+ # assert_dom_encoded(html_version: :html5) do
594
+ # assert_dom "b"
595
+ # end
596
+ # end
597
+ # end
598
+ #
599
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#285
600
+ def assert_select_encoded(element = T.unsafe(nil), html_version: T.unsafe(nil), &block); end
601
+
602
+ # Select and return all matching elements.
603
+ #
604
+ # If called with a single argument, uses that argument as a selector.
605
+ # Called without an element +css_select+ selects from
606
+ # the element returned in +document_root_element+
607
+ #
608
+ # The default implementation of +document_root_element+ raises an exception explaining this.
609
+ #
610
+ # Returns an empty Nokogiri::XML::NodeSet if no match is found.
611
+ #
612
+ # If called with two arguments, uses the first argument as the root
613
+ # element and the second argument as the selector. Attempts to match the
614
+ # root element and any of its children.
615
+ # Returns an empty Nokogiri::XML::NodeSet if no match is found.
616
+ #
617
+ # The selector may be a CSS selector expression (String).
618
+ # css_select returns nil if called with an invalid css selector.
619
+ #
620
+ # # Selects all div tags
621
+ # divs = css_select("div")
622
+ #
623
+ # # Selects all paragraph tags and does something interesting
624
+ # pars = css_select("p")
625
+ # pars.each do |par|
626
+ # # Do something fun with paragraphs here...
627
+ # end
628
+ #
629
+ # # Selects all list items in unordered lists
630
+ # items = css_select("ul>li")
631
+ #
632
+ # # Selects all form tags and then all inputs inside the form
633
+ # forms = css_select("form")
634
+ # forms.each do |form|
635
+ # inputs = css_select(form, "input")
636
+ # ...
637
+ # end
638
+ #
639
+ # @raise [ArgumentError]
640
+ #
641
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#58
642
+ def css_select(*args); end
643
+
644
+ # The negated form of +assert_dom+.
645
+ #
646
+ # === Equality Tests
647
+ #
648
+ # Supports the same equality tests as +assert_dom+ except for:
649
+ # * <tt>true</tt>
650
+ # * <tt>false</tt>
651
+ # * <tt>Integer</tt>
652
+ # * <tt>Range</tt>
653
+ # * <tt>:count</tt>
654
+ # * <tt>:minimum</tt>
655
+ # * <tt>:maximum</tt>
656
+ #
657
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#189
658
+ def refute_dom(*args, &block); end
659
+
660
+ # The negated form of +assert_dom+.
661
+ #
662
+ # === Equality Tests
663
+ #
664
+ # Supports the same equality tests as +assert_dom+ except for:
665
+ # * <tt>true</tt>
666
+ # * <tt>false</tt>
667
+ # * <tt>Integer</tt>
668
+ # * <tt>Range</tt>
669
+ # * <tt>:count</tt>
670
+ # * <tt>:minimum</tt>
671
+ # * <tt>:maximum</tt>
672
+ #
673
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#191
674
+ def refute_select(*args, &block); end
675
+
676
+ private
677
+
678
+ # +equals+ must contain :minimum, :maximum and :count keys
679
+ #
680
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#340
681
+ def assert_size_match!(size, equals, css_selector, message = T.unsafe(nil)); end
682
+
683
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#352
684
+ def count_description(min, max, count); end
685
+
686
+ # @raise [NotImplementedError]
687
+ #
688
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#334
689
+ def document_root_element; end
690
+
691
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#193
692
+ def dom_assertions(selector, &block); end
693
+
694
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#368
695
+ def nest_selection(selection); end
696
+
697
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#377
698
+ def nodeset(node); end
699
+
700
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions.rb#364
701
+ def pluralize_element(quantity); end
702
+ end
703
+
704
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#12
705
+ class Rails::Dom::Testing::Assertions::SelectorAssertions::HTMLSelector
706
+ include ::Minitest::Assertions
707
+
708
+ # @return [HTMLSelector] a new instance of HTMLSelector
709
+ #
710
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#17
711
+ def initialize(values, previous_selection = T.unsafe(nil), refute: T.unsafe(nil), &root_fallback); end
712
+
713
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#46
714
+ def context; end
715
+
716
+ # Returns the value of attribute css_selector.
717
+ #
718
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#13
719
+ def css_selector; end
720
+
721
+ # Returns the value of attribute message.
722
+ #
723
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#13
724
+ def message; end
725
+
726
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#39
727
+ def select; end
728
+
729
+ # @return [Boolean]
730
+ #
731
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#33
732
+ def selecting_no_body?; end
733
+
734
+ # Returns the value of attribute tests.
735
+ #
736
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#13
737
+ def tests; end
738
+
739
+ private
740
+
741
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#146
742
+ def collapse_html_whitespace!(text); end
743
+
744
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#102
745
+ def extract_equality_tests(refute); end
746
+
747
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#74
748
+ def extract_root(previous_selection, root_fallback); end
749
+
750
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#91
751
+ def extract_selectors; end
752
+
753
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#48
754
+ def filter(matches); end
755
+
756
+ class << self
757
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#46
758
+ def context; end
759
+ end
760
+ end
761
+
762
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb#44
763
+ Rails::Dom::Testing::Assertions::SelectorAssertions::HTMLSelector::NO_STRIP = T.let(T.unsafe(nil), Array)
764
+
765
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#8
766
+ class Rails::Dom::Testing::Assertions::SelectorAssertions::SubstitutionContext
767
+ # @return [SubstitutionContext] a new instance of SubstitutionContext
768
+ #
769
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#9
770
+ def initialize; end
771
+
772
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#20
773
+ def match(matches, attribute, matcher); end
774
+
775
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#13
776
+ def substitute!(selector, values, format_for_presentation = T.unsafe(nil)); end
777
+
778
+ private
779
+
780
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#25
781
+ def matcher_for(value, format_for_presentation); end
782
+
783
+ # @return [Boolean]
784
+ #
785
+ # source://rails-dom-testing//lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb#36
786
+ def substitutable?(value); end
787
+ end
788
+
789
+ # source://rails-dom-testing//lib/rails/dom/testing/railtie.rb#6
790
+ class Rails::Dom::Testing::Railtie < ::Rails::Railtie; end