Sha256: 11836674dd7220d0e081856f3c5052d2ef793e070be58832735e9155038bed3b
Contents?: true
Size: 1015 Bytes
Versions: 9
Compression:
Stored size: 1015 Bytes
Contents
module LightServiceExt RSpec.describe ApplicationAction do FakeApplicationAction = Class.new(described_class) do executed do |context| value = context.dig(:input, :callback).call context.add_params(value: value) context.add_errors!(value: value) end end let(:organizer_class) do Class.new(ApplicationOrganizer) do def self.steps [FakeApplicationAction] end end end let(:value) { 'some-value' } let(:callback) { -> { value } } let(:input) { { callback: callback } } let(:ctx) do LightService::Testing::ContextFactory .make_from(organizer_class) .for(FakeApplicationAction) .with(callback: callback) end subject(:context) do FakeApplicationAction.execute(ctx) end it 'adds value returned by callback to params' do expect(context.keys).to include(:input, :errors, :params) expect(context[:params]).to eql({ value: value }) end end end
Version data entries
9 entries across 9 versions & 1 rubygems