require 'rails_helper'

RSpec.describe "settings/membership_settings/index", type: :view do
  before(:each) do
    assign(:settings_membership_settings, [
      Settings::MembershipSetting.create!(
        :membership_type => "Membership Type",
        :is_active => false,
        :gateway_communication_type => "Gateway Communication Type",
        :gateway_url => "Gateway Url",
        :auth_token => "Auth Token",
        :merchant_account => nil,
        :created_by => "Created By"
      ),
      Settings::MembershipSetting.create!(
        :membership_type => "Membership Type",
        :is_active => false,
        :gateway_communication_type => "Gateway Communication Type",
        :gateway_url => "Gateway Url",
        :auth_token => "Auth Token",
        :merchant_account => nil,
        :created_by => "Created By"
      )
    ])
  end

  it "renders a list of settings/membership_settings" do
    render
    assert_select "tr>td", :text => "Membership Type".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
    assert_select "tr>td", :text => "Created By".to_s, :count => 2
  end
end
