require 'rails_helper'

describe '/admin/products/edit.html.slim' do
  include ProductsHelper

  before(:each) do
    assigns[:product] = @product = FactoryGirl.create(:product)
    allow(view).to receive(:website).and_return(FactoryGirl.build(:website))
  end

  it "renders the edit product form" do
    render

    expect(rendered).to have_selector("form[action='#{admin_product_path(@product)}'][method='post']")
  end

  it 'renders the product_groups partial' do
    render
    expect(response).to render_template('_product_groups')
  end
end

require 'rails_helper'

RSpec.describe '/admin/products/edit.html.slim', type: :view do
  include ProductsHelper

  let(:product) { FactoryGirl.create(:product) }

  before(:each) do
    assign(:product, product)
    assign(:product_group_placement, ProductGroupPlacement.new)
    allow(view).to receive(:website).and_return(FactoryGirl.build(:website))
  end

  it "renders the edit product form" do
    render

    expect(rendered).to have_selector("form[action='#{admin_product_path(product)}'][method='post']")
  end

  it 'renders the product_groups partial' do
    render
    expect(response).to render_template('_product_groups')
  end
end

Fix spec -- view now requires @product_group_placement
Fix spec -- view now requires @product_group_placement
