Skip to content

Commit

Permalink
Merge pull request #2790 from mjankowski/cell-selector-rails-version
Browse files Browse the repository at this point in the history
Drop support for rails versions < 7 in scaffold generator
  • Loading branch information
JonRowe committed Sep 2, 2024
1 parent a124bb7 commit 0beb36e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/generators/rspec/scaffold/templates/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
it "renders a list of <%= ns_table_name %>" do
render
cell_selector = <%= Rails::VERSION::STRING >= '7' ? "'div>p'" : "'tr>td'" %>
cell_selector = 'div>p'
<% for attribute in output_attributes -%>
assert_select cell_selector, text: Regexp.new(<%= value_for(attribute) %>.to_s), count: 2
<% end -%>
Expand Down
6 changes: 1 addition & 5 deletions spec/generators/rspec/scaffold/scaffold_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,7 @@
.and(contain(/assign\(:posts, /))
.and(contain(/it "renders a list of (.*)"/))

if ::Rails::VERSION::STRING >= '7.0.0'
expect(filename).to contain(/'div>p'/)
else
expect(filename).to contain(/'tr>td'/)
end
expect(filename).to contain(/'div>p'/)
end
end

Expand Down

0 comments on commit 0beb36e

Please sign in to comment.