Sha256: 7acd8dfbdebc8d255845d5d0fa462e8521702fac0b86975c18cba80414c4b055

Contents?: true

Size: 948 Bytes

Versions: 17

Compression:

Stored size: 948 Bytes

Contents

RSpec.shared_context 'models' do
  let(:user_model) { Test::Models::User }
  let(:task_model) { Test::Models::Task }
  let(:tag_model) { Test::Models::Tag }

  before do
    module Test
      module Models
        class User
          include Dry::Equalizer(:id, :name)

          attr_reader :id, :name

          def initialize(attrs)
            @id, @name = attrs[:id], attrs[:name]
          end
        end

        class Task
          include Dry::Equalizer(:id, :user_id, :title)

          attr_reader :id, :user_id, :title

          def initialize(attrs)
            @id, @name, @title = attrs[:id], attrs[:name], attrs[:title]
          end
        end

        class Tag
          include Dry::Equalizer(:id, :task_id, :name)

          attr_reader :id, :task_id, :name

          def initialize(attrs)
            @id, @task_id, @name = attrs[:id], attrs[:task_id], attrs[:name]
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rom-repository-1.4.0 spec/shared/models.rb
rom-repository-1.3.3 spec/shared/models.rb
rom-repository-1.3.2 spec/shared/models.rb
rom-repository-1.3.1 spec/shared/models.rb
rom-repository-1.3.0 spec/shared/models.rb
rom-repository-1.2.0 spec/shared/models.rb
rom-repository-1.1.0 spec/shared/models.rb
rom-repository-1.0.2 spec/shared/models.rb
rom-repository-1.0.1 spec/shared/models.rb
rom-repository-1.0.0 spec/shared/models.rb
rom-repository-1.0.0.rc2 spec/shared/models.rb
rom-repository-1.0.0.rc1 spec/shared/models.rb
rom-repository-1.0.0.beta3 spec/shared/models.rb
rom-repository-1.0.0.beta2 spec/shared/models.rb
rom-repository-1.0.0.beta1 spec/shared/models.rb
rom-repository-0.3.1 spec/shared/models.rb
rom-repository-0.3.0 spec/shared/models.rb