From d6b940e9f1a3b4be718614fa0a6f961afa9a2796 Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Tue, 14 Aug 2012 18:55:48 -0300 Subject: [PATCH] Fixed test --- test/unit/price_detail_test.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/unit/price_detail_test.rb b/test/unit/price_detail_test.rb index bd70658..81ee5d8 100644 --- a/test/unit/price_detail_test.rb +++ b/test/unit/price_detail_test.rb @@ -54,7 +54,7 @@ class PriceDetailTest < ActiveSupport::TestCase p = PriceDetail.new p.valid? - assert p.errors.invalid?(:production_cost_id) + assert p.errors.invalid?(:production_cost) end should 'th production cost be unique on scope of product' do @@ -78,4 +78,14 @@ class PriceDetailTest < ActiveSupport::TestCase assert_equal "10.00", price_detail.formatted_value(:price) end + should 'have the production cost name as name' do + product = fast_create(Product) + cost = fast_create(ProductionCost, :name => 'Energy',:owner_id => Environment.default.id, :owner_type => 'environment') + + detail = product.price_details.create(:production_cost => cost, :price => 10) + + assert_equal 'Energy', detail.name + end + + end -- libgit2 0.21.2