Sha256: 01af2104bfe9964778e43c5acb3f7c03d1100b6691056efe29694ccd25d50518

Contents?: true

Size: 431 Bytes

Versions: 2

Compression:

Stored size: 431 Bytes

Contents

require 'spec_helper'

describe ROM::Model::Params do
  let(:klass) {
    Class.new do
      include ROM::Model::Params

      attribute :name, String
    end
  }

  it 'fails loudly when given an incorrect type' do
    expect {
      klass.new(name: [])
    }.to raise_error(Virtus::CoercionError, /name/)
  end

  it 'does not fail on nil or missing attributes' do
    expect {
      klass.new
    }.not_to raise_error
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rom-rails-0.3.0.beta1 spec/unit/params_spec.rb
rom-rails-0.2.1 spec/unit/model_spec.rb