Files
openfoodnetwork/spec/models/spree/classification_spec.rb
Will Marshall 1c31ac56ea Adding primary taxon field to product
Conflicts:
	db/migrate/20140522044009_add_primary_taxon_to_products.rb
2014-05-30 14:31:03 +10:00

16 lines
536 B
Ruby

require 'spec_helper'
module Spree
describe Classification do
let(:product) { create(:simple_product) }
let(:taxon) { create(:taxon) }
let(:classification) { create(:classification, taxon: taxon, product: product) }
it "won't destroy if classification is the primary taxon" do
product.primary_taxon = taxon
classification.destroy.should be_false
classification.errors.messages[:base].should == ["Taxon #{taxon.name} is the primary taxon of #{product.name} and cannot be deleted"]
end
end
end