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 +4 -4
- data/VERSION +1 -1
- data/lib/templates/rspec/scaffold/controller_spec.rb +14 -1
- data/rspec_rails_scaffold_templates.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb9fa57cda2a4744edffadd02b61ef86bce7bfd1
|
4
|
+
data.tar.gz: 6e2ce7300fc7e1ac7789e5ef0036ee02a55515fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d706be391e38d4f159732aef7144712b14de373a759d292fe40d51a2077aa889fda41c77082f4a0aece3bedd14f75c7426ad1c07ae18b912bb4df130dc52efa
|
7
|
+
data.tar.gz: 32962541aee92043cf1aa1b4fca0409dc9621049a76f408033ef6ff292a3d3d9cd89021ddaf1c653467ac839c9225da985e86e16b95fb39a222be509e0478ac9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
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
|
-
<%
|
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.
|
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.
|
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-
|
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
|
+
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-
|
11
|
+
date: 2016-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|