Sha256: ff767e794ff3d53a472a4649d30fa6f30d9ed1389947a1d4e72c2dfa6b0d3deb

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

require 'test_helper'

module Workarea
  module GlobalE
    class CountryExceptionTest < Workarea::TestCase
      def test_unique_country
        product = Catalog::Product.new(
          country_exceptions: [
            {
              country: Country["AT"],
              restricted: true,
            },
            {
              country: Country["AT"],
              restricted: true
            }
          ]
        )

        refute product.country_exceptions.first.valid?
        assert_equal [I18n.t('workarea.country_exception.errors.country_must_be_unique')], product.country_exceptions.first.errors[:base]

        refute product.country_exceptions.second.valid?
        assert_equal [I18n.t('workarea.country_exception.errors.country_must_be_unique')], product.country_exceptions.second.errors[:base]
      end

      def test_restricted_or_vat_rate_presence
        country_exception = CountryException.new

        refute country_exception.valid?

        assert_equal [I18n.t('workarea.country_exception.errors.restricted_or_vat_rate_required')], country_exception.errors[:base]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-global_e-1.3.0 test/models/workarea/global_e/country_exception_test.rb
workarea-global_e-1.2.1 test/models/workarea/global_e/country_exception_test.rb