require 'rails_helper'

RSpec.describe "settings/payment_method_settings/index", type: :view do
  before(:each) do
    assign(:settings_payment_method_settings, [
      Settings::PaymentMethodSetting.create!(
        :payment_method => "Payment Method",
        :is_active => false,
        :gateway_communication_type => "Gateway Communication Type",
        :gateway_url => "Gateway Url",
        :auth_token => "Auth Token",
        :merchant_account => nil
      ),
      Settings::PaymentMethodSetting.create!(
        :payment_method => "Payment Method",
        :is_active => false,
        :gateway_communication_type => "Gateway Communication Type",
        :gateway_url => "Gateway Url",
        :auth_token => "Auth Token",
        :merchant_account => nil
      )
    ])
  end

  it "renders a list of settings/payment_method_settings" do
    render
    assert_select "tr>td", :text => "Payment Method".to_s, :count => 2
    assert_select "tr>td", :text => false.to_s, :count => 2
    assert_select "tr>td", :text => "Gateway Communication Type".to_s, :count => 2
    assert_select "tr>td", :text => "Gateway Url".to_s, :count => 2
    assert_select "tr>td", :text => "Auth Token".to_s, :count => 2
    assert_select "tr>td", :text => nil.to_s, :count => 2
  end
end
