Sha256: c1846cdc4e9eadb7e4a331d0fe22a6ccd03b49184591648b9fb18c3303da51e1

Contents?: true

Size: 566 Bytes

Versions: 4

Compression:

Stored size: 566 Bytes

Contents

require 'spec_helper'

RSpec.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.5.1 spec/unit/rom/mapper/model_dsl_spec.rb
rom-mapper-0.5.0 spec/unit/rom/mapper/model_dsl_spec.rb
rom-mapper-0.5.0.rc1 spec/unit/rom/mapper/model_dsl_spec.rb
rom-mapper-0.5.0.beta1 spec/unit/rom/mapper/model_dsl_spec.rb