factory_girl 4.2.0 → 4.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +29 -7
  3. data/.yardopts +1 -1
  4. data/Appraisals +12 -8
  5. data/CONTRIBUTING.md +60 -0
  6. data/GETTING_STARTED.md +473 -191
  7. data/Gemfile +6 -3
  8. data/Gemfile.lock +93 -65
  9. data/LICENSE +1 -1
  10. data/NAME.md +11 -0
  11. data/NEWS +43 -1
  12. data/README.md +52 -28
  13. data/Rakefile +1 -3
  14. data/factory_girl.gemspec +9 -17
  15. data/gemfiles/3.2.gemfile +6 -3
  16. data/gemfiles/3.2.gemfile.lock +85 -62
  17. data/gemfiles/4.0.gemfile +6 -3
  18. data/gemfiles/4.0.gemfile.lock +84 -74
  19. data/gemfiles/4.1.gemfile +10 -0
  20. data/gemfiles/4.1.gemfile.lock +104 -0
  21. data/gemfiles/4.2.gemfile +10 -0
  22. data/gemfiles/4.2.gemfile.lock +104 -0
  23. data/gemfiles/5.0.gemfile +10 -0
  24. data/gemfiles/5.0.gemfile.lock +103 -0
  25. data/lib/factory_girl/attribute/dynamic.rb +4 -1
  26. data/lib/factory_girl/attribute_assigner.rb +4 -4
  27. data/lib/factory_girl/attribute_list.rb +1 -1
  28. data/lib/factory_girl/callback.rb +1 -1
  29. data/lib/factory_girl/callbacks_observer.rb +1 -1
  30. data/lib/factory_girl/configuration.rb +7 -2
  31. data/lib/factory_girl/declaration_list.rb +2 -2
  32. data/lib/factory_girl/decorator/attribute_hash.rb +1 -2
  33. data/lib/factory_girl/decorator/class_key_hash.rb +2 -1
  34. data/lib/factory_girl/decorator.rb +2 -2
  35. data/lib/factory_girl/definition.rb +25 -15
  36. data/lib/factory_girl/definition_hierarchy.rb +1 -1
  37. data/lib/factory_girl/definition_proxy.rb +15 -17
  38. data/lib/factory_girl/errors.rb +6 -0
  39. data/lib/factory_girl/evaluator.rb +7 -1
  40. data/lib/factory_girl/factory.rb +3 -3
  41. data/lib/factory_girl/factory_runner.rb +7 -1
  42. data/lib/factory_girl/find_definitions.rb +3 -3
  43. data/lib/factory_girl/linter.rb +97 -0
  44. data/lib/factory_girl/strategy/stub.rb +58 -20
  45. data/lib/factory_girl/strategy_syntax_method_registrar.rb +17 -0
  46. data/lib/factory_girl/syntax/default.rb +8 -0
  47. data/lib/factory_girl/syntax/methods.rb +18 -2
  48. data/lib/factory_girl/version.rb +1 -1
  49. data/lib/factory_girl.rb +30 -3
  50. metadata +65 -249
  51. data/CONTRIBUTION_GUIDELINES.md +0 -10
  52. data/features/find_definitions.feature +0 -75
  53. data/features/step_definitions/database_steps.rb +0 -9
  54. data/features/step_definitions/factory_girl_steps.rb +0 -36
  55. data/features/support/env.rb +0 -10
  56. data/features/support/factories.rb +0 -16
  57. data/gemfiles/3.0.gemfile +0 -7
  58. data/gemfiles/3.0.gemfile.lock +0 -81
  59. data/gemfiles/3.1.gemfile +0 -7
  60. data/gemfiles/3.1.gemfile.lock +0 -82
  61. data/spec/acceptance/activesupport_instrumentation_spec.rb +0 -62
  62. data/spec/acceptance/aliases_spec.rb +0 -19
  63. data/spec/acceptance/attribute_aliases_spec.rb +0 -45
  64. data/spec/acceptance/attribute_existing_on_object_spec.rb +0 -68
  65. data/spec/acceptance/attributes_for_spec.rb +0 -97
  66. data/spec/acceptance/attributes_from_instance_spec.rb +0 -53
  67. data/spec/acceptance/attributes_ordered_spec.rb +0 -51
  68. data/spec/acceptance/build_list_spec.rb +0 -56
  69. data/spec/acceptance/build_spec.rb +0 -86
  70. data/spec/acceptance/build_stubbed_spec.rb +0 -161
  71. data/spec/acceptance/callbacks_spec.rb +0 -177
  72. data/spec/acceptance/create_list_spec.rb +0 -97
  73. data/spec/acceptance/create_spec.rb +0 -116
  74. data/spec/acceptance/define_child_before_parent_spec.rb +0 -21
  75. data/spec/acceptance/definition_spec.rb +0 -21
  76. data/spec/acceptance/definition_without_block_spec.rb +0 -15
  77. data/spec/acceptance/global_initialize_with_spec.rb +0 -82
  78. data/spec/acceptance/global_to_create_spec.rb +0 -122
  79. data/spec/acceptance/initialize_with_spec.rb +0 -217
  80. data/spec/acceptance/keyed_by_class_spec.rb +0 -22
  81. data/spec/acceptance/modify_factories_spec.rb +0 -184
  82. data/spec/acceptance/modify_inherited_spec.rb +0 -52
  83. data/spec/acceptance/nested_attributes_spec.rb +0 -32
  84. data/spec/acceptance/overrides_spec.rb +0 -61
  85. data/spec/acceptance/parent_spec.rb +0 -90
  86. data/spec/acceptance/register_strategies_spec.rb +0 -128
  87. data/spec/acceptance/sequence_context_spec.rb +0 -52
  88. data/spec/acceptance/sequence_spec.rb +0 -61
  89. data/spec/acceptance/skip_create_spec.rb +0 -19
  90. data/spec/acceptance/stub_spec.rb +0 -62
  91. data/spec/acceptance/syntax_methods_within_dynamic_attributes_spec.rb +0 -41
  92. data/spec/acceptance/traits_spec.rb +0 -727
  93. data/spec/acceptance/transient_attributes_spec.rb +0 -124
  94. data/spec/factory_girl/aliases_spec.rb +0 -31
  95. data/spec/factory_girl/attribute/association_spec.rb +0 -28
  96. data/spec/factory_girl/attribute/dynamic_spec.rb +0 -52
  97. data/spec/factory_girl/attribute/sequence_spec.rb +0 -16
  98. data/spec/factory_girl/attribute/static_spec.rb +0 -19
  99. data/spec/factory_girl/attribute_list_spec.rb +0 -143
  100. data/spec/factory_girl/attribute_spec.rb +0 -16
  101. data/spec/factory_girl/callback_spec.rb +0 -41
  102. data/spec/factory_girl/declaration/implicit_spec.rb +0 -25
  103. data/spec/factory_girl/declaration_list_spec.rb +0 -67
  104. data/spec/factory_girl/definition_proxy_spec.rb +0 -215
  105. data/spec/factory_girl/definition_spec.rb +0 -58
  106. data/spec/factory_girl/disallows_duplicates_registry_spec.rb +0 -19
  107. data/spec/factory_girl/evaluator_class_definer_spec.rb +0 -77
  108. data/spec/factory_girl/factory_spec.rb +0 -259
  109. data/spec/factory_girl/find_definitions_spec.rb +0 -110
  110. data/spec/factory_girl/null_factory_spec.rb +0 -13
  111. data/spec/factory_girl/null_object_spec.rb +0 -22
  112. data/spec/factory_girl/registry_spec.rb +0 -68
  113. data/spec/factory_girl/sequence_spec.rb +0 -95
  114. data/spec/factory_girl/strategy/attributes_for_spec.rb +0 -18
  115. data/spec/factory_girl/strategy/build_spec.rb +0 -7
  116. data/spec/factory_girl/strategy/create_spec.rb +0 -25
  117. data/spec/factory_girl/strategy/stub_spec.rb +0 -38
  118. data/spec/factory_girl/strategy_calculator_spec.rb +0 -29
  119. data/spec/factory_girl_spec.rb +0 -22
  120. data/spec/spec_helper.rb +0 -26
  121. data/spec/support/macros/define_constant.rb +0 -86
  122. data/spec/support/matchers/callback.rb +0 -9
  123. data/spec/support/matchers/declaration.rb +0 -83
  124. data/spec/support/matchers/delegate.rb +0 -44
  125. data/spec/support/matchers/trait.rb +0 -9
  126. data/spec/support/shared_examples/strategy.rb +0 -90
