require 'rails_helper'

RSpec.describe "settings/menu_items/new", type: :view do
  before(:each) do
    assign(:settings_menu_item, Settings::MenuItem.new(
      :item_code => "MyString",
      :name => "MyString",
      :alt_name => "MyString",
      :type => "",
      :menu_category => nil,
      :menu_item => nil,
      :min_qty => 1,
      :min_selectable_item => 1,
      :max_selectable_item => 1,
      :created_by => "MyString"
    ))
  end

  it "renders new settings_menu_item form" do
    render

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

      assert_select "input#settings_menu_item_item_code[name=?]", "settings_menu_item[item_code]"

      assert_select "input#settings_menu_item_name[name=?]", "settings_menu_item[name]"

      assert_select "input#settings_menu_item_alt_name[name=?]", "settings_menu_item[alt_name]"

      assert_select "input#settings_menu_item_type[name=?]", "settings_menu_item[type]"

      assert_select "input#settings_menu_item_menu_category_id[name=?]", "settings_menu_item[menu_category_id]"

      assert_select "input#settings_menu_item_menu_item_id[name=?]", "settings_menu_item[menu_item_id]"

      assert_select "input#settings_menu_item_min_qty[name=?]", "settings_menu_item[min_qty]"

      assert_select "input#settings_menu_item_min_selectable_item[name=?]", "settings_menu_item[min_selectable_item]"

      assert_select "input#settings_menu_item_max_selectable_item[name=?]", "settings_menu_item[max_selectable_item]"

      assert_select "input#settings_menu_item_created_by[name=?]", "settings_menu_item[created_by]"
    end
  end
end
