Sha256: 44751a6b93c930730f1b1be579ef6309cc7419f5cdb9105f4cc35b867ec8f15c

Contents?: true

Size: 704 Bytes

Versions: 11

Compression:

Stored size: 704 Bytes

Contents

require 'spec_helper'

describe Spree::Asset, :type => :model do
  describe "#viewable" do
    it "touches association" do
      product = create(:custom_product)
      asset = Spree::Asset.create! { |a| a.viewable = product.master }

      expect do
        asset.touch
      end.to change { product.reload.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

11 entries across 11 versions & 1 rubygems

Version Path
spree_core-3.0.10 spec/models/spree/asset_spec.rb
spree_core-3.1.0 spec/models/spree/asset_spec.rb
spree_core-3.1.0.rc4 spec/models/spree/asset_spec.rb
spree_core-3.0.9 spec/models/spree/asset_spec.rb
spree_core-3.1.0.rc3 spec/models/spree/asset_spec.rb
spree_core-3.1.0.rc2 spec/models/spree/asset_spec.rb
spree_core-3.1.0.rc1 spec/models/spree/asset_spec.rb
spree_core-3.0.8 spec/models/spree/asset_spec.rb
spree_core-3.0.7 spec/models/spree/asset_spec.rb
spree_core-3.0.6.1 spec/models/spree/asset_spec.rb
spree_core-3.0.6 spec/models/spree/asset_spec.rb