Sha256: 90db6d334d84aa6c471d4dc2a383afc3e0b652a36c96bb64bd08f7317b00d3f5

Contents?: true

Size: 701 Bytes

Versions: 2

Compression:

Stored size: 701 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Spree::Variant do
  let(:variant) { create(:variant) }
  let(:drip) { variant.drip }

  describe 'action hooks' do
    it "triggers on create" do
      product = variant.product
      expect_any_instance_of(SolidusDrip::ShopperActivity::Product).
        to(receive(:product_activity).with('created'))
      product.variants.create
    end

    it "triggers on update" do
      expect(drip).to(receive(:product_activity).with('updated'))
      variant.update(updated_at: Time.current)
    end

    it "triggers on destroy" do
      expect(drip).to(receive(:product_activity).with('deleted'))
      variant.destroy
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_drip-0.1.0 spec/models/variant_spec.rb
solidus_drip-0.0.1 spec/models/variant_spec.rb