@@ -1,95 +1,105 @@
1
- GIT
2
- remote: git://github.com/rails/rails.git
3
- revision: 40e797827935756aacf0463e4b44e1c1c92b0aeb
4
- specs:
5
- activemodel (4.0.0.beta)
6
- activesupport (= 4.0.0.beta)
7
- builder (~> 3.1.0)
8
- activerecord (4.0.0.beta)
9
- activemodel (= 4.0.0.beta)
10
- activerecord-deprecated_finders (= 0.0.2)
11
- activesupport (= 4.0.0.beta)
12
- arel (~> 3.0.2)
13
- activesupport (4.0.0.beta)
14
- i18n (~> 0.6)
15
- minitest (~> 4.1)
16
- multi_json (~> 1.3)
17
- thread_safe (~> 0.1)
18
- tzinfo (~> 0.3.33)
19
-
20
1
  PATH
21
- remote: /Users/joshuaclayton/dev/gems/factory_girl
2
+ remote: ../
22
3
  specs:
23
- factory_girl (4.2.0)
4
+ factory_girl (4.8.1)
24
5
  activesupport (>= 3.0.0)
25
6
 
26
7
  GEM
27
- remote: http://rubygems.org/
8
+ remote: https://rubygems.org/
28
9
  specs:
29
- activerecord-deprecated_finders (0.0.2)
30
- appraisal (0.5.1)
10
+ activemodel (4.0.13)
11
+ activesupport (= 4.0.13)
12
+ builder (~> 3.1.0)
13
+ activerecord (4.0.13)
14
+ activemodel (= 4.0.13)
15
+ activerecord-deprecated_finders (~> 1.0.2)
16
+ activesupport (= 4.0.13)
17
+ arel (~> 4.0.0)
18
+ activerecord-deprecated_finders (1.0.4)
19
+ activesupport (4.0.13)
20
+ i18n (~> 0.6, >= 0.6.9)
21
+ minitest (~> 4.2)
22
+ multi_json (~> 1.3)
23
+ thread_safe (~> 0.1)
24
+ tzinfo (~> 0.3.37)
25
+ appraisal (2.1.0)
31
26
  bundler
