Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 87 lines (75 sloc) 2.231 kb
f721bc6 @joshuaclayton Initial work on DeclarationList and cleaning up AttributeList
joshuaclayton authored
1 require "active_support/core_ext/module/delegation"
2
98626c9 @joshuaclayton Move errors to separate file
joshuaclayton authored
3 require 'factory_girl/errors'
4145a6e @joshuaclayton Replace AssociationRunner with more generic FactoryRunner
joshuaclayton authored
4 require 'factory_girl/factory_runner'
5 require 'factory_girl/strategy_calculator'
89d5e94 @joshuaclayton Refactor Strategies
joshuaclayton authored
6 require "factory_girl/strategy/build"
7 require "factory_girl/strategy/create"
8 require "factory_girl/strategy/attributes_for"
9 require "factory_girl/strategy/stub"
10 require "factory_girl/strategy/null"
393b299 @joshuaclayton Add StaticRegistry decorator to mix in exceptions
joshuaclayton authored
11 require 'factory_girl/strict_registry'
5aea0f4 @jferris Use a registry class for keeping factories and sequences. Treat
jferris authored
12 require 'factory_girl/registry'
aee300a @joshuaclayton Add NullFactory
joshuaclayton authored
13 require 'factory_girl/null_factory'
1c7eab1 @joshuaclayton Add NullObject
joshuaclayton authored
14 require 'factory_girl/null_object'
89d5e94 @joshuaclayton Refactor Strategies
joshuaclayton authored
15 require 'factory_girl/evaluation'
6a553ca @jferris Created a project skeleton with the Factory class
jferris authored
16 require 'factory_girl/factory'
3eccbc5 @joshuaclayton Add AttributeAssigner to handle attribute assignment on the build class ...
joshuaclayton authored
17 require 'factory_girl/attribute_assigner'
b72c916 @joshuaclayton AnonymousEvaluator => EvaluatorClassDefiner
joshuaclayton authored
18 require 'factory_girl/evaluator'
19 require 'factory_girl/evaluator_class_definer'
03fa0d1 @jferris Refactored attributes into their own class
jferris authored
20 require 'factory_girl/attribute'
4d30663 @jferris Callbacks aren't attributes
jferris authored
21 require 'factory_girl/callback'
4142b5e @joshuaclayton Rename CallbackRunner to CallbacksObserver since it's an observer
joshuaclayton authored
22 require 'factory_girl/callbacks_observer'
f721bc6 @joshuaclayton Initial work on DeclarationList and cleaning up AttributeList
joshuaclayton authored
23 require 'factory_girl/declaration_list'
a154e64 Introduce declarations
Joe Ferris and Josh Clayton authored
24 require 'factory_girl/declaration'
fa36b1d @jferris Added support for sequences
jferris authored
25 require 'factory_girl/sequence'
82746c2 @joshuaclayton Add attribute lists
joshuaclayton authored
26 require 'factory_girl/attribute_list'
1c74d9d @joshuaclayton Rename attribute groups to traits
joshuaclayton authored
27 require 'factory_girl/trait'
98e6c51 @jferris #12 - added attribute aliases
jferris authored
28 require 'factory_girl/aliases'
41bc3ac @joshuaclayton Add FactoryGirl::Definition
joshuaclayton authored
29 require 'factory_girl/definition'
ac8875c @jferris Extracted yielded object for dsl into a proxy; moved default public api ...
jferris authored
30 require 'factory_girl/definition_proxy'
9472a14 @joshuaclayton Move around requires
joshuaclayton authored
31 require 'factory_girl/syntax'
29a5ab1 @joshuaclayton Implicitly call FactoryGirl's syntax methods from dynamic attributes
joshuaclayton authored
32 require 'factory_girl/syntax_runner'
8b4a6a1 @jferris Moved definition loading syntax out of the factory class; moved everythi...
jferris authored
33 require 'factory_girl/find_definitions'
3798144 @joshuaclayton FactoryGirl.reload clears all registries and loads all known definitions
joshuaclayton authored
34 require 'factory_girl/reload'
5c88bb0 @jferris Renamed Factory#factory_name to Factory#name; cleaned up Factory#human_n...
jferris authored
35 require 'factory_girl/version'
eb8b774 @jferris Fixed definition autoloading support for rails 2.x when config.gem is in...
jferris authored
36
c59981d @jferris Split factories/sequences into separate registries most of the time;
jferris authored
37 module FactoryGirl
38 def self.factories
393b299 @joshuaclayton Add StaticRegistry decorator to mix in exceptions
joshuaclayton authored
39 @factories ||= StrictRegistry.new(Registry.new("Factory"))
c59981d @jferris Split factories/sequences into separate registries most of the time;
jferris authored
40 end
41
42 def self.register_factory(factory)
eca2cbf @joshuaclayton Clean up registry by not requiring the object registered respond to #nam...
joshuaclayton authored
43 factory.names.each do |name|
44 factories.register(name, factory)
45 end
46 factory
c59981d @jferris Split factories/sequences into separate registries most of the time;
jferris authored
47 end
48
49 def self.factory_by_name(name)
50 factories.find(name)
51 end
52
53 def self.sequences
393b299 @joshuaclayton Add StaticRegistry decorator to mix in exceptions
joshuaclayton authored
54 @sequences ||= StrictRegistry.new(Registry.new("Sequence"))
c59981d @jferris Split factories/sequences into separate registries most of the time;
jferris authored
55 end
56
57 def self.register_sequence(sequence)
eca2cbf @joshuaclayton Clean up registry by not requiring the object registered respond to #nam...
joshuaclayton authored
58 sequence.names.each do |name|
59 sequences.register(name, sequence)
60 end
61 sequence
c59981d @jferris Split factories/sequences into separate registries most of the time;
jferris authored
62 end
63
64 def self.sequence_by_name(name)
65 sequences.find(name)
66 end
a78bc2a @joshuaclayton WIP: initial cleanup
joshuaclayton authored
67
1c74d9d @joshuaclayton Rename attribute groups to traits
joshuaclayton authored
68 def self.traits
393b299 @joshuaclayton Add StaticRegistry decorator to mix in exceptions
joshuaclayton authored
69 @traits ||= StrictRegistry.new(Registry.new("Trait"))
3800888 @twalpole Add global attr_group support
twalpole authored
70 end
71
1c74d9d @joshuaclayton Rename attribute groups to traits
joshuaclayton authored
72 def self.register_trait(trait)
eca2cbf @joshuaclayton Clean up registry by not requiring the object registered respond to #nam...
joshuaclayton authored
73 trait.names.each do |name|
74 traits.register(name, trait)
75 end
76 trait
3800888 @twalpole Add global attr_group support
twalpole authored
77 end
78
1c74d9d @joshuaclayton Rename attribute groups to traits
joshuaclayton authored
79 def self.trait_by_name(name)
80 traits.find(name)
3800888 @twalpole Add global attr_group support
twalpole authored
81 end
09e1cea @joshuaclayton Move callback_names onto FactoryGirl module
joshuaclayton authored
82
83 def self.callback_names
24d417d @joshuaclayton Add a before_create callback
joshuaclayton authored
84 [:after_build, :after_create, :after_stub, :before_create].freeze
09e1cea @joshuaclayton Move callback_names onto FactoryGirl module
joshuaclayton authored
85 end
c59981d @jferris Split factories/sequences into separate registries most of the time;
jferris authored
86 end
Something went wrong with that request. Please try again.