From 4cafc3b86f327f2e3ae2d345a5ed357207a1a989 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Wed, 14 May 2014 17:18:55 +0000 Subject: [PATCH] Avoid mass-assignment of product profile on product_category test --- test/unit/product_category_test.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/unit/product_category_test.rb b/test/unit/product_category_test.rb index 1bba2df..59f9e58 100644 --- a/test/unit/product_category_test.rb +++ b/test/unit/product_category_test.rb @@ -41,13 +41,19 @@ class ProductCategoryTest < ActiveSupport::TestCase c1 = ProductCategory.create!(:name => 'test cat 1', :environment => Environment.default) c2 = ProductCategory.create!(:name => 'test cat 2', :environment => Environment.default) c3 = ProductCategory.create!(:name => 'test cat 3', :environment => Environment.default) - p1 = Product.create(:name => 'product1', :product_category => c1, :profile_id => enterprise.id) - p2 = Product.create(:name => 'product2', :product_category => c1, :profile_id => enterprise.id) - p3 = Product.create(:name => 'product3', :product_category => c2, :profile_id => enterprise.id) + p1 = Product.new(:name => 'product1', :product_category => c1) + p1.profile = enterprise + p1.save! + p2 = Product.new(:name => 'product2', :product_category => c1) + p2.profile = enterprise + p2.save! + p3 = Product.new(:name => 'product3', :product_category => c2) + p3.profile = enterprise + p3.save! scope = ProductCategory.by_enterprise(enterprise) - assert_equal ActiveRecord::NamedScope::Scope, scope.class + assert_equal ActiveRecord::Relation, scope.class assert_equivalent [c1,c2], scope end -- libgit2 0.21.2