Sha256: e9d6f763fdeec4f6bf32a196bb6ffe2b5d6b592bd43d7fe1f73fe82bf0763011

Contents?: true

Size: 855 Bytes

Versions: 5

Compression:

Stored size: 855 Bytes

Contents

require_relative '../../model_creators'
require 'forwardable'

module UnitTests
  module ModelCreators
    class ActiveRecord
      class UniquenessMatcher
        def self.call(args)
          new(args).call
        end

        extend Forwardable

        def_delegators(
          :arguments,
          :attribute_name,
          :attribute_default_values_by_name,
        )

        def initialize(args)
          @arguments = CreateModelArguments::UniquenessMatcher.wrap(args)
          @model_creator = UnitTests::ModelCreators::ActiveRecord.new(
            arguments
          )
        end

        def call
          model_creator.call
        end

        protected

        attr_reader :arguments, :model_creator
      end
    end

    register(
      :"active_record/uniqueness_matcher",
      ActiveRecord::UniquenessMatcher
    )
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shoulda-matchers-3.1.3 spec/support/unit/model_creators/active_record/uniqueness_matcher.rb
shoulda-matchers-4.0.0.rc1 spec/support/unit/model_creators/active_record/uniqueness_matcher.rb
shoulda-matchers-3.1.2 spec/support/unit/model_creators/active_record/uniqueness_matcher.rb
shoulda-matchers-3.1.1 spec/support/unit/model_creators/active_record/uniqueness_matcher.rb
shoulda-matchers-3.1.0 spec/support/unit/model_creators/active_record/uniqueness_matcher.rb