require 'rails_helper'

RSpec.describe "metapurses/index", type: :view do
  before(:each) do
    assign(:metapurses, [
      Metapurse.create!(
        name: "Name",
        data: "MyText"
      ),
      Metapurse.create!(
        name: "Name",
        data: "MyText"
      )
    ])
  end

  it "renders a list of metapurses" do
    render
    cell_selector = Rails::VERSION::STRING >= '7' ? 'div>p' : 'tr>td'
    assert_select cell_selector, text: Regexp.new("Name".to_s), count: 2
    assert_select cell_selector, text: Regexp.new("MyText".to_s), count: 2
  end
end
