Sha256: 45291d2322bb02994190dcfee947d8db78539b5e7c088b65929555f6000d1944

Contents?: true

Size: 867 Bytes

Versions: 34

Compression:

Stored size: 867 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.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

34 entries across 34 versions & 2 rubygems

Version Path
solidus_core-2.8.6 spec/models/spree/tax_category_spec.rb
solidus_core-2.6.6 spec/models/spree/tax_category_spec.rb
solidus_core-2.7.4 spec/models/spree/tax_category_spec.rb
solidus_core-2.8.5 spec/models/spree/tax_category_spec.rb
solidus_core-2.7.3 spec/models/spree/tax_category_spec.rb
solidus_core-2.6.5 spec/models/spree/tax_category_spec.rb
solidus_core-2.8.4 spec/models/spree/tax_category_spec.rb
solidus_core-2.8.3 spec/models/spree/tax_category_spec.rb
solidus_core-2.7.2 spec/models/spree/tax_category_spec.rb
solidus_core-2.6.4 spec/models/spree/tax_category_spec.rb
solidus_core-2.8.2 spec/models/spree/tax_category_spec.rb
solidus_core-2.8.1 spec/models/spree/tax_category_spec.rb
solidus_core-2.6.3 spec/models/spree/tax_category_spec.rb
solidus_core-2.8.0 spec/models/spree/tax_category_spec.rb
solidus_core-2.7.1 spec/models/spree/tax_category_spec.rb
solidus_core-2.6.2 spec/models/spree/tax_category_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.14 spec/models/spree/tax_category_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.13 spec/models/spree/tax_category_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.12 spec/models/spree/tax_category_spec.rb
solidus_core_devise_token_auth-2.8.0.alpha.11 spec/models/spree/tax_category_spec.rb