factory_girl 4.4.0 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source "http://rubygems.org"
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", "~> 3.2.15"
6
6
 
7
- gemspec :path=>"../"
7
+ gemspec :path => "../"
@@ -1,11 +1,11 @@
1
1
  PATH
2
- remote: /Users/joshuaclayton/dev/gems/factory_girl
2
+ remote: ../
3
3
  specs:
4
- factory_girl (4.4.0)
4
+ factory_girl (4.5.0)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
8
- remote: http://rubygems.org/
8
+ remote: https://rubygems.org/
9
9
  specs:
10
10
  activemodel (3.2.15)
11
11
  activesupport (= 3.2.15)
@@ -18,9 +18,10 @@ GEM
18
18
  activesupport (3.2.15)
19
19
  i18n (~> 0.6, >= 0.6.4)
20
20
  multi_json (~> 1.0)
21
- appraisal (0.5.2)
21
+ appraisal (1.0.0)
22
22
  bundler
23
23
  rake
24
+ thor (>= 0.14.0)
24
25
  arel (3.0.2)
25
26
  aruba (0.5.3)
26
27
  childprocess (>= 0.3.6)
@@ -31,21 +32,27 @@ GEM
31
32
  builder (3.0.4)
32
33
  childprocess (0.3.9)
33
34
  ffi (~> 1.0, >= 1.0.11)
34
- cucumber (1.2.5)
35
+ cucumber (1.3.15)
35
36
  builder (>= 2.1.2)
36
37
  diff-lcs (>= 1.1.3)
37
- gherkin (~> 2.11.7)
38
- multi_json (~> 1.3)
38
+ gherkin (~> 2.12)
39
+ multi_json (>= 1.7.5, < 2.0)
40
+ multi_test (>= 0.1.1)
39
41
  diff-lcs (1.1.3)
42
+ docile (1.1.3)
40
43
  ffi (1.9.3)
41
- gherkin (2.11.8)
44
+ ffi (1.9.3-java)
45
+ gherkin (2.12.2)
46
+ multi_json (~> 1.3)
47
+ gherkin (2.12.2-java)
42
48
  multi_json (~> 1.3)
43
- i18n (0.6.5)
44
- metaclass (0.0.1)
49
+ i18n (0.6.9)
50
+ metaclass (0.0.4)
45
51
  mocha (0.14.0)
46
52
  metaclass (~> 0.0.1)
47
- multi_json (1.8.2)
48
- rake (10.1.0)
53
+ multi_json (1.10.1)
54
+ multi_test (0.1.1)
55
+ rake (10.3.2)
49
56
  rspec (2.12.0)
50
57
  rspec-core (~> 2.12.0)
51
58
  rspec-expectations (~> 2.12.0)
@@ -54,24 +61,27 @@ GEM
54
61
  rspec-expectations (2.12.1)
55
62
  diff-lcs (~> 1.1.3)
56
63
  rspec-mocks (2.12.2)
57
- simplecov (0.7.1)
58
- multi_json (~> 1.0)
59
- simplecov-html (~> 0.7.1)
60
- simplecov-html (0.7.1)
64
+ simplecov (0.8.2)
65
+ docile (~> 1.1.0)
66
+ multi_json
67
+ simplecov-html (~> 0.8.0)
68
+ simplecov-html (0.8.0)
61
69
  sqlite3 (1.3.8)
62
- timecop (0.6.3)
63
- tzinfo (0.3.38)
70
+ thor (0.19.1)
71
+ timecop (0.7.1)
72
+ tzinfo (0.3.39)
64
73
  yard (0.8.7.3)
65
74
 
66
75
  PLATFORMS
76
+ java
67
77
  ruby
68
78
 
69
79
  DEPENDENCIES
70
80
  activerecord (~> 3.2.15)
71
- appraisal (~> 0.5.1)
81
+ appraisal (~> 1.0.0)
72
82
  aruba
73
83
  bourne
74
- cucumber (~> 1.2.1)
84
+ cucumber (~> 1.3.15)
75
85
  factory_girl!
76
86
  mocha (>= 0.12.8)
77
87
  rspec (~> 2.12.0)
