Sha256: eacd17e6748a6e2f85ac38cc3db5720bb8274afb6671e2695c42e60ca84a4123

Contents?: true

Size: 805 Bytes

Versions: 70

Compression:

Stored size: 805 Bytes

Contents

require "factory_girl/strategy/build"
require "factory_girl/strategy/create"
require "factory_girl/strategy/attributes_for"
require "factory_girl/strategy/stub"
require "observer"

module FactoryGirl
  class Strategy #:nodoc:
    include Observable

    def association(runner)
      raise NotImplementedError, "Strategies must return an association"
    end

    def result(attribute_assigner, to_create)
      raise NotImplementedError, "Strategies must return a result"
    end

    def self.ensure_strategy_exists!(strategy)
      unless Strategy.const_defined? strategy.to_s.camelize
        raise ArgumentError, "Unknown strategy: #{strategy}"
      end
    end

    private

    def run_callbacks(name, result_instance)
      changed
      notify_observers(name, result_instance)
    end
  end
end

Version data entries

70 entries across 66 versions & 5 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.7.4 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.7.3 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/factory_girl-2.6.4/lib/factory_girl/strategy.rb
classiccms-0.7.2 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.7.1 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.7.0 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.6.9 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.6.8 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.6.7 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.6.6 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.6.5 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.6.4 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.6.3 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.6.2 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.6.1 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.6.0 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.5.17 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.5.16 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb
classiccms-0.5.15 vendor/bundle/gems/factory_girl-3.0.0/lib/factory_girl/strategy.rb