Sha256: a554650b06a0a322f4c7de45aa3b3705f2946757bed927c078b9d9bd67ea4de6

Contents?: true

Size: 628 Bytes

Versions: 52

Compression:

Stored size: 628 Bytes

Contents

module FactoryGirl
  class Declaration
    # @api private
    class Association < Declaration
      def initialize(name, *options)
        super(name, false)
        @options = options.dup
        @overrides = options.extract_options!
        @traits = options
      end

      def ==(other)
        name == other.name &&
          options == other.options
      end

      protected
      attr_reader :options

      private

      def build
        factory_name = @overrides[:factory] || name
        [Attribute::Association.new(name, factory_name, [@traits, @overrides.except(:factory)].flatten)]
      end
    end
  end
end

Version data entries

52 entries across 40 versions & 11 rubygems

Version Path
ffactory_girl-4.8.2 lib/factory_girl/declaration/association.rb
factory_girl-4.9.0 lib/factory_girl/declaration/association.rb
ffactory_girl-4.8.1 lib/factory_girl/declaration/association.rb
factory_girl-4.8.1 lib/factory_girl/declaration/association.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/factory_girl-4.8.0/lib/factory_girl/declaration/association.rb
factory_girl-4.8.0 lib/factory_girl/declaration/association.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/factory_girl-4.7.0/lib/factory_girl/declaration/association.rb
factory_girl-4.7.0 lib/factory_girl/declaration/association.rb
opal-factory_girl-4.5.0.3 factory_girl/lib/factory_girl/declaration/association.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/factory_girl-4.5.0/lib/factory_girl/declaration/association.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/factory_girl-4.5.0/lib/factory_girl/declaration/association.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/factory_girl-4.5.0/lib/factory_girl/declaration/association.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/factory_girl-4.5.0/lib/factory_girl/declaration/association.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/factory_girl-4.4.0/lib/factory_girl/declaration/association.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/factory_girl-4.4.0/lib/factory_girl/declaration/association.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/factory_girl-4.4.0/lib/factory_girl/declaration/association.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/factory_girl-4.4.0/lib/factory_girl/declaration/association.rb
factory_girl-4.5.0 lib/factory_girl/declaration/association.rb
factory_girl-4.4.0 lib/factory_girl/declaration/association.rb
factory_girl-4.3.0 lib/factory_girl/declaration/association.rb