Skip to content

Commit 651f119

Browse files
Remove more extraneous version checks
1 parent 8aca05e commit 651f119

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

test/action_view_extensions/builder_test.rb

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,16 +294,8 @@ def with_collection_check_boxes(object, attribute, collection, value_method, tex
294294
test "collection check box sanitizes collection values for labels correctly" do
295295
with_collection_check_boxes @user, :name, ['$0.99', '$1.99'], :to_s, :to_s
296296

297-
# Rails 6 changed the way it sanitizes the values
298-
# https://github.com/rails/rails/blob/6-0-stable/actionview/lib/action_view/helpers/tags/base.rb#L141
299-
# https://github.com/rails/rails/blob/5-2-stable/actionview/lib/action_view/helpers/tags/base.rb#L141
300-
if ActionView::VERSION::MAJOR == 5
301-
assert_select 'label.collection_check_boxes[for=user_name_099]', '$0.99'
302-
assert_select 'label.collection_check_boxes[for=user_name_199]', '$1.99'
303-
else
304-
assert_select 'label.collection_check_boxes[for=user_name_0_99]', '$0.99'
305-
assert_select 'label.collection_check_boxes[for=user_name_1_99]', '$1.99'
306-
end
297+
assert_select 'label.collection_check_boxes[for=user_name_0_99]', '$0.99'
298+
assert_select 'label.collection_check_boxes[for=user_name_1_99]', '$1.99'
307299
end
308300

309301
test "collection check box checks the correct value to local variables" do

test/inputs/weekday_input_test.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@
44

55
class WeekdayInputTest < ActionView::TestCase
66
test 'input generates a weekday select' do
7-
if ActionView::VERSION::MAJOR >= 7
8-
with_input_for @user, :born_at, :weekday
9-
assert_select 'select.weekday#user_born_at'
10-
end
7+
with_input_for @user, :born_at, :weekday
8+
assert_select 'select.weekday#user_born_at'
119
end
1210

1311
test 'input generates a weekday select that accepts placeholder' do
14-
if ActionView::VERSION::MAJOR >= 7
15-
with_input_for @user, :born_at, :weekday, placeholder: 'Put in a weekday'
16-
assert_select 'select.weekday[placeholder="Put in a weekday"]'
17-
end
12+
with_input_for @user, :born_at, :weekday, placeholder: 'Put in a weekday'
13+
assert_select 'select.weekday[placeholder="Put in a weekday"]'
1814
end
1915
end

0 commit comments

Comments
 (0)