fabrication 2.8.0 → 2.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fabrication.rb +1 -1
- data/lib/fabrication/config.rb +10 -2
- data/lib/fabrication/cucumber/step_fabricator.rb +1 -1
- data/lib/fabrication/errors/misplaced_fabricate_error.rb +5 -1
- data/lib/fabrication/errors/unfabricatable_error.rb +6 -1
- data/lib/fabrication/errors/unknown_fabricator_error.rb +7 -1
- data/lib/fabrication/fabricator.rb +2 -4
- data/lib/fabrication/schematic/manager.rb +1 -1
- data/lib/fabrication/support.rb +4 -1
- data/lib/fabrication/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca46c77d2fd703ffa53b9a00039b8732afa59ad8
|
4
|
+
data.tar.gz: 92e078436be385fcaaca19a7ac3a0456287dedb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b8df7fc0ed4bab31a3ac0a70cc8d4ea3a6fe178415da30cc337442d3f31fd2eb46a94cc414f9c961ba8756d539b99b92d191934bf0e1bbdee9078ae906bb14b
|
7
|
+
data.tar.gz: f264f1e92c91ef32c3f5e9ce1b021a88ecd74772a54149e29831797b450f62bc737a063eee6ab9febcaecd706aa16a109543d0e25770e687949207f85a50edaf
|
data/lib/fabrication.rb
CHANGED
@@ -2,7 +2,7 @@ module Fabrication
|
|
2
2
|
autoload :DuplicateFabricatorError, 'fabrication/errors/duplicate_fabricator_error'
|
3
3
|
autoload :UnfabricatableError, 'fabrication/errors/unfabricatable_error'
|
4
4
|
autoload :UnknownFabricatorError, 'fabrication/errors/unknown_fabricator_error'
|
5
|
-
autoload :MisplacedFabricateError,
|
5
|
+
autoload :MisplacedFabricateError, 'fabrication/errors/misplaced_fabricate_error'
|
6
6
|
|
7
7
|
module Schematic
|
8
8
|
autoload :Attribute, 'fabrication/schematic/attribute'
|
data/lib/fabrication/config.rb
CHANGED
@@ -15,12 +15,20 @@ module Fabrication
|
|
15
15
|
def fabricator_path
|
16
16
|
@fabricator_path ||= ['test/fabricators', 'spec/fabricators']
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
|
+
def fabricator_dir
|
20
|
+
puts "DEPRECATION WARNING: Fabrication::Config.fabricator_dir has been replaced by Fabrication::Config.fabricator_path"
|
21
|
+
fabricator_path
|
22
|
+
end
|
19
23
|
|
20
24
|
def fabricator_path=(folders)
|
21
25
|
@fabricator_path = (Array.new << folders).flatten
|
22
26
|
end
|
23
|
-
|
27
|
+
|
28
|
+
def fabricator_dir=(folders)
|
29
|
+
puts "DEPRECATION WARNING: Fabrication::Config.fabricator_dir has been replaced by Fabrication::Config.fabricator_path"
|
30
|
+
fabricator_path = folders
|
31
|
+
end
|
24
32
|
|
25
33
|
attr_writer :sequence_start
|
26
34
|
def sequence_start; @sequence_start ||= 0 end
|
@@ -55,7 +55,7 @@ module Fabrication
|
|
55
55
|
|
56
56
|
def schematic
|
57
57
|
Fabrication.manager[@fabricator].tap do |schematic|
|
58
|
-
raise Fabrication::UnknownFabricatorError
|
58
|
+
raise Fabrication::UnknownFabricatorError.new(@model) unless schematic
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -1 +1,5 @@
|
|
1
|
-
class Fabrication::MisplacedFabricateError < StandardError
|
1
|
+
class Fabrication::MisplacedFabricateError < StandardError
|
2
|
+
def initialize(name)
|
3
|
+
super("You tried to fabricate `#{name}` while Fabricators were still loading. Check your fabricator files and make sure you didn't accidentally type `Fabricate` instead of `Fabricator` in there somewhere.")
|
4
|
+
end
|
5
|
+
end
|
@@ -18,15 +18,13 @@ class Fabrication::Fabricator
|
|
18
18
|
private
|
19
19
|
|
20
20
|
def self.fail_if_initializing(name)
|
21
|
-
raise Fabrication::MisplacedFabricateError.new(
|
22
|
-
"You tried to fabricate `#{name}` while Fabricators were still loading. Check your fabricator files and make sure you didn't accidentally type `Fabricate` instead of `Fabricator` in there somewhere."
|
23
|
-
) if Fabrication.manager.initializing?
|
21
|
+
raise Fabrication::MisplacedFabricateError.new(name) if Fabrication.manager.initializing?
|
24
22
|
end
|
25
23
|
|
26
24
|
def self.schematic(name)
|
27
25
|
Fabrication::Support.find_definitions if Fabrication.manager.empty?
|
28
26
|
Fabrication.manager[name].tap do |schematic|
|
29
|
-
raise Fabrication::UnknownFabricatorError
|
27
|
+
raise Fabrication::UnknownFabricatorError.new(name) unless schematic
|
30
28
|
end
|
31
29
|
end
|
32
30
|
|
@@ -56,7 +56,7 @@ class Fabrication::Schematic::Manager
|
|
56
56
|
(parent && parent.klass) ||
|
57
57
|
options[:from] ||
|
58
58
|
name
|
59
|
-
) || (raise Fabrication::UnfabricatableError
|
59
|
+
) || (raise Fabrication::UnfabricatableError.new(name))
|
60
60
|
end
|
61
61
|
|
62
62
|
def schematic_for(name, options, &block)
|
data/lib/fabrication/support.rb
CHANGED
@@ -28,11 +28,14 @@ class Fabrication::Support
|
|
28
28
|
|
29
29
|
def find_definitions
|
30
30
|
Fabrication.manager.preinitialize
|
31
|
-
Fabrication::Config.
|
31
|
+
Fabrication::Config.fabricator_path.each do |folder|
|
32
32
|
Dir.glob(File.join(Fabrication::Config.path_prefix, folder, '**', '*.rb')).sort.each do |file|
|
33
33
|
load file
|
34
34
|
end
|
35
35
|
end
|
36
|
+
rescue Exception => e
|
37
|
+
raise e
|
38
|
+
ensure
|
36
39
|
Fabrication.manager.freeze
|
37
40
|
end
|
38
41
|
|
data/lib/fabrication/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fabrication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Elliott
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -264,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
264
264
|
version: '0'
|
265
265
|
requirements: []
|
266
266
|
rubyforge_project:
|
267
|
-
rubygems_version: 2.
|
267
|
+
rubygems_version: 2.1.3
|
268
268
|
signing_key:
|
269
269
|
specification_version: 4
|
270
270
|
summary: Fabrication provides a simple solution for test object generation.
|