Skip to content

Commit 6f3b666

Browse files
committed
Move CountDescribable into Rails::Dom::Testing::Assertions::SelectorAssertions.
1 parent 9cdbd48 commit 6f3b666

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed
Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
11
require 'active_support/concern'
22

3-
module CountDescribable
4-
extend ActiveSupport::Concern
3+
module Rails
4+
module Dom
5+
module Testing
6+
module Assertions
7+
module SelectorAssertions
8+
module CountDescribable
9+
extend ActiveSupport::Concern
510

6-
private
7-
def count_description(min, max, count) #:nodoc:
8-
if min && max && (max != min)
9-
"between #{min} and #{max} elements"
10-
elsif min && max && max == min && count
11-
"exactly #{count} #{pluralize_element(min)}"
12-
elsif min && !(min == 1 && max == 1)
13-
"at least #{min} #{pluralize_element(min)}"
14-
elsif max
15-
"at most #{max} #{pluralize_element(max)}"
16-
end
17-
end
11+
private
12+
def count_description(min, max, count) #:nodoc:
13+
if min && max && (max != min)
14+
"between #{min} and #{max} elements"
15+
elsif min && max && max == min && count
16+
"exactly #{count} #{pluralize_element(min)}"
17+
elsif min && !(min == 1 && max == 1)
18+
"at least #{min} #{pluralize_element(min)}"
19+
elsif max
20+
"at most #{max} #{pluralize_element(max)}"
21+
end
22+
end
1823

19-
def pluralize_element(quantity)
20-
quantity == 1 ? 'element' : 'elements'
24+
def pluralize_element(quantity)
25+
quantity == 1 ? 'element' : 'elements'
26+
end
27+
end
28+
end
29+
end
2130
end
31+
end
2232
end

0 commit comments

Comments
 (0)