You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sqm-dashboards/spec/views/recipients/index.html.erb_spec.rb

48 lines
1.4 KiB

require 'rails_helper'
RSpec.describe "recipients/index", type: :view do
before(:each) do
@school = assign(:school, School.create!(
name: 'School'
))
assign(:recipients, [
Recipient.create!(
:name => "Name",
:phone => "Phone",
:gender => "Gender",
:race => "Race",
:ethnicity => "Ethnicity",
:home_language_id => 2,
:income => "Income",
:opted_out => false,
:school_id => @school.id
),
Recipient.create!(
:name => "Name",
:phone => "Phone",
:gender => "Gender",
:race => "Race",
:ethnicity => "Ethnicity",
:home_language_id => 2,
:income => "Income",
:opted_out => false,
:school_id => @school.id
)
])
end
it "renders a list of recipients" do
render(template: "recipients/index.html.haml")
assert_select "tr>td", :text => "Name".to_s, :count => 2
assert_select "tr>td", :text => "Phone".to_s, :count => 2
assert_select "tr>td", :text => "Gender".to_s, :count => 2
assert_select "tr>td", :text => "Race".to_s, :count => 2
assert_select "tr>td", :text => "Ethnicity".to_s, :count => 2
assert_select "tr>td", :text => 2.to_s, :count => 2
assert_select "tr>td", :text => "Income".to_s, :count => 2
assert_select "tr>td", :text => false.to_s, :count => 2
assert_select "tr>td", :text => @school.id.to_s, :count => 2
end
end