rspec_rails_scaffold_templates 1.2.4 → 1.2.5

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: c5ace3dcb832579b7a882c8748ea886c708429bd
4
- data.tar.gz: fb703f3cbefbfb9c0841e96673b1c2d80dbf6565
3
+ metadata.gz: fb9fa57cda2a4744edffadd02b61ef86bce7bfd1
4
+ data.tar.gz: 6e2ce7300fc7e1ac7789e5ef0036ee02a55515fc
5
5
  SHA512:
6
- metadata.gz: c8695b6a9c41b46b08ef66f4739ffc9e2611ea9cc6a8ba4cff70d82aecb6fc6eb7b7a7edd0cfa374e61510e063ee8350d11a24358a33d1ed1c5c4356984eec05
7
- data.tar.gz: 600812423e7b0e0c687e0609e5c5cfe3684bd85d2e41b1e554c4f07ff609ea354b440fea4ae7aa7f74aebbdec7de59d544c9528306b5f9b122033c1bd9ea1129
6
+ metadata.gz: 7d706be391e38d4f159732aef7144712b14de373a759d292fe40d51a2077aa889fda41c77082f4a0aece3bedd14f75c7426ad1c07ae18b912bb4df130dc52efa
7
+ data.tar.gz: 32962541aee92043cf1aa1b4fca0409dc9621049a76f408033ef6ff292a3d3d9cd89021ddaf1c653467ac839c9225da985e86e16b95fb39a222be509e0478ac9
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.4
1
+ 1.2.5
@@ -17,11 +17,24 @@ describe <%= controller_class_name %>Controller, type: :controller do
17
17
  # This should return the minimal set of attributes required to create a valid
18
18
  # <%= class_name %>. As you add validations to <%= class_name %>, be sure to
19
19
  # adjust the attributes here as well. The list could not be empty.
20
- <% attribute = attributes.detect{|a| a.name == 'name' || a.name == 'title' || a.name == 'code' || a.name =~ /name/ || a.name =~ /title/} || attributes.first -%>
20
+ <% links = attributes.select{|a| [:belongs_to, :references].include? a.type} -%>
21
+ <% attribute = (attributes - links).detect{|a| a.name == 'name' || a.name == 'title' || a.name == 'code' || a.name =~ /name/ || a.name =~ /title/} || attributes.first -%>
21
22
  <% attribute_name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name -%>
22
23
  <% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_girl -%>
23
24
  <% factory_girl = true -%>
25
+ <% if links.present? -%>
26
+ let(:valid_attributes) do
27
+ FactoryGirl.attributes_for(:<%=file_name%>)
28
+ .slice(*%w[<%= attribute_name %>].map(&:to_sym))
29
+ .merge(
30
+ <% links.each do |relation| -%>
31
+ <%= relation.name %>_id: create(:<%= relation.name %>).id,
32
+ <% end -%>
33
+ )
34
+ end
35
+ <% else -%>
24
36
  let(:valid_attributes) {FactoryGirl.attributes_for(:<%=file_name%>).slice *%w[<%= attribute_name %>].map(&:to_sym)}
37
+ <% end -%>
25
38
  <% else -%>
26
39
  <% factory_girl = false -%>
27
40
  let(:valid_attributes) do
@@ -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: rspec_rails_scaffold_templates 1.2.4 ruby lib
5
+ # stub: rspec_rails_scaffold_templates 1.2.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "rspec_rails_scaffold_templates"
9
- s.version = "1.2.4"
9
+ s.version = "1.2.5"
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 = "2016-03-22"
14
+ s.date = "2016-03-23"
15
15
  s.description = "RSpec scaffold generator templates that use FactoryGirl and WiceGrid"
16
16
  s.email = "dima@koulikoff.ru"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_rails_scaffold_templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitri Koulikoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-22 00:00:00.000000000 Z
11
+ date: 2016-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec