Sha256: 24fad9911b9a1eb89cb07a9faa1219f4a99acdf0150fddf3260828454ffeb3d6

Contents?: true

Size: 770 Bytes

Versions: 5

Compression:

Stored size: 770 Bytes

Contents

require_relative '../model_creators'
require 'forwardable'

module UnitTests
  module ModelCreators
    class ActiveModel
      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::Basic.wrap(
          args.merge(
            model_creation_strategy: UnitTests::ModelCreationStrategies::ActiveModel
          )
        )
        @model_creator = Basic.new(arguments)
      end

      def call
        model_creator.call
      end

      protected

      attr_reader :arguments, :model_creator
    end

    register(:active_model, ActiveModel)
  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_model.rb
shoulda-matchers-4.0.0.rc1 spec/support/unit/model_creators/active_model.rb
shoulda-matchers-3.1.2 spec/support/unit/model_creators/active_model.rb
shoulda-matchers-3.1.1 spec/support/unit/model_creators/active_model.rb
shoulda-matchers-3.1.0 spec/support/unit/model_creators/active_model.rb