|
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 | + |
| 212 | + if Rails.version >= "7.0.0" |
| 213 | + it { is_expected.to contain('assert_select %{p:contains("2")}, count: 2') } |
| 214 | + it { is_expected.to contain('assert_select %{p:contains("3")}, count: 2') } |
| 215 | + else |
| 216 | + it { is_expected.to contain('assert_select "tr>td", text: 2.to_s, count: 2') } |
| 217 | + it { is_expected.to contain('assert_select "tr>td", text: 3.to_s, count: 2') } |
| 218 | + end |
213 | 219 | end |
214 | 220 |
|
215 | 221 | describe 'with multiple float attributes index' do |
216 | 222 | before { run_generator %w[posts upvotes:float downvotes:float] } |
217 | 223 | subject { file("spec/views/posts/index.html.erb_spec.rb") } |
218 | 224 | 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') } |
| 225 | + |
| 226 | + if Rails.version >= "7.0.0" |
| 227 | + it { is_expected.to contain('assert_select %{p:contains("2.5")}, count: 2') } |
| 228 | + it { is_expected.to contain('assert_select %{p:contains("3.5")}, count: 2') } |
| 229 | + else |
| 230 | + it { is_expected.to contain('assert_select "tr>td", text: 2.5.to_s, count: 2') } |
| 231 | + it { is_expected.to contain('assert_select "tr>td", text: 3.5.to_s, count: 2') } |
| 232 | + end |
221 | 233 | end |
222 | 234 |
|
223 | 235 | describe 'with reference attribute' do |
|
0 commit comments