Sha256: e9a072f8dbe0691a8d8112b1c9677906fc39b9ddd10ff2214f918732593dde71

Contents?: true

Size: 670 Bytes

Versions: 16

Compression:

Stored size: 670 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

16 entries across 16 versions & 1 rubygems

Version Path
solidus_core-1.2.3 spec/models/spree/asset_spec.rb
solidus_core-1.1.4 spec/models/spree/asset_spec.rb
solidus_core-1.0.7 spec/models/spree/asset_spec.rb
solidus_core-1.0.6 spec/models/spree/asset_spec.rb
solidus_core-1.2.2 spec/models/spree/asset_spec.rb
solidus_core-1.2.1 spec/models/spree/asset_spec.rb
solidus_core-1.1.3 spec/models/spree/asset_spec.rb
solidus_core-1.0.5 spec/models/spree/asset_spec.rb
solidus_core-1.2.0 spec/models/spree/asset_spec.rb
solidus_core-1.2.0.rc2 spec/models/spree/asset_spec.rb
solidus_core-1.0.4 spec/models/spree/asset_spec.rb
solidus_core-1.1.2 spec/models/spree/asset_spec.rb
solidus_core-1.2.0.rc1 spec/models/spree/asset_spec.rb
solidus_core-1.2.0.beta1 spec/models/spree/asset_spec.rb
solidus_core-1.0.3 spec/models/spree/asset_spec.rb
solidus_core-1.1.1 spec/models/spree/asset_spec.rb