freegenie-factory_girl 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
data/lib/factory_girl.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'active_support'
|
2
2
|
require 'factory_girl/proxy'
|
3
3
|
require 'factory_girl/proxy/build'
|
4
|
+
require 'factory_girl/proxy/find_or_create'
|
4
5
|
require 'factory_girl/proxy/create'
|
5
6
|
require 'factory_girl/proxy/attributes_for'
|
6
7
|
require 'factory_girl/proxy/stub'
|
7
|
-
|
8
|
+
|
8
9
|
require 'factory_girl/factory'
|
9
10
|
require 'factory_girl/attribute'
|
10
11
|
require 'factory_girl/attribute/static'
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module ActiveRecordHooks
|
2
|
+
|
3
|
+
def self.included(base)
|
4
|
+
base.class_eval do
|
5
|
+
extend ClassMethods
|
6
|
+
include InstanceMethods
|
7
|
+
after_create :after_create_hook
|
8
|
+
after_destroy :after_destroy_hook
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
end
|
14
|
+
|
15
|
+
module InstanceMethods
|
16
|
+
def after_create_hook
|
17
|
+
# puts "after_create_hook: self.attributes"
|
18
|
+
# puts Factory.live_registry
|
19
|
+
end
|
20
|
+
|
21
|
+
def after_destroy_hook
|
22
|
+
# put "after_destroy_hook"
|
23
|
+
Factory.delete_from_live_registry(self.class.name, self.id)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
ActiveRecord::Base.class_eval do
|
31
|
+
include ActiveRecordHooks
|
32
|
+
end
|
data/lib/factory_girl/factory.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freegenie-factory_girl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Ferris
|
@@ -39,6 +39,8 @@ files:
|
|
39
39
|
- lib/factory_girl/proxy/attributes_for.rb
|
40
40
|
- lib/factory_girl/proxy/build.rb
|
41
41
|
- lib/factory_girl/proxy/create.rb
|
42
|
+
- lib/factory_girl/proxy/find_or_create.rb
|
43
|
+
- lib/factory_girl/activerecord.rb
|
42
44
|
- lib/factory_girl/proxy/stub.rb
|
43
45
|
- lib/factory_girl/proxy.rb
|
44
46
|
- lib/factory_girl/sequence.rb
|