Sha256: 9a5dbb66835b495fd52b510c127a3c3d953b7bf892151be363a062d0d3879267

Contents?: true

Size: 744 Bytes

Versions: 4

Compression:

Stored size: 744 Bytes

Contents

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

4 entries across 4 versions & 1 rubygems

Version Path
apress-api-1.24.0 spec/lib/apress/api/callbacks/integration_spec.rb
apress-api-1.23.0 spec/lib/apress/api/callbacks/integration_spec.rb
apress-api-1.22.1 spec/lib/apress/api/callbacks/integration_spec.rb
apress-api-1.22.0 spec/lib/apress/api/callbacks/integration_spec.rb