Sha256: bbca3e0128dae66eb15fe758ef2e06daa883f4ad5470e9916f4aa9c99d94ecfe

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

module LightServiceExt
  RSpec.describe AllActionsCompleteAction do
    let(:allow_raise_on_failure) { false }
    let(:failure) { false }
    let(:errors) { {} }
    let(:input) { { key: 'some-value' } }
    let(:overrides) { { errors: errors, allow_raise_on_failure: allow_raise_on_failure } }
    let(:ctx) { ApplicationContext.make_with_defaults(input, overrides) }

    subject(:executed_ctx) { described_class.execute(ctx) }

    context 'with raising of errors allowed' do
      let(:allow_raise_on_failure) { true }

      it 'does not raise error' do
        expect { executed_ctx }.not_to raise_error
      end
    end

    context 'with failed context' do
      let(:errors) { { key: 'must be filled' } }

      it 'does not raise error' do
        expect { executed_ctx }.not_to raise_error

        expect(executed_ctx.keys).to include(:outcome)
      end

      context 'with raising of errors allowed' do
        let(:allow_raise_on_failure) { true }

        it 'raises custom context error' do
          expect { executed_ctx }.to raise_error ContextError
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
light-service-ext-0.1.2 spec/light-service-ext/all_actions_complete_action_spec.rb
light-service-ext-0.1.1 spec/light_service_ext/all_actions_complete_action_spec.rb
light-service-ext-0.1.0 spec/light_service_ext/all_actions_complete_action_spec.rb