fabrication 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2269a43451102e038d20407b145774ddc943a4d8
4
- data.tar.gz: e0d028f064c38f45bb11a4905a1520e80e846bd7
3
+ metadata.gz: ca46c77d2fd703ffa53b9a00039b8732afa59ad8
4
+ data.tar.gz: 92e078436be385fcaaca19a7ac3a0456287dedb6
5
5
  SHA512:
6
- metadata.gz: 6308d6d7b3d9e13e782e8c0122569d247a4c92751ccf15947ea991ef978213eb34c32d3da1fb29ee223b8f1d283f720c2895d8f42a60998ec99affd4698d2449
7
- data.tar.gz: d73ee4e84aebda7d7d75f2948b684423fa097fa173ca7a03ab75b70457a28ad87df4dd921a9161d7ad10edbc58678d9d6408a1bb310045958becdab1b4e7ea5c
6
+ metadata.gz: 7b8df7fc0ed4bab31a3ac0a70cc8d4ea3a6fe178415da30cc337442d3f31fd2eb46a94cc414f9c961ba8756d539b99b92d191934bf0e1bbdee9078ae906bb14b
7
+ data.tar.gz: f264f1e92c91ef32c3f5e9ce1b021a88ecd74772a54149e29831797b450f62bc737a063eee6ab9febcaecd706aa16a109543d0e25770e687949207f85a50edaf
@@ -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, 'fabrication/errors/misplaced_fabricate_error'
5
+ autoload :MisplacedFabricateError, 'fabrication/errors/misplaced_fabricate_error'
6
6
 
7
7
  module Schematic
8
8
  autoload :Attribute, 'fabrication/schematic/attribute'
@@ -15,12 +15,20 @@ module Fabrication
15
15
  def fabricator_path
16
16
  @fabricator_path ||= ['test/fabricators', 'spec/fabricators']
17
17
  end
18
- alias fabricator_dir fabricator_path
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
- alias fabricator_dir= fabricator_path=
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, "No Fabricator defined for '#{@model}'" unless schematic
58
+ raise Fabrication::UnknownFabricatorError.new(@model) unless schematic
59
59
  end
60
60
  end
61
61
 
@@ -1 +1,5 @@
1
- class Fabrication::MisplacedFabricateError < StandardError; end
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
@@ -1 +1,6 @@
1
- class Fabrication::UnfabricatableError < StandardError; end
1
+ class Fabrication::UnfabricatableError < StandardError
2
+
3
+ def initialize(name)
4
+ super("No class found for '#{name}'")
5
+ end
6
+ end
@@ -1 +1,7 @@
1
- class Fabrication::UnknownFabricatorError < StandardError; end
1
+ class Fabrication::UnknownFabricatorError < StandardError
2
+
3
+ def initialize(name)
4
+ super("No Fabricator defined for '#{name}'")
5
+ end
6
+
7
+ 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, "No Fabricator defined for '#{name}'" unless schematic
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, "No class found for '#{name}'")
59
+ ) || (raise Fabrication::UnfabricatableError.new(name))
60
60
  end
61
61
 
62
62
  def schematic_for(name, options, &block)
@@ -28,11 +28,14 @@ class Fabrication::Support
28
28
 
29
29
  def find_definitions
30
30
  Fabrication.manager.preinitialize
31
- Fabrication::Config.fabricator_dir.each do |folder|
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
 
@@ -1,3 +1,3 @@
1
1
  module Fabrication
2
- VERSION = '2.8.0'
2
+ VERSION = '2.8.1'
3
3
  end
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.0
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-04 00:00:00.000000000 Z
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.0.3
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.