Sha256: f2a2ad1903e7633024ce17fee7b94b66a0a80e6fc246c818bc0735811d43e1b2

Contents?: true

Size: 560 Bytes

Versions: 4

Compression:

Stored size: 560 Bytes

Contents

require 'spec_helper'

describe ROM::Mapper::ModelDSL do
  describe '#model' do
    it 'calls the builder with non-excluded attributes only' do
      definition_class = Class.new do
        include ROM::Mapper::ModelDSL

        def initialize
          @attributes = [[:name], [:title, { exclude: true }]]
          @builder = ->(attrs) { Struct.new(*attrs) }
        end
      end
      model_instance = definition_class.new.model.new
      expect(model_instance).to respond_to(:name)
      expect(model_instance).to_not respond_to(:title)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rom-mapper-0.4.0 spec/unit/rom/mapper/model_dsl_spec.rb
rom-mapper-0.3.0 spec/unit/rom/mapper/model_dsl_spec.rb
rom-mapper-0.3.0.rc1 spec/unit/rom/mapper/model_dsl_spec.rb
rom-mapper-0.3.0.beta1 spec/unit/rom/mapper/model_dsl_spec.rb