factory_girl_fixtures_template 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64c03b69c8ccf72637b5d44ab7175d5c7dbd57a1
4
- data.tar.gz: bfd44f66b808b6a6c559b108380bbe06f0b41c42
3
+ metadata.gz: 0891b7e4c6ab5be3cf305b6fb70e7059cbcc97a4
4
+ data.tar.gz: ab71222dc83264d5aa2638711c6fd3517c301d3e
5
5
  SHA512:
6
- metadata.gz: 8d5aa52fa8188461a30950eadb0916ffe23799b24732f0240ca593588b695f7e3940f08dfa58e28ace3dc855988ce72b8ade7bb41d0a9302805463ded3af8093
7
- data.tar.gz: a642385acdde9365ab075acf1f252b5971b5b9e75ae383e51496af274fc70e86c7ad68dc57c162310df637049feffda1835247dc46272ca4f6159a71cc5bb79f
6
+ metadata.gz: aef7bbfe70b2e6a92f82ff8f0a285b8addab7dcd51527782551796dd794dee82b184225a1064b002265a92a689447a70245325943ff275b7c8172155ed1d1eb5
7
+ data.tar.gz: 1300d6d5bfd7dfd8738b356ea9a6154b4869cd2cf0d3f23b27c52412e13c664c1d8c101f9436534f642307436d27cd7e220948ddc16f999306582dc4c356b95e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.4
1
+ 1.1.0
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: factory_girl_fixtures_template 1.0.4 ruby lib
5
+ # stub: factory_girl_fixtures_template 1.1.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "factory_girl_fixtures_template"
9
- s.version = "1.0.4"
9
+ s.version = "1.1.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Dmitri Koulikoff"]
14
- s.date = "2015-02-26"
14
+ s.date = "2016-03-22"
15
15
  s.description = "FactoryGirl template that behave more smart than standard one"
16
16
  s.email = "dima@koulikoff.ru"
17
17
  s.extra_rdoc_files = [
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
34
34
  ]
35
35
  s.homepage = "http://github.com/dima4p/factory_girl_fixtures_template"
36
36
  s.licenses = ["MIT"]
37
- s.rubygems_version = "2.4.5"
37
+ s.rubygems_version = "2.5.1"
38
38
  s.summary = "Better FactoryGirl template"
39
39
 
40
40
  if s.respond_to? :specification_version then
@@ -1,20 +1,22 @@
1
1
  FactoryGirl.define do
2
2
  factory :<%= singular_table_name %><%= explicit_class_option %> do
3
+ <% i = 0 -%>
3
4
  <% for attribute in attributes -%>
4
5
  <% if attribute.reference? -%>
5
- <%= attribute.name %> { create :<%= attribute.name %> }
6
- <% elsif /\A(.*)_name\z/.match attribute.name -%>
7
- sequence(:<%= attribute.name %>) {|n| "<%= class_name %>_<%= $1.try :capitalize %>#{n}" }
8
- <% elsif I18n.available_locales.include? /\A.*?_([a-z]{2}(_[A-Z]{2})?)\z/.match(attribute.name).try(:[], 1).try(:to_sym) -%>
9
- sequence(:<%= attribute.name %>) {|n| "<%= class_name %>_<%= $1 %>#{n}" }
10
- <% elsif %[name title].include? attribute.name -%>
11
- sequence(:<%= attribute.name %>) {|n| "<%= class_name %> ##{n}" }
6
+ association :<%= attribute.name %>, factory: :<%= attribute.name %>
12
7
  <% elsif attribute.name == 'email' -%>
13
- sequence(:<%= attribute.name %>) {|n| "email#{n}@gmail.com" }
14
- <% elsif attribute.name == 'position' -%>
15
- sequence(:<%= attribute.name %>) {|n| n }
8
+ sequence(:<%= attribute.name %>) {|n| "email#{format "%02d", n}@gmail.com" }
9
+ <% elsif attribute.name =~ /(.*)_url$/ -%>
10
+ sequence(:<%= attribute.name %>) {|n| "http://<%= $1 %>#{format "%02d", n}.com" }
16
11
  <% elsif attribute.name == 'password' -%>
17
12
  password 'password'
13
+ <% elsif attribute.name == 'position' -%>
14
+ sequence(:<%= attribute.name %>) {|n| n }
15
+ <% elsif [:string, :text].include? attribute.type -%>
16
+ sequence(:<%= attribute.name %>) {|n| "<%= attribute.name.capitalize.gsub('_', ' ') %>#{format "%02d", n}" }
17
+ <% elsif attribute.type == :integer -%>
18
+ <% i += 1 -%>
19
+ sequence(:<%= attribute.name %>) {|n| "<%= i %>#{format "%02d", n}" }
18
20
  <% else -%>
19
21
  <%= attribute.name %> <%= attribute.default.inspect %>
20
22
  <% end -%>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_girl_fixtures_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitri Koulikoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2016-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.4.5
123
+ rubygems_version: 2.5.1
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: Better FactoryGirl template