require 'rails_helper'

RSpec.describe "crm/customers/new", type: :view do
  before(:each) do
    assign(:crm_customer, Crm::Customer.new(
      :name => "MyString",
      :company => "MyString",
      :contact_no => "MyString",
      :email => "MyString",
      :membership => nil,
      :membership_type => "MyString",
      :membership_authentication_code => "MyString"
    ))
  end

  it "renders new crm_customer form" do
    render

    assert_select "form[action=?][method=?]", crm_customers_path, "post" do

      assert_select "input#crm_customer_name[name=?]", "crm_customer[name]"

      assert_select "input#crm_customer_company[name=?]", "crm_customer[company]"

      assert_select "input#crm_customer_contact_no[name=?]", "crm_customer[contact_no]"

      assert_select "input#crm_customer_email[name=?]", "crm_customer[email]"

      assert_select "input#crm_customer_membership_id[name=?]", "crm_customer[membership_id]"

      assert_select "input#crm_customer_membership_type[name=?]", "crm_customer[membership_type]"

      assert_select "input#crm_customer_membership_authentication_code[name=?]", "crm_customer[membership_authentication_code]"
    end
  end
end
