From dd8556d2b90094e56f93f99d461c0d2acfd6856b Mon Sep 17 00:00:00 2001 From: Sean Schofield Date: Tue, 15 Nov 2011 13:11:37 -0500 Subject: [PATCH] Revert "Prevent tax category removal if tax rates are assigned to it." This reverts commit ed5914b23207ce4629acd239953cfa9405c14dbe. --- core/app/models/spree/tax_category.rb | 2 +- core/spec/models/tax_category_spec.rb | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/core/app/models/spree/tax_category.rb b/core/app/models/spree/tax_category.rb index 090fef28c36..2227f3ef5a5 100644 --- a/core/app/models/spree/tax_category.rb +++ b/core/app/models/spree/tax_category.rb @@ -2,7 +2,7 @@ module Spree class TaxCategory < ActiveRecord::Base validates :name, :presence => true, :uniqueness => true - has_many :tax_rates, :dependent => :restrict + has_many :tax_rates before_save :set_default_category diff --git a/core/spec/models/tax_category_spec.rb b/core/spec/models/tax_category_spec.rb index 5c22064d447..17005b9e474 100644 --- a/core/spec/models/tax_category_spec.rb +++ b/core/spec/models/tax_category_spec.rb @@ -51,15 +51,5 @@ end - context 'delete' do - let!(:tax_category) {Factory(:tax_category)} - let!(:tax_rate) {Factory(:tax_rate, :tax_category => tax_category)} - it "should not allow deletion when tax rates are assigned" do - p tax_category.inspect - lambda {tax_category.destroy}.should raise_error ActiveRecord::DeleteRestrictionError - p tax_category.inspect - end - end - end