Skip to content

Commit bd9158d

Browse files
Make the index spec handle varying templates between Rails versions
1 parent 94af079 commit bd9158d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/generators/rspec/scaffold/templates/index_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
1919
it "renders a list of <%= ns_table_name %>" do
2020
render
21+
cell_selector = Rails::VERSION::STRING >= '7' ? 'div>p' : 'tr>td'
2122
<% for attribute in output_attributes -%>
22-
assert_select "tr>td", text: <%= value_for(attribute) %>.to_s, count: 2
23+
assert_select cell_selector, text: Regexp.new(<%= value_for(attribute) %>.to_s), count: 2
2324
<% end -%>
2425
end
2526
end

0 commit comments

Comments
 (0)