Sha256: a5de5919f944aeebbc2b74c4b84b773db51e70a2caf2de5af51f1edc3013affa
Contents?: true
Size: 1012 Bytes
Versions: 1
Compression:
Stored size: 1012 Bytes
Contents
require 'spec_helper' describe Spree::TaxCategory, type: :model do describe 'Validations' do it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_uniqueness_of(:name).scoped_to(:deleted_at).case_insensitive } end context 'default tax category' do let(:tax_category) { create(:tax_category) } let(:new_tax_category) { create(:tax_category) } before do tax_category.update_column(:is_default, true) end it "should undefault the previous default tax category" do new_tax_category.update_attributes({is_default: true}) expect(new_tax_category.is_default).to be true tax_category.reload expect(tax_category.is_default).to be false end it "should undefault the previous default tax category except when updating the existing default tax category" do tax_category.update_column(:description, "Updated description") tax_category.reload expect(tax_category.is_default).to be true end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_core-3.3.0.rc1 | spec/models/spree/tax_category_spec.rb |