Sha256: 148bfc9c0ce10af19c8dfc60f1c4e13edcf2e4f4a2e2a131df0989fa544db494

Contents?: true

Size: 749 Bytes

Versions: 6

Compression:

Stored size: 749 Bytes

Contents

module FactoryBot
  class Declaration
    # @api private
    class Implicit < Declaration
      def initialize(name, factory = nil, ignored = false)
        super(name, ignored)
        @factory = factory
      end

      def ==(other)
        name == other.name &&
          factory == other.factory &&
          ignored == other.ignored
      end

      protected
      attr_reader :factory

      private

      def build
        if FactoryBot.factories.registered?(name)
          [Attribute::Association.new(name, name, {})]
        elsif FactoryBot.sequences.registered?(name)
          [Attribute::Sequence.new(name, name, @ignored)]
        else
          @factory.inherit_traits([name])
          []
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
factory_bot-4.11.1 lib/factory_bot/declaration/implicit.rb
factory_bot-4.11.0 lib/factory_bot/declaration/implicit.rb
factory_bot-4.10.0 lib/factory_bot/declaration/implicit.rb
factory_bot-4.8.2 lib/factory_bot/declaration/implicit.rb
factory_bot-1.0.1.alpha lib/factory_bot/declaration/implicit.rb
factory_bot-1.0.0.alpha lib/factory_bot/declaration/implicit.rb