32
27
  rake
33
- arel (3.0.2)
34
- aruba (0.5.1)
35
- childprocess (~> 0.3.6)
36
- cucumber (>= 1.1.1)
37
- rspec-expectations (>= 2.7.0)
38
- atomic (1.0.1)
39
- bourne (1.3.0)
40
- mocha (= 0.13.0)
28
+ thor (>= 0.14.0)
29
+ arel (4.0.2)
30
+ aruba (0.14.2)
31
+ childprocess (~> 0.5.6)
32
+ contracts (~> 0.9)
33
+ cucumber (>= 1.3.19)
34
+ ffi (~> 1.9.10)
35
+ rspec-expectations (>= 2.99)
36
+ thor (~> 0.19)
41
37
  builder (3.1.4)
42
- childprocess (0.3.6)
43
- ffi (~> 1.0, >= 1.0.6)
44
- cucumber (1.2.1)
38
+ childprocess (0.5.9)
39
+ ffi (~> 1.0, >= 1.0.11)
40
+ contracts (0.16.0)
41
+ cucumber (1.3.20)
45
42
  builder (>= 2.1.2)
46
43
  diff-lcs (>= 1.1.3)
47
- gherkin (~> 2.11.0)
48
- json (>= 1.4.6)
49
- diff-lcs (1.1.3)
50
- ffi (1.3.1)
51
- gherkin (2.11.5)
52
- json (>= 1.4.6)
53
- i18n (0.6.1)
54
- json (1.7.6)
55
- metaclass (0.0.1)
56
- minitest (4.4.0)
57
- mocha (0.13.0)
58
- metaclass (~> 0.0.1)
59
- multi_json (1.5.0)
60
- rake (10.0.3)
61
- rspec (2.12.0)
62
- rspec-core (~> 2.12.0)
63
- rspec-expectations (~> 2.12.0)
64
- rspec-mocks (~> 2.12.0)
65
- rspec-core (2.12.2)
66
- rspec-expectations (2.12.1)
67
- diff-lcs (~> 1.1.3)
68
- rspec-mocks (2.12.1)
69
- simplecov (0.7.1)
70
- multi_json (~> 1.0)
71
- simplecov-html (~> 0.7.1)
72
- simplecov-html (0.7.1)
73
- sqlite3 (1.3.7)
74
- thread_safe (0.1.0)
75
- atomic
76
- timecop (0.5.9)
77
- tzinfo (0.3.35)
78
- yard (0.8.3)
44
+ gherkin (~> 2.12)
45
+ multi_json (>= 1.7.5, < 2.0)
46
+ multi_test (>= 0.1.2)
47
+ diff-lcs (1.3)
48
+ docile (1.1.5)
49
+ ffi (1.9.18)
50
+ gherkin (2.12.2)
51
+ multi_json (~> 1.3)
52
+ i18n (0.8.6)
53
+ json (2.1.0)
54
+ minitest (4.7.5)
55
+ multi_json (1.12.2)
56
+ multi_test (0.1.2)
57
+ rake (12.1.0)
58
+ rspec (3.6.0)
59
+ rspec-core (~> 3.6.0)
60
+ rspec-expectations (~> 3.6.0)
61
+ rspec-mocks (~> 3.6.0)
62
+ rspec-core (3.6.0)
63
+ rspec-support (~> 3.6.0)
64
+ rspec-expectations (3.6.0)
65
+ diff-lcs (>= 1.2.0, < 2.0)
66
+ rspec-support (~> 3.6.0)
67
+ rspec-its (1.2.0)
68
+ rspec-core (>= 3.0.0)
69
+ rspec-expectations (>= 3.0.0)
70
+ rspec-mocks (3.6.0)
71
+ diff-lcs (>= 1.2.0, < 2.0)
72
+ rspec-support (~> 3.6.0)
73
+ rspec-support (3.6.0)
74
+ simplecov (0.15.1)
75
+ docile (~> 1.1.0)
76
+ json (>= 1.8, < 3)
77
+ simplecov-html (~> 0.10.0)
78
+ simplecov-html (0.10.2)
79
+ sqlite3 (1.3.13)
80
+ thor (0.20.0)
81
+ thread_safe (0.3.6)
82
+ timecop (0.9.1)
83
+ tzinfo (0.3.53)
84
+ yard (0.9.9)
79
85
 
