mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-13 23:37:47 +00:00
23 lines
469 B
Ruby
23 lines
469 B
Ruby
require 'spec_helper'
|
|
|
|
describe Spree::Product do
|
|
|
|
describe "associations" do
|
|
it { should belong_to(:supplier) }
|
|
it { should have_and_belong_to_many(:distributors) }
|
|
end
|
|
|
|
describe "validations" do
|
|
it "is valid when created from factory" do
|
|
build(:product).should be_valid
|
|
end
|
|
|
|
it "requires at least one distributor" do
|
|
product = build(:product)
|
|
product.distributors.clear
|
|
product.should_not be_valid
|
|
end
|
|
end
|
|
|
|
end
|