factory_girl 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/GETTING_STARTED.md +77 -52
- data/Gemfile.lock +10 -10
- data/{Changelog → NEWS} +7 -0
- data/README.md +7 -0
- data/factory_girl.gemspec +2 -2
- data/features/factory_girl_steps.feature +4 -0
- data/features/step_definitions/factory_girl_steps.rb +3 -3
- data/features/support/factories.rb +20 -0
- data/gemfiles/3.0.gemfile.lock +51 -48
- data/gemfiles/3.1.gemfile.lock +45 -51
- data/gemfiles/3.2.gemfile.lock +38 -42
- data/lib/factory_girl.rb +1 -1
- data/lib/factory_girl/definition_proxy.rb +2 -2
- data/lib/factory_girl/evaluator.rb +1 -2
- data/lib/factory_girl/sequence.rb +8 -5
- data/lib/factory_girl/step_definitions.rb +18 -10
- data/lib/factory_girl/strategy.rb +1 -0
- data/lib/factory_girl/strategy/attributes_for.rb +1 -0
- data/lib/factory_girl/strategy/create.rb +1 -0
- data/lib/factory_girl/strategy/null.rb +11 -0
- data/lib/factory_girl/syntax/default.rb +2 -2
- data/lib/factory_girl/syntax/vintage.rb +11 -9
- data/lib/factory_girl/version.rb +1 -1
- data/spec/acceptance/sequence_spec.rb +28 -0
- data/spec/acceptance/syntax/vintage_spec.rb +2 -0
- data/spec/factory_girl/definition_proxy_spec.rb +1 -1
- data/spec/factory_girl/registry_spec.rb +27 -6
- data/spec/factory_girl/sequence_spec.rb +20 -0
- data/spec/factory_girl/strategy/create_spec.rb +1 -1
- data/spec/support/shared_examples/strategy.rb +7 -6
- metadata +31 -30
@@ -12,7 +12,7 @@ When /^"([^"]*)" is added to Factory Girl's file definitions path$/ do |file_nam
|
|
12
12
|
|
13
13
|
append_file_to_factory_girl_definitions_path(new_factory_file)
|
14
14
|
|
15
|
-
|
15
|
+
step %{I find definitions}
|
16
16
|
end
|
17
17
|
|
18
18
|
When /^"([^"]*)" is added to Factory Girl's file definitions path as an absolute path$/ do |file_name|
|
@@ -20,7 +20,7 @@ When /^"([^"]*)" is added to Factory Girl's file definitions path as an absolute
|
|
20
20
|
|
21
21
|
append_file_to_factory_girl_definitions_path(new_factory_file)
|
22
22
|
|
23
|
-
|
23
|
+
step %{I find definitions}
|
24
24
|
end
|
25
25
|
|
26
26
|
When /^I create a "([^"]*)" instance from Factory Girl$/ do |factory_name|
|
@@ -31,7 +31,7 @@ Given /^these super users exist:$/ do |table|
|
|
31
31
|
headers = table.headers + ["admin"]
|
32
32
|
rows = table.rows.map { |row| row + [true] }
|
33
33
|
new_table = Cucumber::Ast::Table.new([headers] + rows)
|
34
|
-
|
34
|
+
step %{the following person exists:}, new_table
|
35
35
|
end
|
36
36
|
|
37
37
|
When /^I find definitions$/ do
|
@@ -73,6 +73,23 @@ class SimpleColumn
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
class NamedAttributeModel
|
77
|
+
def self.attribute_names
|
78
|
+
%w(title)
|
79
|
+
end
|
80
|
+
|
81
|
+
attr_accessor :title
|
82
|
+
|
83
|
+
def save!
|
84
|
+
@@count ||= 0
|
85
|
+
@@count += 1
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.count
|
89
|
+
@@count
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
76
93
|
FactoryGirl.define do
|
77
94
|
# To make sure the step defs work with an email
|
78
95
|
sequence :email do |n|
|
@@ -113,6 +130,9 @@ FactoryGirl.define do
|
|
113
130
|
# This is here to make FG work with ORMs that have `columns => [:name, :admin, :etc]` on the class (Neo4j)
|
114
131
|
factory :simple_column do
|
115
132
|
end
|
133
|
+
|
134
|
+
factory :named_attribute_model do
|
135
|
+
end
|
116
136
|
end
|
117
137
|
|
118
138
|
require 'factory_girl/step_definitions'
|
data/gemfiles/3.0.gemfile.lock
CHANGED
@@ -1,82 +1,85 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /Users/joshuaclayton/dev/gems/factory_girl
|
3
3
|
specs:
|
4
|
-
factory_girl (3.
|
4
|
+
factory_girl (3.1.0)
|
5
5
|
activesupport (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (3.
|
11
|
-
activesupport (= 3.
|
12
|
-
builder (~>
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
activemodel (3.2.3)
|
11
|
+
activesupport (= 3.2.3)
|
12
|
+
builder (~> 3.0.0)
|
13
|
+
activerecord (3.2.3)
|
14
|
+
activemodel (= 3.2.3)
|
15
|
+
activesupport (= 3.2.3)
|
16
|
+
arel (~> 3.0.2)
|
17
|
+
tzinfo (~> 0.3.29)
|
18
|
+
activesupport (3.2.3)
|
19
|
+
i18n (~> 0.6)
|
20
|
+
multi_json (~> 1.0)
|
21
|
+
appraisal (0.4.1)
|
21
22
|
bundler
|
22
23
|
rake
|
23
|
-
arel (
|
24
|
-
aruba (0.
|
25
|
-
childprocess (>= 0.
|
26
|
-
cucumber (>=
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
24
|
+
arel (3.0.2)
|
25
|
+
aruba (0.4.11)
|
26
|
+
childprocess (>= 0.2.3)
|
27
|
+
cucumber (>= 1.1.1)
|
28
|
+
ffi (>= 1.0.11)
|
29
|
+
rspec (>= 2.7.0)
|
30
|
+
bluecloth (2.2.0)
|
31
|
+
bourne (1.1.2)
|
32
|
+
mocha (= 0.10.5)
|
33
|
+
builder (3.0.0)
|
34
|
+
childprocess (0.3.1)
|
33
35
|
ffi (~> 1.0.6)
|
34
|
-
cucumber (1.
|
36
|
+
cucumber (1.1.9)
|
35
37
|
builder (>= 2.1.2)
|
36
38
|
diff-lcs (>= 1.1.2)
|
37
|
-
gherkin (~> 2.
|
39
|
+
gherkin (~> 2.9.0)
|
38
40
|
json (>= 1.4.6)
|
39
|
-
term-ansicolor (>= 1.0.
|
40
|
-
diff-lcs (1.1.
|
41
|
-
ffi (1.0.
|
42
|
-
gherkin (2.
|
41
|
+
term-ansicolor (>= 1.0.6)
|
42
|
+
diff-lcs (1.1.3)
|
43
|
+
ffi (1.0.11)
|
44
|
+
gherkin (2.9.3)
|
43
45
|
json (>= 1.4.6)
|
44
|
-
i18n (0.
|
45
|
-
json (1.
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
rspec-
|
53
|
-
rspec-
|
54
|
-
|
55
|
-
rspec-
|
56
|
-
|
57
|
-
|
46
|
+
i18n (0.6.0)
|
47
|
+
json (1.6.6)
|
48
|
+
metaclass (0.0.1)
|
49
|
+
mocha (0.10.5)
|
50
|
+
metaclass (~> 0.0.1)
|
51
|
+
multi_json (1.2.0)
|
52
|
+
rake (0.9.2.2)
|
53
|
+
rspec (2.9.0)
|
54
|
+
rspec-core (~> 2.9.0)
|
55
|
+
rspec-expectations (~> 2.9.0)
|
56
|
+
rspec-mocks (~> 2.9.0)
|
57
|
+
rspec-core (2.9.0)
|
58
|
+
rspec-expectations (2.9.1)
|
59
|
+
diff-lcs (~> 1.1.3)
|
60
|
+
rspec-mocks (2.9.0)
|
58
61
|
simplecov (0.6.1)
|
59
62
|
multi_json (~> 1.0)
|
60
63
|
simplecov-html (~> 0.5.3)
|
61
64
|
simplecov-html (0.5.3)
|
62
|
-
sqlite3 (1.3.
|
65
|
+
sqlite3 (1.3.5)
|
63
66
|
sqlite3-ruby (1.3.3)
|
64
67
|
sqlite3 (>= 1.3.3)
|
65
|
-
term-ansicolor (1.0.
|
68
|
+
term-ansicolor (1.0.7)
|
66
69
|
timecop (0.3.5)
|
67
|
-
tzinfo (0.3.
|
68
|
-
yard (0.7.
|
70
|
+
tzinfo (0.3.32)
|
71
|
+
yard (0.7.5)
|
69
72
|
|
70
73
|
PLATFORMS
|
71
74
|
ruby
|
72
75
|
|
73
76
|
DEPENDENCIES
|
74
77
|
activerecord (~> 3.0)
|
75
|
-
appraisal (~> 0.
|
78
|
+
appraisal (~> 0.4)
|
76
79
|
aruba
|
77
80
|
bluecloth
|
78
81
|
bourne
|
79
|
-
cucumber (~> 1.
|
82
|
+
cucumber (~> 1.1)
|
80
83
|
factory_girl!
|
81
84
|
mocha
|
82
85
|
rspec (~> 2.0)
|
data/gemfiles/3.1.gemfile.lock
CHANGED
@@ -1,91 +1,85 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /Users/joshuaclayton/dev/gems/factory_girl
|
3
3
|
specs:
|
4
|
-
factory_girl (3.
|
4
|
+
factory_girl (3.1.0)
|
5
5
|
activesupport (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (3.
|
11
|
-
activesupport (= 3.
|
12
|
-
bcrypt-ruby (~> 3.0.0)
|
10
|
+
activemodel (3.2.3)
|
11
|
+
activesupport (= 3.2.3)
|
13
12
|
builder (~> 3.0.0)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
arel (~> 2.2.1)
|
13
|
+
activerecord (3.2.3)
|
14
|
+
activemodel (= 3.2.3)
|
15
|
+
activesupport (= 3.2.3)
|
16
|
+
arel (~> 3.0.2)
|
19
17
|
tzinfo (~> 0.3.29)
|
20
|
-
activesupport (3.
|
18
|
+
activesupport (3.2.3)
|
19
|
+
i18n (~> 0.6)
|
21
20
|
multi_json (~> 1.0)
|
22
|
-
appraisal (0.
|
21
|
+
appraisal (0.4.1)
|
23
22
|
bundler
|
24
23
|
rake
|
25
|
-
arel (
|
26
|
-
aruba (0.4.
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
bcrypt-ruby (3.0.0)
|
35
|
-
bluecloth (2.1.0)
|
36
|
-
bourne (1.0)
|
37
|
-
mocha (= 0.9.8)
|
24
|
+
arel (3.0.2)
|
25
|
+
aruba (0.4.11)
|
26
|
+
childprocess (>= 0.2.3)
|
27
|
+
cucumber (>= 1.1.1)
|
28
|
+
ffi (>= 1.0.11)
|
29
|
+
rspec (>= 2.7.0)
|
30
|
+
bluecloth (2.2.0)
|
31
|
+
bourne (1.1.2)
|
32
|
+
mocha (= 0.10.5)
|
38
33
|
builder (3.0.0)
|
39
|
-
childprocess (0.
|
34
|
+
childprocess (0.3.1)
|
40
35
|
ffi (~> 1.0.6)
|
41
|
-
cucumber (1.
|
36
|
+
cucumber (1.1.9)
|
42
37
|
builder (>= 2.1.2)
|
43
38
|
diff-lcs (>= 1.1.2)
|
44
|
-
gherkin (~> 2.
|
39
|
+
gherkin (~> 2.9.0)
|
45
40
|
json (>= 1.4.6)
|
46
|
-
term-ansicolor (>= 1.0.
|
41
|
+
term-ansicolor (>= 1.0.6)
|
47
42
|
diff-lcs (1.1.3)
|
48
|
-
ffi (1.0.
|
49
|
-
gherkin (2.
|
43
|
+
ffi (1.0.11)
|
44
|
+
gherkin (2.9.3)
|
50
45
|
json (>= 1.4.6)
|
51
46
|
i18n (0.6.0)
|
52
|
-
json (1.
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
rake (0.9.2)
|
58
|
-
|
59
|
-
|
60
|
-
rspec-
|
61
|
-
rspec-
|
62
|
-
|
63
|
-
rspec-
|
64
|
-
|
65
|
-
|
66
|
-
rspec-mocks (2.6.0)
|
47
|
+
json (1.6.6)
|
48
|
+
metaclass (0.0.1)
|
49
|
+
mocha (0.10.5)
|
50
|
+
metaclass (~> 0.0.1)
|
51
|
+
multi_json (1.2.0)
|
52
|
+
rake (0.9.2.2)
|
53
|
+
rspec (2.9.0)
|
54
|
+
rspec-core (~> 2.9.0)
|
55
|
+
rspec-expectations (~> 2.9.0)
|
56
|
+
rspec-mocks (~> 2.9.0)
|
57
|
+
rspec-core (2.9.0)
|
58
|
+
rspec-expectations (2.9.1)
|
59
|
+
diff-lcs (~> 1.1.3)
|
60
|
+
rspec-mocks (2.9.0)
|
67
61
|
simplecov (0.6.1)
|
68
62
|
multi_json (~> 1.0)
|
69
63
|
simplecov-html (~> 0.5.3)
|
70
64
|
simplecov-html (0.5.3)
|
71
|
-
sqlite3 (1.3.
|
65
|
+
sqlite3 (1.3.5)
|
72
66
|
sqlite3-ruby (1.3.3)
|
73
67
|
sqlite3 (>= 1.3.3)
|
74
|
-
term-ansicolor (1.0.
|
68
|
+
term-ansicolor (1.0.7)
|
75
69
|
timecop (0.3.5)
|
76
|
-
tzinfo (0.3.
|
77
|
-
yard (0.7.
|
70
|
+
tzinfo (0.3.32)
|
71
|
+
yard (0.7.5)
|
78
72
|
|
79
73
|
PLATFORMS
|
80
74
|
ruby
|
81
75
|
|
82
76
|
DEPENDENCIES
|
83
77
|
activerecord (~> 3.1)
|
84
|
-
appraisal (~> 0.
|
78
|
+
appraisal (~> 0.4)
|
85
79
|
aruba
|
86
80
|
bluecloth
|
87
81
|
bourne
|
88
|
-
cucumber (~> 1.
|
82
|
+
cucumber (~> 1.1)
|
89
83
|
factory_girl!
|
90
84
|
mocha
|
91
85
|
rspec (~> 2.0)
|
data/gemfiles/3.2.gemfile.lock
CHANGED
@@ -1,67 +1,63 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /Users/joshuaclayton/dev/gems/factory_girl
|
3
3
|
specs:
|
4
|
-
factory_girl (3.
|
4
|
+
factory_girl (3.1.0)
|
5
5
|
activesupport (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (3.2.
|
11
|
-
activesupport (= 3.2.
|
10
|
+
activemodel (3.2.3)
|
11
|
+
activesupport (= 3.2.3)
|
12
12
|
builder (~> 3.0.0)
|
13
|
-
activerecord (3.2.
|
14
|
-
activemodel (= 3.2.
|
15
|
-
activesupport (= 3.2.
|
16
|
-
arel (~> 3.0.
|
13
|
+
activerecord (3.2.3)
|
14
|
+
activemodel (= 3.2.3)
|
15
|
+
activesupport (= 3.2.3)
|
16
|
+
arel (~> 3.0.2)
|
17
17
|
tzinfo (~> 0.3.29)
|
18
|
-
activesupport (3.2.
|
18
|
+
activesupport (3.2.3)
|
19
19
|
i18n (~> 0.6)
|
20
20
|
multi_json (~> 1.0)
|
21
|
-
appraisal (0.
|
21
|
+
appraisal (0.4.1)
|
22
22
|
bundler
|
23
23
|
rake
|
24
|
-
arel (3.0.
|
25
|
-
aruba (0.4.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
rspec (>= 2.6.0)
|
31
|
-
bcat (0.6.2)
|
32
|
-
rack (~> 1.0)
|
24
|
+
arel (3.0.2)
|
25
|
+
aruba (0.4.11)
|
26
|
+
childprocess (>= 0.2.3)
|
27
|
+
cucumber (>= 1.1.1)
|
28
|
+
ffi (>= 1.0.11)
|
29
|
+
rspec (>= 2.7.0)
|
33
30
|
bluecloth (2.2.0)
|
34
|
-
bourne (1.
|
35
|
-
mocha (= 0.
|
31
|
+
bourne (1.1.2)
|
32
|
+
mocha (= 0.10.5)
|
36
33
|
builder (3.0.0)
|
37
|
-
childprocess (0.3.
|
34
|
+
childprocess (0.3.1)
|
38
35
|
ffi (~> 1.0.6)
|
39
|
-
cucumber (1.
|
36
|
+
cucumber (1.1.9)
|
40
37
|
builder (>= 2.1.2)
|
41
38
|
diff-lcs (>= 1.1.2)
|
42
|
-
gherkin (~> 2.
|
39
|
+
gherkin (~> 2.9.0)
|
43
40
|
json (>= 1.4.6)
|
44
41
|
term-ansicolor (>= 1.0.6)
|
45
42
|
diff-lcs (1.1.3)
|
46
43
|
ffi (1.0.11)
|
47
|
-
gherkin (2.
|
44
|
+
gherkin (2.9.3)
|
48
45
|
json (>= 1.4.6)
|
49
46
|
i18n (0.6.0)
|
50
|
-
json (1.6.
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
json (1.6.6)
|
48
|
+
metaclass (0.0.1)
|
49
|
+
mocha (0.10.5)
|
50
|
+
metaclass (~> 0.0.1)
|
51
|
+
multi_json (1.2.0)
|
55
52
|
rake (0.9.2.2)
|
56
|
-
|
57
|
-
|
58
|
-
rspec-
|
59
|
-
rspec-
|
60
|
-
|
61
|
-
rspec-
|
62
|
-
|
63
|
-
|
64
|
-
rspec-mocks (2.8.0)
|
53
|
+
rspec (2.9.0)
|
54
|
+
rspec-core (~> 2.9.0)
|
55
|
+
rspec-expectations (~> 2.9.0)
|
56
|
+
rspec-mocks (~> 2.9.0)
|
57
|
+
rspec-core (2.9.0)
|
58
|
+
rspec-expectations (2.9.1)
|
59
|
+
diff-lcs (~> 1.1.3)
|
60
|
+
rspec-mocks (2.9.0)
|
65
61
|
simplecov (0.6.1)
|
66
62
|
multi_json (~> 1.0)
|
67
63
|
simplecov-html (~> 0.5.3)
|
@@ -71,19 +67,19 @@ GEM
|
|
71
67
|
sqlite3 (>= 1.3.3)
|
72
68
|
term-ansicolor (1.0.7)
|
73
69
|
timecop (0.3.5)
|
74
|
-
tzinfo (0.3.
|
75
|
-
yard (0.7.
|
70
|
+
tzinfo (0.3.32)
|
71
|
+
yard (0.7.5)
|
76
72
|
|
77
73
|
PLATFORMS
|
78
74
|
ruby
|
79
75
|
|
80
76
|
DEPENDENCIES
|
81
77
|
activerecord (~> 3.2)
|
82
|
-
appraisal (~> 0.
|
78
|
+
appraisal (~> 0.4)
|
83
79
|
aruba
|
84
80
|
bluecloth
|
85
81
|
bourne
|
86
|
-
cucumber (~> 1.
|
82
|
+
cucumber (~> 1.1)
|
87
83
|
factory_girl!
|
88
84
|
mocha
|
89
85
|
rspec (~> 2.0)
|