File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
example_app_generator/spec/support
lib/generators/rspec/scaffold/templates
spec/generators/rspec/scaffold Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ require_file_stub 'config/environment' do
26
26
require "action_controller/railtie"
27
27
require "action_mailer/railtie" unless ENV [ 'NO_ACTION_MAILER' ]
28
28
require "action_view/railtie"
29
+ require "action_cable/engine" if Rails ::VERSION ::STRING >= '6'
29
30
30
31
# Require the gems listed in Gemfile, including any gems
31
32
# you've limited to :test, :development, or :production.
Original file line number Diff line number Diff line change 18
18
19
19
it "renders a list of <%= ns_table_name %>" do
20
20
render
21
+ cell_selector = Rails::VERSION::STRING >= '7' ? 'div>p' : 'tr>td'
21
22
<% 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
23
24
<% end -%>
24
25
end
25
26
end
Original file line number Diff line number Diff line change 208
208
before { run_generator %w[ posts upvotes:integer downvotes:integer ] }
209
209
subject { file ( "spec/views/posts/index.html.erb_spec.rb" ) }
210
210
it { is_expected . to exist }
211
- it { is_expected . to contain ( 'assert_select "tr>td" , text: 2.to_s, count: 2' ) }
212
- it { is_expected . to contain ( 'assert_select "tr>td" , text: 3.to_s, count: 2' ) }
211
+ it { is_expected . to contain ( 'assert_select cell_selector , text: Regexp.new( 2.to_s) , count: 2' ) }
212
+ it { is_expected . to contain ( 'assert_select cell_selector , text: Regexp.new( 3.to_s) , count: 2' ) }
213
213
end
214
214
215
215
describe 'with multiple float attributes index' do
216
216
before { run_generator %w[ posts upvotes:float downvotes:float ] }
217
217
subject { file ( "spec/views/posts/index.html.erb_spec.rb" ) }
218
218
it { is_expected . to exist }
219
- it { is_expected . to contain ( 'assert_select "tr>td" , text: 2.5.to_s, count: 2' ) }
220
- it { is_expected . to contain ( 'assert_select "tr>td" , text: 3.5.to_s, count: 2' ) }
219
+ it { is_expected . to contain ( 'assert_select cell_selector , text: Regexp.new( 2.5.to_s) , count: 2' ) }
220
+ it { is_expected . to contain ( 'assert_select cell_selector , text: Regexp.new( 3.5.to_s) , count: 2' ) }
221
221
end
222
222
223
223
describe 'with reference attribute' do
You can’t perform that action at this time.
0 commit comments