rails-dom-testing 2.1.1 → 2.3.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.
- checksums.yaml +4 -4
- data/README.md +41 -20
- data/lib/rails/dom/testing/assertions/dom_assertions.rb +58 -11
- data/lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb +151 -119
- data/lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb +38 -24
- data/lib/rails/dom/testing/assertions/selector_assertions.rb +311 -230
- data/lib/rails/dom/testing/assertions.rb +4 -3
- data/lib/rails/dom/testing/railtie.rb +14 -0
- data/lib/rails/dom/testing/version.rb +3 -1
- data/lib/rails/dom/testing.rb +52 -0
- data/lib/rails-dom-testing.rb +4 -1
- data/test/dom_assertions_test.rb +93 -5
- data/test/parser_selection_test.rb +75 -0
- data/test/selector_assertions_test.rb +245 -72
- data/test/test_helper.rb +21 -4
- metadata +14 -42
- data/lib/rails/dom/testing/assertions/selector_assertions/count_describable.rb +0 -28
@@ -1,28 +0,0 @@
|
|
1
|
-
module Rails
|
2
|
-
module Dom
|
3
|
-
module Testing
|
4
|
-
module Assertions
|
5
|
-
module SelectorAssertions
|
6
|
-
module CountDescribable
|
7
|
-
private
|
8
|
-
def count_description(min, max, count) #:nodoc:
|
9
|
-
if min && max && (max != min)
|
10
|
-
"between #{min} and #{max} elements"
|
11
|
-
elsif min && max && max == min && count
|
12
|
-
"exactly #{count} #{pluralize_element(min)}"
|
13
|
-
elsif min && !(min == 1 && max == 1)
|
14
|
-
"at least #{min} #{pluralize_element(min)}"
|
15
|
-
elsif max
|
16
|
-
"at most #{max} #{pluralize_element(max)}"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def pluralize_element(quantity)
|
21
|
-
quantity == 1 ? 'element' : 'elements'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|