Sha256: 9508096ddd9393d65aef0af87e202a7afd73d96cc66ce1a18d47e4b7d16c5bf9

Contents?: true

Size: 899 Bytes

Versions: 6

Compression:

Stored size: 899 Bytes

Contents

# frozen_string_literal: true

module LightServiceExt
  RSpec.describe ApplicationOrganizer do
    let(:subject_class) do
      Class.new(described_class) do
        class << self
          FakeAction = Class.new do
            extend LightService::Action

            expects :input

            executed do |context|
              context.dig(:input, :some_proc).call
            end
          end

          def steps
            [FakeAction]
          end
        end
      end
    end

    let(:input) { { some_proc: proc {} } }

    it 'adds inputted data as input key value pair' do
      ctx = subject_class.call(input)

      expect(ctx.keys).to include(:input)
      expect(ctx[:input]).to eql(input)
    end

    it 'calls underlying action' do
      expect do
        subject_class.call(some_proc: proc { raise 'error' })
      end.to raise_error RuntimeError, 'error'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
light-service-ext-0.1.8 spec/light-service-ext/application_organizer_spec.rb
light-service-ext-0.1.7 spec/light-service-ext/application_organizer_spec.rb
light-service-ext-0.1.6 spec/light-service-ext/application_organizer_spec.rb
light-service-ext-0.1.5 spec/light-service-ext/application_organizer_spec.rb
light-service-ext-0.1.4 spec/light-service-ext/application_organizer_spec.rb
light-service-ext-0.1.3 spec/light-service-ext/application_organizer_spec.rb