thirteen-tien-len/spec/views/profiles/index.html.haml_spec.rb
2023-11-06 17:21:23 +00:00

30 lines
800 B
Ruby

require 'rails_helper'
RSpec.describe "profiles/index", type: :view do
before(:each) do
assign(:profiles, [
Profile.create!(
user: nil,
name: "Name",
summary: "Summary",
about: "MyText"
),
Profile.create!(
user: nil,
name: "Name",
summary: "Summary",
about: "MyText"
)
])
end
it "renders a list of profiles" do
render
cell_selector = Rails::VERSION::STRING >= '7' ? 'div>p' : 'tr>td'
assert_select cell_selector, text: Regexp.new(nil.to_s), count: 2
assert_select cell_selector, text: Regexp.new("Name".to_s), count: 2
assert_select cell_selector, text: Regexp.new("Summary".to_s), count: 2
assert_select cell_selector, text: Regexp.new("MyText".to_s), count: 2
end
end