From 48816c44d0fad864ad02c5442444eb7c8e44b5ab Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Tue, 26 Nov 2013 16:49:59 -0300 Subject: [PATCH] catalog-test: test price_detail name not being called through production cost straight --- test/functional/catalog_controller_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+), 0 deletions(-) diff --git a/test/functional/catalog_controller_test.rb b/test/functional/catalog_controller_test.rb index 770d669..fe65d67 100644 --- a/test/functional/catalog_controller_test.rb +++ b/test/functional/catalog_controller_test.rb @@ -235,4 +235,18 @@ class CatalogControllerTest < ActionController::TestCase assert_equal [pc2, pc1, pc4, pc3], assigns(:categories) end + should 'use price_detail name instead of production_cost name straight' do + p1 = fast_create(Product, :product_category_id => @product_category.id, :enterprise_id => @enterprise.id) + p2 = fast_create(Product, :product_category_id => @product_category.id, :enterprise_id => @enterprise.id) + Product.any_instance.stubs(:price_described?).returns(true) + production_cost = fast_create(ProductionCost) + pd1 = PriceDetail.create!(:product => p1, :production_cost => production_cost) + pd2 = PriceDetail.create!(:product => p2) + + get :index, :profile => @enterprise.identifier + + assert_tag :tag => 'div', :attributes => {:class => 'search-product-input-name'}, :content => production_cost.name + assert_tag :tag => 'div', :attributes => {:class => 'search-product-input-name'}, :content => 'Other costs' + end + end -- libgit2 0.21.2