jbuilder_rspec_generator 1.0.7 → 1.0.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a87a65e40eabc8830a70cd6ec3ed277f3e0e1b0f
|
4
|
+
data.tar.gz: 8329579648998affcafbe53e130008f05097abfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d20fa83bc49f17a15014ec838055e68284906a69a2c44d28a354a0d9acf2ccbdd85564180f2a88bcb345017c446c7c790a649ebc93edd25ad34a48d1758c3164
|
7
|
+
data.tar.gz: 9866264f6406ace3a0db5678b6634d6e27f44adc191acc12d0ac830fd4db8afd5af42a6c75bd66afb2996e882a2b454d0cd8171337eca3a1c672a23bc360abe8
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.8
|
@@ -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: jbuilder_rspec_generator 1.0.
|
5
|
+
# stub: jbuilder_rspec_generator 1.0.8 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "jbuilder_rspec_generator"
|
9
|
-
s.version = "1.0.
|
9
|
+
s.version = "1.0.8"
|
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 = "
|
14
|
+
s.date = "2015-02-24"
|
15
15
|
s.description = "Generates RSpecs for jbuilder templates"
|
16
16
|
s.email = "dima@koulikoff.ru"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
]
|
37
37
|
s.homepage = "http://github.com/dima4p/jbuilder_rspec_generator"
|
38
38
|
s.licenses = ["MIT"]
|
39
|
-
s.rubygems_version = "2.
|
39
|
+
s.rubygems_version = "2.4.5"
|
40
40
|
s.summary = "RSpecs for jbuilder templates"
|
41
41
|
|
42
42
|
if s.respond_to? :specification_version then
|
@@ -4,15 +4,16 @@ require 'rails_helper'
|
|
4
4
|
require 'spec_helper'
|
5
5
|
<% end -%>
|
6
6
|
|
7
|
+
<% open_attributes = attributes.reject(&:password_digest?) -%>
|
7
8
|
describe "<%= ns_table_name %>/index.json.jbuilder", type: :view do
|
8
9
|
before(:each) do
|
9
10
|
allow(controller).to receive(:can?).and_return(true)
|
10
11
|
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_girl -%>
|
11
12
|
@<%= ns_file_name %> = create(:<%= ns_file_name %>)
|
12
13
|
<% else -%>
|
13
|
-
@<%= ns_file_name %> = <%= class_name %>.create(<%=
|
14
|
-
<%
|
15
|
-
:<%= attribute.name %> => <%= value_for(attribute) %><%= attribute_index ==
|
14
|
+
@<%= ns_file_name %> = <%= class_name %>.create(<%= open_attributes.empty? ? ')' : '' %>
|
15
|
+
<% open_attributes.each_with_index do |attribute, attribute_index| -%>
|
16
|
+
:<%= attribute.name %> => <%= value_for(attribute) %><%= attribute_index == open_attributes.length - 1 ? '' : ','%>
|
16
17
|
<% end -%>
|
17
18
|
)
|
18
19
|
<% end -%>
|
@@ -21,7 +22,7 @@ describe "<%= ns_table_name %>/index.json.jbuilder", type: :view do
|
|
21
22
|
|
22
23
|
attributes = %w[
|
23
24
|
id
|
24
|
-
<% for attribute in
|
25
|
+
<% for attribute in open_attributes -%>
|
25
26
|
<%= attribute.name %>
|
26
27
|
<% end -%>
|
27
28
|
url
|
@@ -38,7 +39,7 @@ describe "<%= ns_table_name %>/index.json.jbuilder", type: :view do
|
|
38
39
|
expected['url'] = <%= ns_file_name %>_url(@<%= ns_file_name %>, format: 'json')
|
39
40
|
expect(hash).to eq expected
|
40
41
|
# expect(hash['id']).to eq @<%= ns_file_name %>.id.to_s
|
41
|
-
<% for attribute in
|
42
|
+
<% for attribute in open_attributes -%>
|
42
43
|
# expect(hash['<%= attribute.name %>']).to eq @<%= ns_file_name %>.<%= attribute.name %>.to_s
|
43
44
|
<% end -%>
|
44
45
|
# expect(hash['url']).to eq <%= ns_file_name %>_url(@<%= ns_file_name %>, format: 'json')
|
@@ -4,17 +4,18 @@ require 'rails_helper'
|
|
4
4
|
require 'spec_helper'
|
5
5
|
<% end -%>
|
6
6
|
|
7
|
+
<% open_attributes = attributes.reject(&:password_digest?) -%>
|
7
8
|
describe "<%= ns_table_name %>/show.json.jbuilder", type: :view do
|
8
9
|
before(:each) do
|
9
10
|
allow(controller).to receive(:can?).and_return(true)
|
10
11
|
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_girl -%>
|
11
12
|
@<%= ns_file_name %> = assign(:<%= ns_file_name %>, create(:<%= ns_file_name %>))
|
12
13
|
<% else -%>
|
13
|
-
@<%= ns_file_name %> = assign(:<%= ns_file_name %>, <%= class_name %>.create(<%=
|
14
|
-
<%
|
15
|
-
:<%= attribute.name %> => <%= value_for(attribute) %><%= attribute_index ==
|
14
|
+
@<%= ns_file_name %> = assign(:<%= ns_file_name %>, <%= class_name %>.create(<%= open_attributes.empty? ? '))' : '' %>
|
15
|
+
<% open_attributes.each_with_index do |attribute, attribute_index| -%>
|
16
|
+
:<%= attribute.name %> => <%= value_for(attribute) %><%= attribute_index == open_attributes.length - 1 ? '' : ','%>
|
16
17
|
<% end -%>
|
17
|
-
<% if !
|
18
|
+
<% if !open_attributes.empty? -%>
|
18
19
|
))
|
19
20
|
<% end -%>
|
20
21
|
<% end -%>
|
@@ -22,7 +23,7 @@ describe "<%= ns_table_name %>/show.json.jbuilder", type: :view do
|
|
22
23
|
|
23
24
|
attributes = %w[
|
24
25
|
id
|
25
|
-
<% for attribute in
|
26
|
+
<% for attribute in open_attributes -%>
|
26
27
|
<%= attribute.name %>
|
27
28
|
<% end -%>
|
28
29
|
created_at
|
@@ -38,7 +39,7 @@ describe "<%= ns_table_name %>/show.json.jbuilder", type: :view do
|
|
38
39
|
expected = MultiJson.load MultiJson.dump expected
|
39
40
|
expect(hash).to eq expected
|
40
41
|
# expect(hash['id']).to eq @<%= ns_file_name %>.id.to_s
|
41
|
-
<% for attribute in
|
42
|
+
<% for attribute in open_attributes -%>
|
42
43
|
# expect(hash['<%= attribute.name %>']).to eq @<%= ns_file_name %>.<%= attribute.name %>.to_s
|
43
44
|
<% end -%>
|
44
45
|
# expect(hash['created_at']).to eq @<%= ns_file_name %>.created_at.to_s
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jbuilder_rspec_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitri Koulikoff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.4.5
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: RSpecs for jbuilder templates
|