Sha256: cfaa7c4fbb9af8041c06ad00b3dd09524271ef5148f28bd377420e31ce8704ca

Contents?: true

Size: 563 Bytes

Versions: 4

Compression:

Stored size: 563 Bytes

Contents

require 'spec_helper'

describe 'Commands / Try api' do
  include_context 'users and tasks'

  before do
    setup.relation(:users)

    setup.commands(:users) do
      define(:create)
    end
  end

  let(:user_commands) { rom.command(:users) }

  it 'exposes command functions inside the block' do
    input = { name: 'Piotr', email: 'piotr@test.com' }

    result = user_commands.try { create(input) }

    expect(result.value).to eql([input])
  end

  it 'raises on method missing' do
    expect { users.try { not_here } }.to raise_error(NameError)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rom-0.5.0 spec/integration/commands/try_spec.rb
rom-0.4.2 spec/integration/commands/try_spec.rb
rom-0.4.1 spec/integration/commands/try_spec.rb
rom-0.4.0 spec/integration/commands/try_spec.rb