Switch to ApplicationRecord in migation spec

Fixes:

An error occurred while loading ./spec/migrations/migrate_enterprise_fee_tax_amounts_spec.rb.
Failure/Error: require_relative '../../db/migrate/20210406161242_migrate_enterprise_fee_tax_amounts'

TypeError:
  superclass mismatch for class Adjustment
# ./db/migrate/20210406161242_migrate_enterprise_fee_tax_amounts.rb:2:in `<class:MigrateEnterpriseFeeTaxAmounts>'
# ./db/migrate/20210406161242_migrate_enterprise_fee_tax_amounts.rb:1:in `<top (required)>'
# ./spec/migrations/migrate_enterprise_fee_tax_amounts_spec.rb:4:in `require_relative'
# ./spec/migrations/migrate_enterprise_fee_tax_amounts_spec.rb:4:in `<top (required)>'
# -e:1:in `<main>'
This commit is contained in:
Matt-Yorkley
2021-04-23 15:12:19 +01:00
parent bfea47802e
commit dc7c674a0e

View File

@@ -1,5 +1,5 @@
class MigrateEnterpriseFeeTaxAmounts < ActiveRecord::Migration[5.0]
class Spree::Adjustment < ActiveRecord::Base
class Spree::Adjustment < ApplicationRecord
belongs_to :originator, -> { with_deleted }, polymorphic: true
belongs_to :adjustable, polymorphic: true
belongs_to :order, class_name: "Spree::Order"
@@ -8,18 +8,18 @@ class MigrateEnterpriseFeeTaxAmounts < ActiveRecord::Migration[5.0]
scope :enterprise_fee, -> { where(originator_type: 'EnterpriseFee') }
end
class EnterpriseFee < ActiveRecord::Base
class EnterpriseFee < ApplicationRecord
belongs_to :tax_category, class_name: 'Spree::TaxCategory', foreign_key: 'tax_category_id'
end
class Spree::LineItem < ActiveRecord::Base
class Spree::LineItem < ApplicationRecord
belongs_to :variant, class_name: "Spree::Variant"
has_one :product, through: :variant
end
class Spree::Variant < ActiveRecord::Base
class Spree::Variant < ApplicationRecord
belongs_to :product, class_name: 'Spree::Product'
has_many :line_items, inverse_of: :variant
end
class Spree::Product < ActiveRecord::Base
class Spree::Product < ApplicationRecord
belongs_to :tax_category, class_name: 'Spree::TaxCategory'
has_many :variants, class_name: 'Spree::Variant'
end