Sha256: 59d4ab767886e6c68164038f3f9e8e34ea73b2a15d9e3268c27f58b7d7d7ef79

Contents?: true

Size: 574 Bytes

Versions: 1

Compression:

Stored size: 574 Bytes

Contents

require 'spec_helper'

describe 'User commands' do
  subject(:users) { rom.command(:users) }

  describe 'create' do
    it 'inserts user with valid params' do
      result = users.try { create(name: 'Jade') }

      expect(result.value).to eql(id: 1, name: 'Jade')
    end

    it 'returns error if params are not valid' do
      result = users.try { create(name: '') }

      expect(result.value).to be(nil)
      expect(result.error).to be_instance_of(ROM::Model::ValidationError)
      expect(result.error.messages[:name]).to include("can't be blank")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-rails-0.2.0 spec/dummy/spec/integration/user_commands_spec.rb