mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-14 04:04:23 +00:00
32 lines
701 B
Ruby
32 lines
701 B
Ruby
require 'spec_helper'
|
|
|
|
describe Exchange do
|
|
it "should be valid when built from factory" do
|
|
build(:exchange).should be_valid
|
|
end
|
|
|
|
[:order_cycle, :sender, :receiver].each do |attr|
|
|
it "should not be valid without #{attr}" do
|
|
e = build(:exchange)
|
|
e.send("#{attr}=", nil)
|
|
e.should_not be_valid
|
|
end
|
|
end
|
|
|
|
it "has exchange variants" do
|
|
e = create(:exchange)
|
|
p = create(:product)
|
|
|
|
e.exchange_variants.create(:variant => p.master)
|
|
e.variants.count.should == 1
|
|
end
|
|
|
|
it "has exchange fees" do
|
|
e = create(:exchange)
|
|
f = create(:enterprise_fee)
|
|
|
|
e.exchange_fees.create(:enterprise_fee => f)
|
|
e.enterprise_fees.count.should == 1
|
|
end
|
|
end
|