Sha256: e2492bcbc1cefbfec741e0d9a8a1fb60fb7eedae9b85835fc1615b771e882782

Contents?: true

Size: 774 Bytes

Versions: 1

Compression:

Stored size: 774 Bytes

Contents

# frozen_string_literal: true
require 'spec_helper'

describe Apress::Api::Callbacks::Integration, type: :mixin do
  describe '#notify_service' do
    context 'when callback is set' do
      let(:model) { DummyModel.new }
      it 'calls delayed interactor' do
        expect(Apress::Api::DelayedFireCallback).to receive(:call!).with(event: 'some_event', params: {name: nil})

        model.save
      end
    end

    context 'when params are lambda' do
      let(:model) { DummyModel.create!(name: 'test') }
      it 'calls delayed interactor' do
        expect(Apress::Api::DelayedFireCallback).to \
          receive(:call!).with(event: 'dynamic_params_event', params: {name: 'test_2 stuff'})

        model.update_attributes(name: 'test_2')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
apress-api-1.24.2 spec/lib/apress/api/callbacks/integration_spec.rb