Sha256: f6186f6e4e2b8160a30e5ea70ed7dcc20ac9722ab95c7db5bc9f2f2a31e9a31d

Contents?: true

Size: 942 Bytes

Versions: 11

Compression:

Stored size: 942 Bytes

Contents

require 'spec_helper'

describe Spree::OrderedPropertyValueList do
  #
  # Using ProductProperty as a subject
  # since it includes OrderedPropertyValueList
  #
  let(:product_property) { create(:product_property) }

  context "validations" do
    # Only MySQL stores or stores that were migrated prior to the Rails 4.2
    # upgrade have length limitations on "value":
    # > The PostgreSQL and SQLite adapters no longer add a default limit of 255
    # > characters on string columns.
    # http://guides.rubyonrails.org/4_2_release_notes.html#active-record-notable-changes
    # https://github.com/rails/rails/pull/14579
    if Spree::ProductProperty.columns_hash['value'].limit
      it "should validate length of value" do
        overflow_length = Spree::ProductProperty.columns_hash['value'].limit + 1
        product_property.value = "x" * overflow_length
        expect(product_property).not_to be_valid
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
solidus_core-1.2.3 spec/models/spree/concerns/ordered_property_value_list_spec.rb
solidus_core-1.1.4 spec/models/spree/concerns/ordered_property_value_list_spec.rb
solidus_core-1.2.2 spec/models/spree/concerns/ordered_property_value_list_spec.rb
solidus_core-1.2.1 spec/models/spree/concerns/ordered_property_value_list_spec.rb
solidus_core-1.1.3 spec/models/spree/concerns/ordered_property_value_list_spec.rb
solidus_core-1.2.0 spec/models/spree/concerns/ordered_property_value_list_spec.rb
solidus_core-1.2.0.rc2 spec/models/spree/concerns/ordered_property_value_list_spec.rb
solidus_core-1.1.2 spec/models/spree/concerns/ordered_property_value_list_spec.rb
solidus_core-1.2.0.rc1 spec/models/spree/concerns/ordered_property_value_list_spec.rb
solidus_core-1.2.0.beta1 spec/models/spree/concerns/ordered_property_value_list_spec.rb
solidus_core-1.1.1 spec/models/spree/concerns/ordered_property_value_list_spec.rb