Module: Workarea::Storefront::CatalogCustomizationTestClass

Extended by:
ActiveSupport::Concern
Defined in:
lib/workarea/storefront/catalog_customization_test_class.rb

Instance Method Summary collapse

Instance Method Details

#add_customization_classObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/workarea/storefront/catalog_customization_test_class.rb', line 11

def add_customization_class
  Workarea::Catalog::Customizations.const_set(
    'FooCust',
    Class.new(Catalog::Customizations) do
      customized_fields :foo, :bar

      validates :foo, presence: true
      validates :bar, presence: true
    end
  )
end

#remove_customization_classObject



23
24
25
# File 'lib/workarea/storefront/catalog_customization_test_class.rb', line 23

def remove_customization_class
  Workarea::Catalog::Customizations.send(:remove_const, 'FooCust')
end