require 'rails_helper'

RSpec.describe "settings/cashier_terminals/index", type: :view do
  before(:each) do
    assign(:settings_cashier_terminals, [
      Settings::CashierTerminal.create!(
        :name => "Name",
        :is_active => false,
        :is_currently_login => false,
        :auto_print_receipt => "Auto Print Receipt",
        :printer_name => "Printer Name",
        :header => "",
        :footer => "",
        :font => "Font",
        :font_size => "Font Size",
        :show_tax => false,
        :show_cashier => false,
        :show_guest_info => false
      ),
      Settings::CashierTerminal.create!(
        :name => "Name",
        :is_active => false,
        :is_currently_login => false,
        :auto_print_receipt => "Auto Print Receipt",
        :printer_name => "Printer Name",
        :header => "",
        :footer => "",
        :font => "Font",
        :font_size => "Font Size",
        :show_tax => false,
        :show_cashier => false,
        :show_guest_info => false
      )
    ])
  end

  it "renders a list of settings/cashier_terminals" do
    render
    assert_select "tr>td", :text => "Name".to_s, :count => 2
    assert_select "tr>td", :text => false.to_s, :count => 2
    assert_select "tr>td", :text => false.to_s, :count => 2
    assert_select "tr>td", :text => "Auto Print Receipt".to_s, :count => 2
    assert_select "tr>td", :text => "Printer Name".to_s, :count => 2
    assert_select "tr>td", :text => "".to_s, :count => 2
    assert_select "tr>td", :text => "".to_s, :count => 2
    assert_select "tr>td", :text => "Font".to_s, :count => 2
    assert_select "tr>td", :text => "Font Size".to_s, :count => 2
    assert_select "tr>td", :text => false.to_s, :count => 2
    assert_select "tr>td", :text => false.to_s, :count => 2
    assert_select "tr>td", :text => false.to_s, :count => 2
  end
end
