require 'rails_helper' RSpec.describe "crm/customers/index", type: :view do before(:each) do assign(:crm_customers, [ Crm::Customer.create!( :name => "Name", :company => "Company", :contact_no => "Contact No", :email => "Email", :membership => nil, :membership_type => "Membership Type", :membership_authentication_code => "Membership Authentication Code" ), Crm::Customer.create!( :name => "Name", :company => "Company", :contact_no => "Contact No", :email => "Email", :membership => nil, :membership_type => "Membership Type", :membership_authentication_code => "Membership Authentication Code" ) ]) end it "renders a list of crm/customers" do render assert_select "tr>td", :text => "Name".to_s, :count => 2 assert_select "tr>td", :text => "Company".to_s, :count => 2 assert_select "tr>td", :text => "Contact No".to_s, :count => 2 assert_select "tr>td", :text => "Email".to_s, :count => 2 assert_select "tr>td", :text => nil.to_s, :count => 2 assert_select "tr>td", :text => "Membership Type".to_s, :count => 2 assert_select "tr>td", :text => "Membership Authentication Code".to_s, :count => 2 end end