@@ -1,7 +1,7 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source "http://rubygems.org"
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "activerecord", "~> 4.0.1"
6
6
 
7
- gemspec :path=>"../"
7
+ gemspec :path => "../"
@@ -1,61 +1,63 @@
1
1
  PATH
2
- remote: ..
2
+ remote: ../
3
3
  specs:
4
- factory_girl (4.4.0)
4
+ factory_girl (4.5.0)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
8
- remote: http://rubygems.org/
8
+ remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (4.0.1)
11
- activesupport (= 4.0.1)
10
+ activemodel (4.0.5)
11
+ activesupport (= 4.0.5)
12
12
  builder (~> 3.1.0)
13
- activerecord (4.0.1)
14
- activemodel (= 4.0.1)
13
+ activerecord (4.0.5)
14
+ activemodel (= 4.0.5)
15
15
  activerecord-deprecated_finders (~> 1.0.2)
16
- activesupport (= 4.0.1)
16
+ activesupport (= 4.0.5)
17
17
  arel (~> 4.0.0)
18
18
  activerecord-deprecated_finders (1.0.3)
19
- activesupport (4.0.1)
20
- i18n (~> 0.6, >= 0.6.4)
19
+ activesupport (4.0.5)
20
+ i18n (~> 0.6, >= 0.6.9)
21
21
  minitest (~> 4.2)
22
22
  multi_json (~> 1.3)
23
23
  thread_safe (~> 0.1)
24
24
  tzinfo (~> 0.3.37)
25
- appraisal (0.5.2)
25
+ appraisal (1.0.0)
26
26
  bundler
27
27
  rake
28
- arel (4.0.1)
28
+ thor (>= 0.14.0)
29
+ arel (4.0.2)
29
30
  aruba (0.5.3)
30
31
  childprocess (>= 0.3.6)
31
32
  cucumber (>= 1.1.1)
32
33
  rspec-expectations (>= 2.7.0)
33
- atomic (1.1.14)
34
- atomic (1.1.14-java)
35
34
  bourne (1.5.0)
36
35
  mocha (>= 0.13.2, < 0.15)
37
36
  builder (3.1.4)
38
37
  childprocess (0.3.9)
39
38
  ffi (~> 1.0, >= 1.0.11)
40
- cucumber (1.2.5)
39
+ cucumber (1.3.15)
41
40
  builder (>= 2.1.2)
42
41
  diff-lcs (>= 1.1.3)
43
- gherkin (~> 2.11.7)
44
- multi_json (~> 1.3)
42
+ gherkin (~> 2.12)
43
+ multi_json (>= 1.7.5, < 2.0)
44
+ multi_test (>= 0.1.1)
45
45
  diff-lcs (1.1.3)
46
+ docile (1.1.3)
46
47
  ffi (1.9.3)
47
48
  ffi (1.9.3-java)
48
- gherkin (2.11.8)
49
+ gherkin (2.12.2)
49
50
  multi_json (~> 1.3)
50
- gherkin (2.11.8-java)
51
+ gherkin (2.12.2-java)
51
52
  multi_json (~> 1.3)
52
- i18n (0.6.5)
53
- metaclass (0.0.1)
53
+ i18n (0.6.9)
54
+ metaclass (0.0.4)
54
55
  minitest (4.7.5)
55
56
  mocha (0.14.0)
56
57
  metaclass (~> 0.0.1)
57
- multi_json (1.8.2)
58
- rake (10.1.0)
58
+ multi_json (1.10.1)
59
+ multi_test (0.1.1)
60
+ rake (10.3.2)
59
61
  rspec (2.12.0)
60
62
  rspec-core (~> 2.12.0)
61
63
  rspec-expectations (~> 2.12.0)
@@ -64,17 +66,17 @@ GEM
64
66
  rspec-expectations (2.12.1)
65
67
  diff-lcs (~> 1.1.3)
66
68
  rspec-mocks (2.12.2)
