Skip to content

Commit

Permalink
Added test for association between product and intervention_participa…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
Zank94 committed Aug 4, 2017
1 parent 9cd4552 commit 61413dc
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/models/product_test.rb
Expand Up @@ -94,4 +94,31 @@ class ProductTest < ActiveSupport::TestCase
assert Product.of_working_set(item.name).count >= 0
end
end

test 'intervention_participations association' do
category = ProductNatureCategory.create!(name: "Category name")
nature = ProductNature.create!(
name: "Nature name",
category: category,
population_counting: "unitary",
variety: "cultivable_zone"
)
variant = ProductNatureVariant.create!(
unit_name: "Variant unit name",
category: category,
nature: nature,
variety: "cultivable_zone"
)
product = Product.create!(
category: category,
nature: nature,
variant: variant,
variety: "cultivable_zone"
)
intervention_participation = InterventionParticipation.create!(
product: product,
state: "in_progress"
)
assert_equal(1, product.intervention_participations.length)
end
end

0 comments on commit 61413dc

Please sign in to comment.