Sha256: f0ff12b3138c772c0a5a090320c1b803f7ed21d0cd982f639a287207bb6342bc

Contents?: true

Size: 528 Bytes

Versions: 2

Compression:

Stored size: 528 Bytes

Contents

require 'spec_helper'

describe 'Commands / Update' do
  include_context 'users and tasks'

  subject(:users) { rom.commands.users }

  it 'works' do
    setup.relation(:users) do
      def by_name(name)
        where(name: name)
      end
    end

    setup.commands(:users) do
      define(:update) do
        input Hash
        validator Proc.new {}
      end
    end

    result = users.try { update(:by_name, 'Piotr').set(name: 'Peter') }

    expect(result.value.to_a).to match_array([{ id: 1, name: 'Peter' }])
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rom-sql-0.3.0 spec/integration/commands/update_spec.rb
rom-sql-0.2.0 spec/integration/commands/update_spec.rb