Sha256: dfc2d71fa7f1fa0deb4a95523d825bb16d6e0072d8ddbd90cc9618b3bd3803d9

Contents?: true

Size: 829 Bytes

Versions: 32

Compression:

Stored size: 829 Bytes

Contents

require 'spec_helper'

describe Spree::TaxCategory, type: :model do
  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

32 entries across 32 versions & 1 rubygems

Version Path
solidus_core-2.3.1 spec/models/spree/tax_category_spec.rb
solidus_core-2.2.2 spec/models/spree/tax_category_spec.rb
solidus_core-2.1.1 spec/models/spree/tax_category_spec.rb
solidus_core-2.0.3 spec/models/spree/tax_category_spec.rb
solidus_core-1.4.2 spec/models/spree/tax_category_spec.rb
solidus_core-1.3.2 spec/models/spree/tax_category_spec.rb
solidus_core-2.3.0 spec/models/spree/tax_category_spec.rb
solidus_core-2.3.0.rc3 spec/models/spree/tax_category_spec.rb
solidus_core-2.3.0.rc2 spec/models/spree/tax_category_spec.rb
solidus_core-2.3.0.rc1 spec/models/spree/tax_category_spec.rb
solidus_core-2.3.0.beta1 spec/models/spree/tax_category_spec.rb
solidus_core-2.0.2 spec/models/spree/tax_category_spec.rb
solidus_core-1.4.1 spec/models/spree/tax_category_spec.rb
solidus_core-2.2.1 spec/models/spree/tax_category_spec.rb
solidus_core-2.2.0 spec/models/spree/tax_category_spec.rb
solidus_core-2.2.0.rc1 spec/models/spree/tax_category_spec.rb
solidus_core-2.2.0.beta1 spec/models/spree/tax_category_spec.rb
solidus_core-2.1.0 spec/models/spree/tax_category_spec.rb
solidus_core-2.1.0.rc1 spec/models/spree/tax_category_spec.rb
solidus_core-2.0.1 spec/models/spree/tax_category_spec.rb