From dd2b608125df198ebb1819c8e3625f5294789b35 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Tue, 4 Feb 2014 13:27:39 -0300 Subject: [PATCH] rails3: fix catalog tests --- app/helpers/catalog_helper.rb | 4 ++-- test/functional/catalog_controller_test.rb | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/helpers/catalog_helper.rb b/app/helpers/catalog_helper.rb index 081d76b..8e43a84 100644 --- a/app/helpers/catalog_helper.rb +++ b/app/helpers/catalog_helper.rb @@ -9,7 +9,7 @@ module CatalogHelper @categories = ProductCategory.on_level(params[:level]).order(:name) end - @products = profile.products.from_category(@category).paginate(:order => 'available desc, highlighted desc, name asc', :per_page => 9, :page => options[:page]) + @products = profile.products.from_category(@category).reorder('available desc, highlighted desc, name asc').paginate(:per_page => 9, :page => options[:page]) end def breadcrumb(category) @@ -33,7 +33,7 @@ module CatalogHelper category.children.order(:name).each do |sub_category| sub_categories << category_link(sub_category, true) end - content_tag('ul', sub_categories) if sub_categories.size > 1 + content_tag('ul', sub_categories.join) if sub_categories.size > 1 end end diff --git a/test/functional/catalog_controller_test.rb b/test/functional/catalog_controller_test.rb index ed2e7d7..39850de 100644 --- a/test/functional/catalog_controller_test.rb +++ b/test/functional/catalog_controller_test.rb @@ -122,10 +122,10 @@ class CatalogControllerTest < ActionController::TestCase end should 'filter products based on level selected' do - pc1 = create(ProductCategory, :name => "PC1", :environment => @enterprise.environment) - pc2 = create(ProductCategory, :name => "PC2", :environment => @enterprise.environment, :parent_id => pc1.id) - pc3 = create(ProductCategory, :name => "PC3", :environment => @enterprise.environment, :parent_id => pc1.id) - pc4 = create(ProductCategory, :name => "PC4", :environment => @enterprise.environment, :parent_id => pc2.id) + pc1 = ProductCategory.create!(:name => "PC1", :environment => @enterprise.environment) + pc2 = ProductCategory.create!(:name => "PC2", :environment => @enterprise.environment, :parent_id => pc1.id) + pc3 = ProductCategory.create!(:name => "PC3", :environment => @enterprise.environment, :parent_id => pc1.id) + pc4 = ProductCategory.create!(:name => "PC4", :environment => @enterprise.environment, :parent_id => pc2.id) p1 = fast_create(Product, :product_category_id => pc1.id, :enterprise_id => @enterprise.id) p2 = fast_create(Product, :product_category_id => pc2.id, :enterprise_id => @enterprise.id) p3 = fast_create(Product, :product_category_id => pc3.id, :enterprise_id => @enterprise.id) @@ -171,10 +171,10 @@ class CatalogControllerTest < ActionController::TestCase end should 'display categories and sub-categories link' do - pc1 = create(ProductCategory, :name => "PC1", :environment => @enterprise.environment) - pc2 = create(ProductCategory, :name => "PC2", :environment => @enterprise.environment, :parent_id => pc1.id) - pc3 = create(ProductCategory, :name => "PC3", :environment => @enterprise.environment, :parent_id => pc1.id) - pc4 = create(ProductCategory, :name => "PC4", :environment => @enterprise.environment, :parent_id => pc2.id) + pc1 = ProductCategory.create!(:name => "PC1", :environment => @enterprise.environment) + pc2 = ProductCategory.create!(:name => "PC2", :environment => @enterprise.environment, :parent_id => pc1.id) + pc3 = ProductCategory.create!(:name => "PC3", :environment => @enterprise.environment, :parent_id => pc1.id) + pc4 = ProductCategory.create!(:name => "PC4", :environment => @enterprise.environment, :parent_id => pc2.id) p1 = fast_create(Product, :product_category_id => pc1.id, :enterprise_id => @enterprise.id) p2 = fast_create(Product, :product_category_id => pc2.id, :enterprise_id => @enterprise.id) p3 = fast_create(Product, :product_category_id => pc3.id, :enterprise_id => @enterprise.id) -- libgit2 0.21.2