How/with which matcher can I test if @product.industry_products.build
and the rest are defined in my action?
products_controller
def new
@product = Product.new
authorize @product
@product.industry_products.build
@product.product_features.build
@product.product_usecases.build
@product.product_competitions.build
end
products_controller_spec.rb
context "GET new" do
let!(:profile) { create(:profile, user: @user) }
before(:each) do
get :new
end
it "assigns product" do
expect(assigns(:product)).to be_a_new(Product)
end
it { is_expected.to respond_with 200 }
it { is_expected.to render_template :new }
end
Aucun commentaire:
Enregistrer un commentaire