67
- simplecov (0.7.1)
68
- multi_json (~> 1.0)
69
- simplecov-html (~> 0.7.1)
70
- simplecov-html (0.7.1)
69
+ simplecov (0.8.2)
70
+ docile (~> 1.1.0)
71
+ multi_json
72
+ simplecov-html (~> 0.8.0)
73
+ simplecov-html (0.8.0)
71
74
  sqlite3 (1.3.8)
72
- thread_safe (0.1.3)
73
- atomic
74
- thread_safe (0.1.3-java)
75
- atomic
76
- timecop (0.6.3)
77
- tzinfo (0.3.38)
75
+ thor (0.19.1)
76
+ thread_safe (0.3.4)
77
+ thread_safe (0.3.4-java)
78
+ timecop (0.7.1)
79
+ tzinfo (0.3.39)
78
80
  yard (0.8.7.3)
79
81
 
80
82
  PLATFORMS
@@ -83,10 +85,10 @@ PLATFORMS
83
85
 
84
86
  DEPENDENCIES
85
87
  activerecord (~> 4.0.1)
86
- appraisal (~> 0.5.1)
88
+ appraisal (~> 1.0.0)
87
89
  aruba
88
90
  bourne
89
- cucumber (~> 1.2.1)
91
+ cucumber (~> 1.3.15)
90
92
  factory_girl!
91
93
  mocha (>= 0.12.8)