80
86
  PLATFORMS
81
87
  ruby
82
88
 
83
89
  DEPENDENCIES
84
- activerecord!
85
- appraisal (~> 0.5.1)
90
+ activerecord (~> 4.0.13)
91
+ activerecord-jdbcsqlite3-adapter
92
+ appraisal (~> 2.1.0)
86
93
  aruba
87
- bourne
88
- cucumber (~> 1.2.1)
94
+ cucumber (~> 1.3.15)
89
95
  factory_girl!
90
- mocha (>= 0.12.8)
91
- rspec (~> 2.12.0)
96
+ jdbc-sqlite3
97
+ rspec (~> 3.0)
98
+ rspec-its (~> 1.0)
92
99
  simplecov
93
- sqlite3
100
+ sqlite3 (~> 1.3.10)
94
101
  timecop
95
102
  yard
103
+
104
+ BUNDLED WITH
105
+ 1.15.4
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
6
+ gem "jdbc-sqlite3", :platforms => :jruby
7
+ gem "sqlite3", "~> 1.3.10", :platforms => :ruby
8
+ gem "activerecord", "~> 4.1.14"
9
+
10
+ gemspec :path => "../"
@@ -0,0 +1,104 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ factory_girl (4.8.1)
5
+ activesupport (>= 3.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (4.1.16)
11
+ activesupport (= 4.1.16)
12
+ builder (~> 3.1)
13
+ activerecord (4.1.16)
14
+ activemodel (= 4.1.16)
15
+ activesupport (= 4.1.16)
16
+ arel (~> 5.0.0)
17
+ activesupport (4.1.16)
18
+ i18n (~> 0.6, >= 0.6.9)
19
+ json (~> 1.7, >= 1.7.7)
20
+ minitest (~> 5.1)
21
+ thread_safe (~> 0.1)
22
+ tzinfo (~> 1.1)
23
+ appraisal (2.1.0)
24
+ bundler
25
+ rake
26
+ thor (>= 0.14.0)
27
+ arel (5.0.1.20140414130214)
28
+ aruba (0.14.2)
29
+ childprocess (~> 0.5.6)
30
+ contracts (~> 0.9)
31
+ cucumber (>= 1.3.19)
32
+ ffi (~> 1.9.10)
33
+ rspec-expectations (>= 2.99)
34
+ thor (~> 0.19)
35
+ builder (3.2.3)
36
+ childprocess (0.5.9)
37
+ ffi (~> 1.0, >= 1.0.11)
38
+ contracts (0.16.0)
39
+ cucumber (1.3.20)
40
+ builder (>= 2.1.2)
41
+ diff-lcs (>= 1.1.3)
42
+ gherkin (~> 2.12)
43
+ multi_json (>= 1.7.5, < 2.0)
44
+ multi_test (>= 0.1.2)
45
+ diff-lcs (1.3)
46
+ docile (1.1.5)
47
+ ffi (1.9.18)
48
+ gherkin (2.12.2)
49
+ multi_json (~> 1.3)
50
+ i18n (0.8.6)
51
+ json (1.8.6)
52
+ minitest (5.10.3)
53
+ multi_json (1.12.2)
54
+ multi_test (0.1.2)
55
+ rake (12.1.0)
56
+ rspec (3.6.0)
57
+ rspec-core (~> 3.6.0)
58
+ rspec-expectations (~> 3.6.0)
59
+ rspec-mocks (~> 3.6.0)
60
+ rspec-core (3.6.0)
61
+ rspec-support (~> 3.6.0)
62
+ rspec-expectations (3.6.0)
63
+ diff-lcs (>= 1.2.0, < 2.0)
64
+ rspec-support (~> 3.6.0)
65
+ rspec-its (1.2.0)
66
+ rspec-core (>= 3.0.0)
67
+ rspec-expectations (>= 3.0.0)
68
+ rspec-mocks (3.6.0)
69
+ diff-lcs (>= 1.2.0, < 2.0)
70
+ rspec-support (~> 3.6.0)
71
+ rspec-support (3.6.0)
72
+ simplecov (0.15.1)
73
+ docile (~> 1.1.0)
74
+ json (>= 1.8, < 3)
75
+ simplecov-html (~> 0.10.0)
76
+ simplecov-html (0.10.2)
77
+ sqlite3 (1.3.13)
78
+ thor (0.20.0)
79
+ thread_safe (0.3.6)
80
+ timecop (0.9.1)
81
+ tzinfo (1.2.3)
82
+ thread_safe (~> 0.1)
83
+ yard (0.9.9)
84
+
85
+ PLATFORMS
86
+ ruby
87
+
88
+ DEPENDENCIES
89
+ activerecord (~> 4.1.14)
90
+ activerecord-jdbcsqlite3-adapter
91
+ appraisal (~> 2.1.0)
92
+ aruba
93
+ cucumber (~> 1.3.15)
94
+ factory_girl!
95
+ jdbc-sqlite3
96
+ rspec (~> 3.0)
97
+ rspec-its (~> 1.0)
98
+ simplecov
99
+ sqlite3 (~> 1.3.10)
100
+ timecop
101
+ yard
102
+
103
+ BUNDLED WITH
104
+ 1.15.4
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
6
+ gem "jdbc-sqlite3", :platforms => :jruby
7
+ gem "sqlite3", "~> 1.3.10", :platforms => :ruby
8
+ gem "activerecord", "~> 4.2.5.1"
9
+
10
+ gemspec :path => "../"
@@ -0,0 +1,104 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ factory_girl (4.8.1)
5
+ activesupport (>= 3.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (4.2.5.2)
11
+ activesupport (= 4.2.5.2)
12
+ builder (~> 3.1)
13
+ activerecord (4.2.5.2)
14
+ activemodel (= 4.2.5.2)
15
+ activesupport (= 4.2.5.2)
16
+ arel (~> 6.0)
17
+ activesupport (4.2.5.2)
18
+ i18n (~> 0.7)
19
+ json (~> 1.7, >= 1.7.7)
20
+ minitest (~> 5.1)
21
+ thread_safe (~> 0.3, >= 0.3.4)
22
+ tzinfo (~> 1.1)
23
+ appraisal (2.1.0)
24
+ bundler
25
+ rake
26
+ thor (>= 0.14.0)
27
+ arel (6.0.4)
28
+ aruba (0.14.2)
29
+ childprocess (~> 0.5.6)
30
+ contracts (~> 0.9)
31
+ cucumber (>= 1.3.19)
32
+ ffi (~> 1.9.10)
33
+ rspec-expectations (>= 2.99)
34
+ thor (~> 0.19)
35
+ builder (3.2.3)
36
+ childprocess (0.5.9)
37
+ ffi (~> 1.0, >= 1.0.11)
38
+ contracts (0.16.0)
39
+ cucumber (1.3.20)
40
+ builder (>= 2.1.2)
41
+ diff-lcs (>= 1.1.3)
42
+ gherkin (~> 2.12)
43
+ multi_json (>= 1.7.5, < 2.0)
44
+ multi_test (>= 0.1.2)
45
+ diff-lcs (1.3)
46
+ docile (1.1.5)
47
+ ffi (1.9.18)
48
+ gherkin (2.12.2)
49
+ multi_json (~> 1.3)
50
+ i18n (0.8.6)
51
+ json (1.8.6)
52
+ minitest (5.10.3)
53
+ multi_json (1.12.2)
54
+ multi_test (0.1.2)
55
+ rake (12.1.0)
56
+ rspec (3.6.0)
57
+ rspec-core (~> 3.6.0)
58
+ rspec-expectations (~> 3.6.0)
59
+ rspec-mocks (~> 3.6.0)
60
+ rspec-core (3.6.0)
61
+ rspec-support (~> 3.6.0)
62
+ rspec-expectations (3.6.0)
63
+ diff-lcs (>= 1.2.0, < 2.0)
64
+ rspec-support (~> 3.6.0)
65
+ rspec-its (1.2.0)
66
+ rspec-core (>= 3.0.0)
67
+ rspec-expectations (>= 3.0.0)
68
+ rspec-mocks (3.6.0)
69
+ diff-lcs (>= 1.2.0, < 2.0)
70
+ rspec-support (~> 3.6.0)
71
+ rspec-support (3.6.0)
72
+ simplecov (0.15.1)
73
+ docile (~> 1.1.0)
74
+ json (>= 1.8, < 3)
75
+ simplecov-html (~> 0.10.0)
76
+ simplecov-html (0.10.2)
77
+ sqlite3 (1.3.13)
78
+ thor (0.20.0)
79
+ thread_safe (0.3.6)
80
+ timecop (0.9.1)
81
+ tzinfo (1.2.3)
82
+ thread_safe (~> 0.1)
83
+ yard (0.9.9)
84
+
85
+ PLATFORMS
86
+ ruby
87
+
88
+ DEPENDENCIES
89
+ activerecord (~> 4.2.5.1)
90
+ activerecord-jdbcsqlite3-adapter
91
+ appraisal (~> 2.1.0)
92
+ aruba
93
+ cucumber (~> 1.3.15)
94
+ factory_girl!
95
+ jdbc-sqlite3
96
+ rspec (~> 3.0)
97
+ rspec-its (~> 1.0)
98
+ simplecov
99
+ sqlite3 (~> 1.3.10)
100
+ timecop
101
+ yard
102
+
103
+ BUNDLED WITH
104
+ 1.15.4
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
6
+ gem "jdbc-sqlite3", :platforms => :jruby
7
+ gem "sqlite3", "~> 1.3.10", :platforms => :ruby
8
+ gem "activerecord", "~> 5.0.0"
9
+
10
+ gemspec :path => "../"
@@ -0,0 +1,103 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ factory_girl (4.8.1)
5
+ activesupport (>= 3.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (5.0.6)
11
+ activesupport (= 5.0.6)
12
+ activerecord (5.0.6)
13
+ activemodel (= 5.0.6)
14
+ activesupport (= 5.0.6)
15
+ arel (~> 7.0)
16
+ activesupport (5.0.6)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (~> 0.7)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ appraisal (2.1.0)
22
+ bundler
23
+ rake
24
+ thor (>= 0.14.0)
25
+ arel (7.1.4)
26
+ aruba (0.14.2)
27
+ childprocess (~> 0.5.6)
28
+ contracts (~> 0.9)
29
+ cucumber (>= 1.3.19)
30
+ ffi (~> 1.9.10)
31
+ rspec-expectations (>= 2.99)
32
+ thor (~> 0.19)
33
+ builder (3.2.3)
34
+ childprocess (0.5.9)
35
+ ffi (~> 1.0, >= 1.0.11)
36
+ concurrent-ruby (1.0.5)
37
+ contracts (0.16.0)
38
+ cucumber (1.3.20)
39
+ builder (>= 2.1.2)
40
+ diff-lcs (>= 1.1.3)
41
+ gherkin (~> 2.12)
42
+ multi_json (>= 1.7.5, < 2.0)
43
+ multi_test (>= 0.1.2)
44
+ diff-lcs (1.3)
45
+ docile (1.1.5)
46
+ ffi (1.9.18)
47
+ gherkin (2.12.2)
48
+ multi_json (~> 1.3)
49
+ i18n (0.8.6)
50
+ json (2.1.0)
51
+ minitest (5.10.3)
52
+ multi_json (1.12.2)
53
+ multi_test (0.1.2)
54
+ rake (12.1.0)
55
+ rspec (3.6.0)
56
+ rspec-core (~> 3.6.0)
57
+ rspec-expectations (~> 3.6.0)
58
+ rspec-mocks (~> 3.6.0)
59
+ rspec-core (3.6.0)
60
+ rspec-support (~> 3.6.0)
61
+ rspec-expectations (3.6.0)
62
+ diff-lcs (>= 1.2.0, < 2.0)
63
+ rspec-support (~> 3.6.0)
64
+ rspec-its (1.2.0)
65
+ rspec-core (>= 3.0.0)
66
+ rspec-expectations (>= 3.0.0)
67
+ rspec-mocks (3.6.0)
68
+ diff-lcs (>= 1.2.0, < 2.0)
69
+ rspec-support (~> 3.6.0)
70
+ rspec-support (3.6.0)
71
+ simplecov (0.15.1)
72
+ docile (~> 1.1.0)
73
+ json (>= 1.8, < 3)
74
+ simplecov-html (~> 0.10.0)
75
+ simplecov-html (0.10.2)
76
+ sqlite3 (1.3.13)
77
+ thor (0.20.0)
78
+ thread_safe (0.3.6)
79
+ timecop (0.9.1)
80
+ tzinfo (1.2.3)
81
+ thread_safe (~> 0.1)
82
+ yard (0.9.9)
83
+
84
+ PLATFORMS
85
+ ruby
86
+
87
+ DEPENDENCIES
88
+ activerecord (~> 5.0.0)
89
+ activerecord-jdbcsqlite3-adapter
90
+ appraisal (~> 2.1.0)
91
+ aruba
92
+ cucumber (~> 1.3.15)
93
+ factory_girl!
94
+ jdbc-sqlite3
95
+ rspec (~> 3.0)
96
+ rspec-its (~> 1.0)
97
+ simplecov
98
+ sqlite3 (~> 1.3.10)
99
+ timecop
100
+ yard
101
+
102
+ BUNDLED WITH
103
+ 1.15.4
@@ -11,7 +11,10 @@ module FactoryGirl
11
11
  block = @block
12
12
 
13
13
  -> {
14
- value = block.arity == 1 ? block.call(self) : instance_exec(&block)
14
+ value = case block.arity
15
+ when 1, -1 then instance_exec(self, &block)
16
+ else instance_exec(&block)
17
+ end
15
18
  raise SequenceAbuseError if FactoryGirl::Sequence === value
16
19
  value
17
20
  }
@@ -13,7 +13,7 @@ module FactoryGirl
13
13
  @evaluator.instance = build_class_instance
14
14
  build_class_instance.tap do |instance|
15
15
  attributes_to_set_on_instance.each do |attribute|
16
- instance.send("#{attribute}=", get(attribute))
16
+ instance.public_send("#{attribute}=", get(attribute))
17
17
  @attribute_names_assigned << attribute
18
18
  end
19
19
  end
@@ -89,9 +89,9 @@ module FactoryGirl
89
89
  end
90
90
 
91
91
  def alias_names_to_ignore
92
- @attribute_list.non_ignored.map do |attribute|
93
- override_names.map {|override| attribute.name if attribute.alias_for?(override) && attribute.name != override && !ignored_attribute_names.include?(override) }
94
- end.flatten.compact
92
+ @attribute_list.non_ignored.flat_map do |attribute|
93
+ override_names.map { |override| attribute.name if attribute.alias_for?(override) && attribute.name != override && !ignored_attribute_names.include?(override) }
94
+ end.compact
95
95
  end
96
96
  end
97
97
  end
@@ -36,7 +36,7 @@ module FactoryGirl
36
36
  end
37
37
 
38
38
  def apply_attributes(attributes_to_apply)
39
- attributes_to_apply.each {|attribute| add_attribute(attribute) }
39
+ attributes_to_apply.each { |attribute| add_attribute(attribute) }
40
40
  end
41
41
 
42
42
  private
@@ -10,7 +10,7 @@ module FactoryGirl
10
10
 
11
11
  def run(instance, evaluator)
12
12
  case block.arity
13
- when 1 then syntax_runner.instance_exec(instance, &block)
13
+ when 1, -1 then syntax_runner.instance_exec(instance, &block)
14
14
  when 2 then syntax_runner.instance_exec(instance, evaluator, &block)
15
15
  else syntax_runner.instance_exec(&block)
16
16
  end
@@ -15,7 +15,7 @@ module FactoryGirl
15
15
  private
16
16
 
17
17
  def callbacks_by_name(name)
18
- @callbacks.select {|callback| callback.name == name }
18
+ @callbacks.select { |callback| callback.name == name }
19
19
  end
20
20
  end
21
21
  end
@@ -3,6 +3,8 @@ module FactoryGirl
3
3
  class Configuration
4
4
  attr_reader :factories, :sequences, :traits, :strategies, :callback_names
5
5
 
6
+ attr_accessor :allow_class_lookup, :use_parent_strategy
7
+
6
8
  def initialize
7
9
  @factories = Decorator::DisallowsDuplicatesRegistry.new(Registry.new('Factory'))
8
10
  @sequences = Decorator::DisallowsDuplicatesRegistry.new(Registry.new('Sequence'))
@@ -11,11 +13,14 @@ module FactoryGirl
11
13
  @callback_names = Set.new
12
14
  @definition = Definition.new
13
15
 
14
- to_create {|instance| instance.save! }
16
+ @allow_class_lookup = true
17
+
18
+ to_create { |instance| instance.save! }
15
19
  initialize_with { new }
16
20
  end
17
21
 
18
- delegate :to_create, :skip_create, :constructor, to: :@definition
22
+ delegate :to_create, :skip_create, :constructor, :before, :after,
23
+ :callback, :callbacks, to: :@definition
19
24
 
20
25
  def initialize_with(&block)
21
26
  @definition.define_constructor(&block)
@@ -35,11 +35,11 @@ module FactoryGirl
35
35
  private
36
36
 
37
37
  def delete_declaration(declaration)
38
- @declarations.delete_if {|decl| decl.name == declaration.name }
38
+ @declarations.delete_if { |decl| decl.name == declaration.name }
39
39
  end
40
40
 
41
41
  def to_attributes
42
- @declarations.inject([]) {|result, declaration| result += declaration.to_attributes }
42
+ @declarations.inject([]) { |result, declaration| result += declaration.to_attributes }
43
43
  end
44
44
 
45
45
  def overridable?
@@ -7,9 +7,8 @@ module FactoryGirl
7
7
  end
8
8
 
9
9
  def attributes
10
- @attributes.inject({}) do |result, attribute_name|
10
+ @attributes.each_with_object({}) do |attribute_name, result|
11
11
  result[attribute_name] = send(attribute_name)
12
- result
13
12
  end
14
13
  end
15
14
  end
@@ -18,7 +18,8 @@ module FactoryGirl
18
18
  def symbolized_key(key)
19
19
  if key.respond_to?(:to_sym)
20
20
  key.to_sym
21
- else
21
+ elsif FactoryGirl.allow_class_lookup
22
+ ActiveSupport::Deprecation.warn "Looking up factories by class is deprecated and will be removed in 5.0. Use symbols instead and set FactoryGirl.allow_class_lookup = false", caller
22
23
  key.to_s.underscore.to_sym
23
24
  end
24
25
  end
@@ -10,8 +10,8 @@ module FactoryGirl
10
10
  @component.send(name, *args, &block)
11
11
  end
12
12
 
13
- def send(symbol, *args)
14
- __send__(symbol, *args)
13
+ def send(symbol, *args, &block)
14
+ __send__(symbol, *args, &block)
15
15
  end
16
16
 
17
17
  def self.const_missing(name)