Sha256: d2a7b8c7e3aa52ad9c8d1e977665e9be5510cc1eadd098647623b35b414b13b8
Contents?: true
Size: 613 Bytes
Versions: 3
Compression:
Stored size: 613 Bytes
Contents
require "dry/transaction/operation" RSpec.describe Dry::Transaction::Operation do subject(:operation) { Class.new do include Dry::Transaction::Operation def call(input) Right(input) end end.new } it "mixes in the Either monad constructors" do expect(operation.("hello")).to be_right end it "supports pattern matching when called with a block" do result = operation.("hello") do |m| m.success do |v| "Success: #{v}" end m.failure do |v| "Failure: #{v}" end end expect(result).to eq "Success: hello" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dry-transaction-0.10.2 | spec/integration/operation_spec.rb |
dry-transaction-0.10.1 | spec/integration/operation_spec.rb |
dry-transaction-0.10.0 | spec/integration/operation_spec.rb |