92
94
  rspec (~> 2.12.0)
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 4.1.1"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,93 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ factory_girl (4.5.0)
5
+ activesupport (>= 3.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (4.1.1)
11
+ activesupport (= 4.1.1)
12
+ builder (~> 3.1)
13
+ activerecord (4.1.1)
14
+ activemodel (= 4.1.1)
15
+ activesupport (= 4.1.1)
16
+ arel (~> 5.0.0)
17
+ activesupport (4.1.1)
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 (1.0.0)
24
+ bundler
25
+ rake
26
+ thor (>= 0.14.0)
27
+ arel (5.0.1.20140414130214)
28
+ aruba (0.5.4)
29
+ childprocess (>= 0.3.6)
30
+ cucumber (>= 1.1.1)
31
+ rspec-expectations (>= 2.7.0)
32
+ bourne (1.5.0)
33
+ mocha (>= 0.13.2, < 0.15)
34
+ builder (3.2.2)
35
+ childprocess (0.5.3)
36
+ ffi (~> 1.0, >= 1.0.11)
37
+ cucumber (1.3.15)
38
+ builder (>= 2.1.2)
39
+ diff-lcs (>= 1.1.3)
40
+ gherkin (~> 2.12)
41
+ multi_json (>= 1.7.5, < 2.0)
42
+ multi_test (>= 0.1.1)
43
+ diff-lcs (1.1.3)
44
+ docile (1.1.3)
45
+ ffi (1.9.3)
46
+ gherkin (2.12.2)
47
+ multi_json (~> 1.3)
48
+ i18n (0.6.9)
49
+ json (1.8.1)
50
+ metaclass (0.0.4)
51
+ minitest (5.3.4)
52
+ mocha (0.14.0)
53
+ metaclass (~> 0.0.1)
54
+ multi_json (1.10.1)
55
+ multi_test (0.1.1)
56
+ rake (10.3.2)
57
+ rspec (2.12.0)
58
+ rspec-core (~> 2.12.0)
59
+ rspec-expectations (~> 2.12.0)
60
+ rspec-mocks (~> 2.12.0)
61
+ rspec-core (2.12.2)
62
+ rspec-expectations (2.12.1)
63
+ diff-lcs (~> 1.1.3)
64
+ rspec-mocks (2.12.2)
65
+ simplecov (0.8.2)
66
+ docile (~> 1.1.0)
67
+ multi_json
68
+ simplecov-html (~> 0.8.0)
69
+ simplecov-html (0.8.0)
70
+ sqlite3 (1.3.9)
71
+ thor (0.19.1)
72
+ thread_safe (0.3.4)
73
+ timecop (0.7.1)
74
+ tzinfo (1.2.0)
75
+ thread_safe (~> 0.1)
76
+ yard (0.8.7.4)
77
+
78
+ PLATFORMS
79
+ ruby
80
+
81
+ DEPENDENCIES
82
+ activerecord (~> 4.1.1)
83
+ appraisal (~> 1.0.0)
84
+ aruba
85
+ bourne
86
+ cucumber (~> 1.3.15)
87
+ factory_girl!
88
+ mocha (>= 0.12.8)
89
+ rspec (~> 2.12.0)
90
+ simplecov
91
+ sqlite3
92
+ timecop
93
+ yard
@@ -43,6 +43,7 @@ require 'factory_girl/decorator/class_key_hash'
43
43
  require 'factory_girl/decorator/disallows_duplicates_registry'
44
44
  require 'factory_girl/decorator/invocation_tracker'
45
45
  require 'factory_girl/decorator/new_constructor'
46
+ require 'factory_girl/linter'
46
47
  require 'factory_girl/version'
47
48
 
48
49
  module FactoryGirl
@@ -54,24 +55,8 @@ module FactoryGirl
54
55
  @configuration = nil
55
56
  end
56
57
 
57
- def self.lint
58
- invalid_factories = FactoryGirl.factories.select do |factory|
59
- built_factory = FactoryGirl.build(factory.name)
60
-
61
- if built_factory.respond_to?(:valid?)
62
- !built_factory.valid?
63
- end
64
- end
65
-
66
- if invalid_factories.any?
67
- error_message = <<-ERROR_MESSAGE.strip
68
- The following factories are invalid:
69
-
70
- #{invalid_factories.map {|factory| "* #{factory.name}" }.join("\n")}
71
- ERROR_MESSAGE
72
-
73
- raise InvalidFactoryError, error_message
74
- end
58
+ def self.lint(factories_to_lint = FactoryGirl.factories)
59
+ Linter.lint!(factories_to_lint)
75
60
  end
76
61
 
77
62
  class << self
@@ -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
@@ -52,6 +52,12 @@ module FactoryGirl
52
52
  end
53
53
 
54
54
  def ignore(&block)
55
+ ActiveSupport::Deprecation.warn "`#ignore` is deprecated and will be "\
56
+ "removed in 5.0. Please use `#transient` instead."
57
+ transient &block
58
+ end
59
+
60
+ def transient(&block)
55
61
  proxy = DefinitionProxy.new(@definition, true)
56
62
  proxy.instance_eval(&block)
57
63
  end
@@ -13,7 +13,7 @@ module FactoryGirl
13
13
  absolute_definition_file_paths = definition_file_paths.map { |path| File.expand_path(path) }
14
14
 
15
15
  absolute_definition_file_paths.uniq.each do |path|
16
- load("#{path}.rb") if File.exists?("#{path}.rb")
16
+ load("#{path}.rb") if File.exist?("#{path}.rb")
17
17
 
18
18
  if File.directory? path
19
19
  Dir[File.join(path, '**', '*.rb')].sort.each do |file|
@@ -0,0 +1,46 @@
1
+ module FactoryGirl
2
+ class Linter
3
+ def self.lint!(factories_to_lint)
4
+ new(factories_to_lint).lint!
5
+ end
6
+
7
+ def initialize(factories_to_lint)
8
+ @factories_to_lint = factories_to_lint
9
+ @invalid_factories = calculate_invalid_factories
10
+ end
11
+
12
+ def lint!
13
+ if invalid_factories.any?
14
+ raise InvalidFactoryError, error_message
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ attr_reader :factories_to_lint, :invalid_factories
21
+
22
+ def calculate_invalid_factories
23
+ factories_to_lint.inject({}) do |result, factory|
24
+ begin
25
+ FactoryGirl.create(factory.name)
26
+ rescue => error
27
+ result[factory] = error
28
+ end
29
+
30
+ result
31
+ end
32
+ end
33
+
34
+ def error_message
35
+ lines = invalid_factories.map do |factory, exception|
36
+ "* #{factory.name} - #{exception.message} (#{exception.class.name})"
37
+ end
38
+
39
+ <<-ERROR_MESSAGE.strip
40
+ The following factories are invalid:
41
+
42
+ #{lines.join("\n")}
43
+ ERROR_MESSAGE
44
+ end
45
+ end
46
+ end