fabrication 2.11.3 → 2.12.0

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: 8a1a39572d252d876796cb240d8ae2bc51fbccfd
4
- data.tar.gz: bdf62edb5100e0b32cd0fa51bf0b3c7b848cd17d
3
+ metadata.gz: c86735d59579efdd4858c328b20ee0c2d8b26eea
4
+ data.tar.gz: 5522df1bd0f36d53231d508d27b566f74626ea6d
5
5
  SHA512:
6
- metadata.gz: 6f25fb5f6ca06b93b3a5c4011ca8333662decd4f1f1b8d6f237112d09f07b8cb39715a789b19982773779510030508fa3dd41e397af213162bc80c1b226e95e0
7
- data.tar.gz: cb44c496ca629154fa8bdf41dcddb164cd51ea04bc95b80e3748ec239c30f3ebc11d268c01bb88cb6cf6a773c29a2a4e86b1cb8a0adabec55a6886383b6999f2
6
+ metadata.gz: 77f82743f80f9b0cb9bb647bdc02ca8e50f137cb2202f6ddccdd46f5ac2db1d7542d924d9e4e7ab232f2ded94945e24882cf5ee30d1cee56f819d7f5f57b6aca
7
+ data.tar.gz: fa8303b63ac13fda4b6a2780f8f38594128777f0e3c82e4da81e662abfd03570dc6599c7e82d76f7c4b58de99153263e05f67870afda2560b1e1768a83877351
@@ -7,7 +7,6 @@ module Fabrication
7
7
  def reset_defaults
8
8
  @fabricator_path =
9
9
  @path_prefix =
10
- @active_support =
11
10
  @sequence_start =
12
11
  nil
13
12
  end
@@ -41,7 +41,7 @@ class Fabrication::Schematic::Attribute
41
41
  end
42
42
 
43
43
  def process_count
44
- count || rand
44
+ count || rand || rand_range
45
45
  end
46
46
 
47
47
  def count
@@ -52,4 +52,8 @@ class Fabrication::Schematic::Attribute
52
52
  Kernel.rand((1..params[:rand])) if params[:rand]
53
53
  end
54
54
 
55
+ def rand_range
56
+ Kernel.rand((params[:start_range]..params[:end_range])) if params[:start_range] && params[:end_range]
57
+ end
58
+
55
59
  end
@@ -8,7 +8,7 @@ class Fabrication::Support
8
8
 
9
9
  def class_for(class_or_to_s)
10
10
  class_name = variable_name_to_class_name(class_or_to_s)
11
- klass = constantize(class_name)
11
+ constantize(class_name)
12
12
  rescue NameError => original_error
13
13
  raise Fabrication::UnfabricatableError.new(class_or_to_s, original_error)
14
14
  end
@@ -39,7 +39,12 @@ class Fabrication::Support
39
39
  end
40
40
 
41
41
  def variable_name_to_class_name(name)
42
- name.to_s.gsub(/\/(.?)/){"::#{$1.upcase}"}.gsub(/(?:^|_)(.)/){$1.upcase}
42
+ name = name.to_s
43
+ if name.respond_to?(:classify)
44
+ name.to_s.classify
45
+ else
46
+ name.to_s.gsub(/\/(.?)/){"::#{$1.upcase}"}.gsub(/(?:^|_)(.)/){$1.upcase}
47
+ end
43
48
  end
44
49
 
45
50
  def find_definitions
@@ -1,3 +1,3 @@
1
1
  module Fabrication
2
- VERSION = '2.11.3'
2
+ VERSION = '2.12.0'
3
3
  end
@@ -41,10 +41,10 @@ Given /^(?:that|those) (.*) belongs? to that (.*)$/ do |children, parent|
41
41
  end
42
42
 
43
43
  Then /^I should see (\d+) ([^"]*) in the database$/ do |count, model_name|
44
- Fabrication::Cucumber::StepFabricator.new(model_name).klass.count.should == count.to_i
44
+ expect(Fabrication::Cucumber::StepFabricator.new(model_name).klass.count).to eq(count.to_i)
45
45
  end
46
46
 
47
47
  Then /^I should see the following (.*) in the database:$/ do |model_name, table|
48
48
  klass = Fabrication::Cucumber::StepFabricator.new(model_name).klass
49
- klass.where(table.rows_hash.symbolize_keys).count.should == 1
49
+ expect(klass.where(table.rows_hash.symbolize_keys).count).to eq(1)
50
50
  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.11.3
4
+ version: 2.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Elliott
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-13 00:00:00.000000000 Z
11
+ date: 2015-01-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Fabrication is an object generation framework for ActiveRecord, Mongoid,
14
14
  DataMapper, Sequel, or any other Ruby object.
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  version: '0'
70
70
  requirements: []
71
71
  rubyforge_project:
72
- rubygems_version: 2.2.2
72
+ rubygems_version: 2.4.3
73
73
  signing_key:
74
74
  specification_version: 4
75
75
  summary: Implementing the factory pattern in Ruby so you don't have to.