Commit d6b940e9f1a3b4be718614fa0a6f961afa9a2796
1 parent
1af7590f
Exists in
master
and in
28 other branches
Fixed test
Showing
1 changed file
with
11 additions
and
1 deletions
Show diff stats
test/unit/price_detail_test.rb
| ... | ... | @@ -54,7 +54,7 @@ class PriceDetailTest < ActiveSupport::TestCase |
| 54 | 54 | p = PriceDetail.new |
| 55 | 55 | p.valid? |
| 56 | 56 | |
| 57 | - assert p.errors.invalid?(:production_cost_id) | |
| 57 | + assert p.errors.invalid?(:production_cost) | |
| 58 | 58 | end |
| 59 | 59 | |
| 60 | 60 | should 'th production cost be unique on scope of product' do |
| ... | ... | @@ -78,4 +78,14 @@ class PriceDetailTest < ActiveSupport::TestCase |
| 78 | 78 | assert_equal "10.00", price_detail.formatted_value(:price) |
| 79 | 79 | end |
| 80 | 80 | |
| 81 | + should 'have the production cost name as name' do | |
| 82 | + product = fast_create(Product) | |
| 83 | + cost = fast_create(ProductionCost, :name => 'Energy',:owner_id => Environment.default.id, :owner_type => 'environment') | |
| 84 | + | |
| 85 | + detail = product.price_details.create(:production_cost => cost, :price => 10) | |
| 86 | + | |
| 87 | + assert_equal 'Energy', detail.name | |
| 88 | + end | |
| 89 | + | |
| 90 | + | |
| 81 | 91 | end | ... | ... |