Sha256: ba03ada312745acc29e82acfee1cead1b191e402643c957b77733e0be18cbaeb

Contents?: true

Size: 666 Bytes

Versions: 32

Compression:

Stored size: 666 Bytes

Contents

require 'spec_helper'

describe Spree::Asset, type: :model do
  describe "#viewable" do
    it "touches association" do
      product = build(:custom_product)

      expect do
        Spree::Asset.create! { |a| a.viewable = product.master }
      end.to change { product.updated_at }
    end
  end

  describe "#acts_as_list scope" do
    it "should start from first position for different viewables" do
      asset1 = Spree::Asset.create(viewable_type: 'Spree::Image', viewable_id: 1)
      asset2 = Spree::Asset.create(viewable_type: 'Spree::LineItem', viewable_id: 1)

      expect(asset1.position).to eq 1
      expect(asset2.position).to eq 1
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
solidus_core-2.1.0.beta1 spec/models/spree/asset_spec.rb
solidus_core-2.0.0 spec/models/spree/asset_spec.rb
solidus_core-1.4.0 spec/models/spree/asset_spec.rb
solidus_core-2.0.0.rc1 spec/models/spree/asset_spec.rb
solidus_core-1.4.0.rc1 spec/models/spree/asset_spec.rb
solidus_core-2.0.0.beta1 spec/models/spree/asset_spec.rb
solidus_core-1.4.0.beta1 spec/models/spree/asset_spec.rb
solidus_core-1.3.1 spec/models/spree/asset_spec.rb
solidus_core-1.3.0 spec/models/spree/asset_spec.rb
solidus_core-1.3.0.rc2 spec/models/spree/asset_spec.rb
solidus_core-1.3.0.rc1 spec/models/spree/asset_spec.rb
solidus_core-1.3.0.beta1 spec/models/spree/asset_spec.rb