Sha256: 4b30ca0b1869ef2fddfcdda0b8e5b2c4a19148d8c9b22bae83b4c67bfb9dc800

Contents?: true

Size: 779 Bytes

Versions: 1

Compression:

Stored size: 779 Bytes

Contents

RSpec.describe Dry::Transaction::StepDefinition do
  let(:container) do
    { test: -> input { "This is a test with input: #{input.inspect}" } }
  end

  let(:step_definition) do
    Dry::Transaction::StepDefinition.new(container) do |input|
      Right(container[:test].call(input))
    end
  end

  it { expect(step_definition).to be_kind_of(Dry::Monads::Either::Mixin) }

  describe '#initialize' do
    subject! { step_definition }

    it { is_expected.to be_frozen }
  end

  describe '#call' do
    let(:input) { { test: 'test' } }

    subject!(:result) { step_definition.call(input) }

    it do
      expect(result.value).to eq(
        "This is a test with input: {:test=>\"test\"}"
      )
    end
    it { is_expected.to be_a(Dry::Monads::Either::Right) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-transaction-0.9.0 spec/unit/step_definition_spec.rb