require 'spec_helper'

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

      product.update_column(:updated_at,  1.day.ago)

      expect do
        asset.touch
      end.to change { product.reload.updated_at }
    end
  end
end

require 'spec_helper'

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

      product.update_column(:updated_at,  1.day.ago)

      expect do
        asset.save
      end.to change { product.reload.updated_at }
    end
  end
end

Save Asset rather than touch
Save Asset rather than touch

spree_assets doesnt have timestamps fields and as of rails 4.0.4 it wont
touch associations anymore for models that dont have timestamps fields
