fabrication 2.20.2 → 2.21.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
  SHA256:
3
- metadata.gz: e5d3cb9fdb13ee5c47eaa85198882cdc4928a48830ac9a9ca029becffefc4e1a
4
- data.tar.gz: af6d6f702f0b2b45965cf9b366017c32227ce292bc3fb96e4d5c83e32f69a9c4
3
+ metadata.gz: 9a0d6dabff5b3d58e4abf5704c0c05084edc8733655015c0e43f941b08d64f73
4
+ data.tar.gz: 5beb461b6679fbd5d4a73f29038dfdb85fccf22e7cb738e229771178b3020403
5
5
  SHA512:
6
- metadata.gz: 30f5250a089513d1a206ca9db5935172ae30923a140522a9709398a3b84484a2079a5efd5dc70c79e8048db44eb2e390d52ec0ba04321742cc711873d2983073
7
- data.tar.gz: cd0cc5c4410730e4303001ac369aa23a047b2924f52092ee74dfc96981d5ebfd978fd07f20064e34e1fdf1cbdda3a1575475ee6c3a129e60f0ae4489f39b9e96
6
+ metadata.gz: a04671cb31da952388f8df09576c7fcfcfd810b0441e6ef204c2f442d10de3e7c2831bee095a3dad10e439fb887d6d8fbd0c9c630632c3bc10b07f2f588d0ba8
7
+ data.tar.gz: feb4242360e6236ec8c000257127365c2d095acbc0ad6d3c06a1f195e2d1bb8c0c57f43911da7fd4dbf910f4e6182b6b0d30dd1066abe32c5bbfabbcbfaab1bc
@@ -1,3 +1,3 @@
1
1
  module Fabrication
2
- VERSION = '2.20.2'
2
+ VERSION = '2.21.0'.freeze
3
3
  end
@@ -9,7 +9,12 @@ module Fabrication
9
9
 
10
10
  def create_fabrication_file
11
11
  copy_attributes_from_model if attributes.empty?
12
- template 'fabricator.erb', File.join(options[:dir], "#{singular_table_name}_fabricator.#{options[:extension].to_s}")
12
+ template_file = File.join(
13
+ options[:dir],
14
+ class_path,
15
+ "#{file_name}_fabricator.#{options[:extension].to_s}"
16
+ )
17
+ template 'fabricator.erb', template_file
13
18
  end
14
19
 
15
20
  def self.source_root
@@ -1,6 +1,10 @@
1
+ <% if namespaced? -%>
2
+ Fabricator(<%= ":#{singular_name}, from: '#{namespace}::#{class_name}'" %>) do
3
+ <% else -%>
1
4
  Fabricator(<%= class_name.match(/::/) ? "'#{class_name}'" : ":#{singular_name}" %>) do
5
+ <% end -%>
2
6
  <% width = attributes.map{|a| a.name.size }.max.to_i -%>
3
7
  <% attributes.each do |attribute| -%>
4
8
  <%= "%-#{width}s %s" % [attribute.name, attribute.default.inspect] %>
5
9
  <% end -%>
6
- end
10
+ 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.20.2
4
+ version: 2.21.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: 2019-05-02 00:00:00.000000000 Z
11
+ date: 2019-11-25 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.
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  requirements: []
73
- rubygems_version: 3.0.1
73
+ rubygems_version: 3.0.3
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: Implementing the factory pattern in Ruby so you don't have to.