Sha256: e1c1d44295c0873b900328a3f287d4e38a9d1c44db535de2ba3bb7b0d203888b

Contents?: true

Size: 1.09 KB

Versions: 9

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(:status)
      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

9 entries across 9 versions & 1 rubygems

Version Path
light-service-ext-0.1.11 spec/light-service-ext/all_actions_complete_action_spec.rb
light-service-ext-0.1.10 spec/light-service-ext/all_actions_complete_action_spec.rb
light-service-ext-0.1.9 spec/light-service-ext/all_actions_complete_action_spec.rb
light-service-ext-0.1.8 spec/light-service-ext/all_actions_complete_action_spec.rb
light-service-ext-0.1.7 spec/light-service-ext/all_actions_complete_action_spec.rb
light-service-ext-0.1.6 spec/light-service-ext/all_actions_complete_action_spec.rb
light-service-ext-0.1.5 spec/light-service-ext/all_actions_complete_action_spec.rb
light-service-ext-0.1.4 spec/light-service-ext/all_actions_complete_action_spec.rb
light-service-ext-0.1.3 spec/light-service-ext/all_actions_complete_action_spec.rb