Commit 48816c44d0fad864ad02c5442444eb7c8e44b5ab

Authored by Rodrigo Souto
1 parent b2b95d02

catalog-test: test price_detail name not being called through production cost straight

Showing 1 changed file with 14 additions and 0 deletions   Show diff stats
test/functional/catalog_controller_test.rb
... ... @@ -235,4 +235,18 @@ class CatalogControllerTest < ActionController::TestCase
235 235 assert_equal [pc2, pc1, pc4, pc3], assigns(:categories)
236 236 end
237 237  
  238 + should 'use price_detail name instead of production_cost name straight' do
  239 + p1 = fast_create(Product, :product_category_id => @product_category.id, :enterprise_id => @enterprise.id)
  240 + p2 = fast_create(Product, :product_category_id => @product_category.id, :enterprise_id => @enterprise.id)
  241 + Product.any_instance.stubs(:price_described?).returns(true)
  242 + production_cost = fast_create(ProductionCost)
  243 + pd1 = PriceDetail.create!(:product => p1, :production_cost => production_cost)
  244 + pd2 = PriceDetail.create!(:product => p2)
  245 +
  246 + get :index, :profile => @enterprise.identifier
  247 +
  248 + assert_tag :tag => 'div', :attributes => {:class => 'search-product-input-name'}, :content => production_cost.name
  249 + assert_tag :tag => 'div', :attributes => {:class => 'search-product-input-name'}, :content => 'Other costs'
  250 + end
  251 +
238 252 end
... ...