rspec_rails_scaffold_templates 2.2.1 → 2.9
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 +5 -5
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/rspec_rails_scaffold_templates.rb +2 -0
- data/lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/api_controller_spec.rb +6 -6
- data/lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/controller_spec.rb +6 -6
- data/lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/edit_spec.rb +4 -4
- data/lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/index_spec.rb +14 -12
- data/lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/new_spec.rb +4 -4
- data/lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/request_spec.rb +187 -0
- data/lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/show_spec.rb +5 -5
- data/rspec_rails_scaffold_templates.gemspec +26 -31
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8ec8ea48a6ea7009069519882ce7e773352bd849024ee27fe07b69b107e3d350
|
4
|
+
data.tar.gz: 00f96f62cb04489429c4fc98b8fa84a23762eb583e405b7b707994bf068ad09d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afad47b879090bfef2738163d772a15a4ad9674614be6c94c1881da7b6d0ee16583760f36b57fb7d15e93af427eb5a2fcf1dedfa71ff643e070f4c70cf804aa7
|
7
|
+
data.tar.gz: 257fc01ef8153da000b22f844897bce3944c6ea8037446a038405f308fc82339ed4c717ed6fbe12f154784a28901ef46aec67a5a2e1bf8d73f7dfec52b3dde33
|
data/Rakefile
CHANGED
@@ -21,6 +21,7 @@ Jeweler::Tasks.new do |gem|
|
|
21
21
|
gem.description = %Q{RSpec scaffold generator templates that use FactoryGirl and WiceGrid}
|
22
22
|
gem.email = "dima@koulikoff.ru"
|
23
23
|
gem.authors = ["Dmitri Koulikoff"]
|
24
|
+
gem.version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
24
25
|
# dependencies defined in Gemfile
|
25
26
|
end
|
26
27
|
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.9
|
data/lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/api_controller_spec.rb
CHANGED
@@ -19,14 +19,14 @@ describe Api::<%= options[:api_version].camelcase + '::' if options[:api_version
|
|
19
19
|
<% links = attributes.select{|a| [:belongs_to, :references].include? a.type} -%>
|
20
20
|
<% attribute = (attributes - links).detect{|a| a.name == 'name' || a.name == 'title' || a.name == 'code' || a.name =~ /name/ || a.name =~ /title/} || attributes.first -%>
|
21
21
|
<% attribute_name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name -%>
|
22
|
-
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :
|
23
|
-
<%
|
22
|
+
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_bot -%>
|
23
|
+
<% factory_bot = true -%>
|
24
24
|
let(:<%= file_name %>) {create :<%= file_name %>}
|
25
25
|
|
26
26
|
<% if links.present? -%>
|
27
27
|
let(:valid_attributes) do
|
28
|
-
|
29
|
-
.slice(*%
|
28
|
+
attributes_for(:<%=file_name%>)
|
29
|
+
.slice(*%i[<%= attribute_name %>])
|
30
30
|
.merge(
|
31
31
|
<% links.each do |relation| -%>
|
32
32
|
<%= relation.name %>_id: create(:<%= relation.name %>).id,
|
@@ -34,10 +34,10 @@ describe Api::<%= options[:api_version].camelcase + '::' if options[:api_version
|
|
34
34
|
)
|
35
35
|
end
|
36
36
|
<% else -%>
|
37
|
-
let(:valid_attributes) {
|
37
|
+
let(:valid_attributes) {attributes_for(:<%=file_name%>).slice *%i[<%= attribute_name %>]}
|
38
38
|
<% end -%>
|
39
39
|
<% else -%>
|
40
|
-
<%
|
40
|
+
<% factory_bot = false -%>
|
41
41
|
let(:<%= file_name %>) {<%= class_name %>.create! valid_attributes}
|
42
42
|
|
43
43
|
let(:valid_attributes) do
|
data/lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/controller_spec.rb
CHANGED
@@ -19,14 +19,14 @@ describe <%= controller_class_name %>Controller, <%= type_metatag(:controller) %
|
|
19
19
|
<% links = attributes.select{|a| [:belongs_to, :references].include? a.type} -%>
|
20
20
|
<% attribute = (attributes - links).detect{|a| a.name == 'name' || a.name == 'title' || a.name == 'code' || a.name =~ /name/ || a.name =~ /title/} || attributes.first -%>
|
21
21
|
<% attribute_name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name -%>
|
22
|
-
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :
|
23
|
-
<%
|
22
|
+
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_bot -%>
|
23
|
+
<% factory_bot = true -%>
|
24
24
|
let(:<%= file_name %>) {create :<%= file_name %>}
|
25
25
|
|
26
26
|
<% if links.present? -%>
|
27
27
|
let(:valid_attributes) do
|
28
|
-
|
29
|
-
.slice(*%
|
28
|
+
attributes_for(:<%=file_name%>)
|
29
|
+
.slice(*%i[<%= attribute_name %>])
|
30
30
|
.merge(
|
31
31
|
<% links.each do |relation| -%>
|
32
32
|
<%= relation.name %>_id: create(:<%= relation.name %>).id,
|
@@ -34,10 +34,10 @@ describe <%= controller_class_name %>Controller, <%= type_metatag(:controller) %
|
|
34
34
|
)
|
35
35
|
end
|
36
36
|
<% else -%>
|
37
|
-
let(:valid_attributes) {
|
37
|
+
let(:valid_attributes) {attributes_for(:<%=file_name%>).slice *%i[<%= attribute_name %>]}
|
38
38
|
<% end -%>
|
39
39
|
<% else -%>
|
40
|
-
<%
|
40
|
+
<% factory_bot = false -%>
|
41
41
|
let(:<%= file_name %>) {<%= class_name %>.create! valid_attributes}
|
42
42
|
|
43
43
|
let(:valid_attributes) do
|
@@ -3,15 +3,15 @@ require 'rails_helper'
|
|
3
3
|
<% else -%>
|
4
4
|
require 'spec_helper'
|
5
5
|
<% end -%>
|
6
|
-
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :
|
7
|
-
<%
|
6
|
+
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_bot -%>
|
7
|
+
<% factory_bot = true -%>
|
8
8
|
<% else -%>
|
9
|
-
<%
|
9
|
+
<% factory_bot = false -%>
|
10
10
|
<% end -%>
|
11
11
|
|
12
12
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
|
13
13
|
describe "<%= ns_table_name %>/edit", <%= type_metatag(:view) %> do
|
14
|
-
<% if
|
14
|
+
<% if factory_bot -%>
|
15
15
|
let(:<%= ns_file_name %>) {create :<%= ns_file_name %>}
|
16
16
|
<% else -%>
|
17
17
|
let(:<%= ns_file_name %>) do
|
@@ -3,15 +3,15 @@ require 'rails_helper'
|
|
3
3
|
<% else -%>
|
4
4
|
require 'spec_helper'
|
5
5
|
<% end -%>
|
6
|
-
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :
|
7
|
-
<%
|
6
|
+
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_bot -%>
|
7
|
+
<% factory_bot = true -%>
|
8
8
|
<% else -%>
|
9
|
-
<%
|
9
|
+
<% factory_bot = false -%>
|
10
10
|
<% end -%>
|
11
11
|
|
12
12
|
<% output_attributes = attributes.reject{|attribute| [:created_at, :deleted_at, :updated_at].index(attribute.name) or attribute.password_digest? } -%>
|
13
13
|
describe "<%= ns_table_name %>/index", <%= type_metatag(:view) %> do
|
14
|
-
<% if
|
14
|
+
<% if factory_bot -%>
|
15
15
|
let!(:<%= ns_file_name %>) {create :<%= ns_file_name %>}
|
16
16
|
<% else -%>
|
17
17
|
let!(:<%= ns_file_name %>) do
|
@@ -27,6 +27,8 @@ describe "<%= ns_table_name %>/index", <%= type_metatag(:view) %> do
|
|
27
27
|
<% if Rails.application.config.generators.options[:rails][:cancan] -%>
|
28
28
|
allow(controller).to receive(:can?).and_return(true)
|
29
29
|
<% end -%>
|
30
|
+
allow(controller).to receive(:params)
|
31
|
+
.and_return(ActionController::Parameters.new({}))
|
30
32
|
assign :<%= table_name %>, <%= class_name %>.all
|
31
33
|
end
|
32
34
|
|
@@ -34,14 +36,14 @@ describe "<%= ns_table_name %>/index", <%= type_metatag(:view) %> do
|
|
34
36
|
render
|
35
37
|
|
36
38
|
<% for attribute in output_attributes -%>
|
37
|
-
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :
|
39
|
+
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_bot -%>
|
38
40
|
<% if attribute.reference? -%>
|
39
|
-
assert_select 'tr>td', text: <%= ns_file_name %>.<%= attribute.name %>.name, count: 1
|
41
|
+
assert_select 'tr>td.<%= attribute.name %>', text: <%= ns_file_name %>.<%= attribute.name %>.name, count: 1
|
40
42
|
<% else -%>
|
41
|
-
assert_select 'tr>td', text: <%= ns_file_name %>.<%= attribute.name %>.to_s, count: 1
|
43
|
+
assert_select 'tr>td.<%= attribute.name %>', text: <%= ns_file_name %>.<%= attribute.name %>.to_s, count: 1
|
42
44
|
<% end -%>
|
43
45
|
<% else -%>
|
44
|
-
assert_select "tr>td", text: <%= value_for(attribute) %>.to_s, count: 1
|
46
|
+
assert_select "tr>td.<%= attribute.name %>", text: <%= value_for(attribute) %>.to_s, count: 1
|
45
47
|
<% end -%>
|
46
48
|
<% end -%>
|
47
49
|
end
|
@@ -52,14 +54,14 @@ describe "<%= ns_table_name %>/index", <%= type_metatag(:view) %> do
|
|
52
54
|
render
|
53
55
|
|
54
56
|
<% for attribute in output_attributes -%>
|
55
|
-
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :
|
57
|
+
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_bot -%>
|
56
58
|
<% if attribute.reference? -%>
|
57
|
-
assert_select 'tr>td', text: <%= ns_file_name %>.<%= attribute.name %>.name, count: 1
|
59
|
+
assert_select 'tr>td.<%= attribute.name %>', text: <%= ns_file_name %>.<%= attribute.name %>.name, count: 1
|
58
60
|
<% else -%>
|
59
|
-
assert_select 'tr>td', text: <%= ns_file_name %>.<%= attribute.name %>.to_s, count: 1
|
61
|
+
assert_select 'tr>td.<%= attribute.name %>', text: <%= ns_file_name %>.<%= attribute.name %>.to_s, count: 1
|
60
62
|
<% end -%>
|
61
63
|
<% else -%>
|
62
|
-
assert_select "tr>td", text: <%= value_for(attribute) %>.to_s, count: 1
|
64
|
+
assert_select "tr>td.<%= attribute.name %>", text: <%= value_for(attribute) %>.to_s, count: 1
|
63
65
|
<% end -%>
|
64
66
|
<% end -%>
|
65
67
|
end
|
@@ -3,15 +3,15 @@ require 'rails_helper'
|
|
3
3
|
<% else -%>
|
4
4
|
require 'spec_helper'
|
5
5
|
<% end -%>
|
6
|
-
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :
|
7
|
-
<%
|
6
|
+
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_bot -%>
|
7
|
+
<% factory_bot = true -%>
|
8
8
|
<% else -%>
|
9
|
-
<%
|
9
|
+
<% factory_bot = false -%>
|
10
10
|
<% end -%>
|
11
11
|
|
12
12
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
|
13
13
|
describe "<%= ns_table_name %>/new", <%= type_metatag(:view) %> do
|
14
|
-
<% if
|
14
|
+
<% if factory_bot -%>
|
15
15
|
let(:<%= ns_file_name %>) {build :<%= ns_file_name %>}
|
16
16
|
<% else -%>
|
17
17
|
let(:<%= ns_file_name %>) do
|
@@ -0,0 +1,187 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
4
|
+
# It demonstrates how one might use RSpec to test the controller code that
|
5
|
+
# was generated by Rails when you ran the scaffold generator.
|
6
|
+
#
|
7
|
+
# It assumes that the implementation code is generated by the rails scaffold
|
8
|
+
# generator. If you are using any extension libraries to generate different
|
9
|
+
# controller code, this generated spec may or may not pass.
|
10
|
+
#
|
11
|
+
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
12
|
+
# of tools you can use to make these specs even more expressive, but we're
|
13
|
+
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
14
|
+
|
15
|
+
<% module_namespacing do -%>
|
16
|
+
describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %> do
|
17
|
+
<% if method = Rails.application.config.generators.options[:rails][:cancan] -%>
|
18
|
+
<% method = 'current_user' unless Symbol === method -%>
|
19
|
+
before :each do
|
20
|
+
allow_any_instance_of(<%= controller_class_name %>Controller).to receive(:<%=method%>)
|
21
|
+
.and_return(<%=method%>)
|
22
|
+
end
|
23
|
+
|
24
|
+
<% end -%>
|
25
|
+
# This should return the minimal set of attributes required to create a valid
|
26
|
+
# <%= class_name %>. As you add validations to <%= class_name %>, be sure to
|
27
|
+
# adjust the attributes here as well. The list could not be empty.
|
28
|
+
<% links = attributes.select{|a| [:belongs_to, :references].include? a.type} -%>
|
29
|
+
<% attribute = (attributes - links).detect{|a| a.name == 'name' || a.name == 'title' || a.name == 'code' || a.name =~ /name/ || a.name =~ /title/} || attributes.first -%>
|
30
|
+
<% attribute_name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name -%>
|
31
|
+
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_bot -%>
|
32
|
+
<% factory_bot = true -%>
|
33
|
+
let(:<%= file_name %>) {create :<%= file_name %>}
|
34
|
+
|
35
|
+
<% if links.present? -%>
|
36
|
+
let(:valid_attributes) do
|
37
|
+
attributes_for(:<%=file_name%>)
|
38
|
+
.slice(*%i[<%= attribute_name %>])
|
39
|
+
.merge(
|
40
|
+
<% links.each do |relation| -%>
|
41
|
+
<%= relation.name %>_id: create(:<%= relation.name %>).id,
|
42
|
+
<% end -%>
|
43
|
+
)
|
44
|
+
end
|
45
|
+
<% else -%>
|
46
|
+
let(:valid_attributes) {attributes_for(:<%=file_name%>).slice *%i[<%= attribute_name %>]}
|
47
|
+
<% end -%>
|
48
|
+
<% else -%>
|
49
|
+
<% factory_bot = false -%>
|
50
|
+
let(:<%= file_name %>) {<%= class_name %>.create! valid_attributes}
|
51
|
+
|
52
|
+
let(:valid_attributes) do
|
53
|
+
skip("Add a hash of attributes valid for your model")
|
54
|
+
end
|
55
|
+
<% end -%>
|
56
|
+
|
57
|
+
let(:invalid_attributes) do
|
58
|
+
# {<%= attribute_name %>: ''}
|
59
|
+
skip("Add a hash of attributes invalid for your model")
|
60
|
+
end
|
61
|
+
|
62
|
+
<% unless options[:singleton] -%>
|
63
|
+
describe "GET /index" do
|
64
|
+
it "renders a successful response" do
|
65
|
+
<%= class_name %>.create! valid_attributes
|
66
|
+
get <%= index_helper %>_url
|
67
|
+
expect(response).to be_successful
|
68
|
+
end
|
69
|
+
end
|
70
|
+
<% end -%>
|
71
|
+
|
72
|
+
describe "GET /show" do
|
73
|
+
it "renders a successful response" do
|
74
|
+
<% unless factory_bot -%>
|
75
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
76
|
+
<% end -%>
|
77
|
+
get <%= show_helper.sub(/@([^)]+)/, 'id: \1.to_param') %>
|
78
|
+
expect(response).to be_successful
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "GET /new" do
|
83
|
+
it "renders a successful response" do
|
84
|
+
get <%= new_helper %>
|
85
|
+
expect(response).to be_successful
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "GET /edit" do
|
90
|
+
it "render a successful response" do
|
91
|
+
<% unless factory_bot -%>
|
92
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
93
|
+
<% end -%>
|
94
|
+
get <%= edit_helper.tr('@','id: ') %>
|
95
|
+
expect(response).to be_successful
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "POST /create" do
|
100
|
+
context "with valid parameters" do
|
101
|
+
it "creates a new <%= class_name %>" do
|
102
|
+
expect {
|
103
|
+
post <%= index_helper %>_url, params: { <%= ns_file_name %>: valid_attributes }
|
104
|
+
}.to change(<%= class_name %>, :count).by(1)
|
105
|
+
end
|
106
|
+
|
107
|
+
it "redirects to the created <%= ns_file_name %>" do
|
108
|
+
post <%= index_helper %>_url, params: { <%= ns_file_name %>: valid_attributes }
|
109
|
+
expect(response).to redirect_to(<%= show_helper.gsub("\@#{file_name}", class_name+".last") %>)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "with invalid parameters" do
|
114
|
+
it "does not create a new <%= class_name %>" do
|
115
|
+
expect {
|
116
|
+
post <%= index_helper %>_url, params: { <%= ns_file_name %>: invalid_attributes }
|
117
|
+
}.to change(<%= class_name %>, :count).by(0)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "renders a successful response (i.e. to display the 'new' template)" do
|
121
|
+
post <%= index_helper %>_url, params: { <%= ns_file_name %>: invalid_attributes }
|
122
|
+
expect(response).to be_successful
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe "PATCH /update" do
|
128
|
+
context "with valid parameters" do
|
129
|
+
let(:new_attributes) { {<%= attribute_name %>: 'New value'} }
|
130
|
+
|
131
|
+
it "updates the requested <%= ns_file_name %>" do
|
132
|
+
# expect_any_instance_of(<%= class_name %>)
|
133
|
+
# .to receive(:update).with(new_attributes.inject({}){|_, (k, v)| _[k] = v.to_s; _})
|
134
|
+
<% unless factory_bot -%>
|
135
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
136
|
+
<% end -%>
|
137
|
+
patch <%= show_helper.sub(/@([^)]+)/, 'id: \1.to_param') %>, params: { <%= singular_table_name %>: new_attributes }
|
138
|
+
<%= file_name %>.reload
|
139
|
+
# skip("Add assertions for updated state")
|
140
|
+
expect(<%= file_name %>.<%= attribute_name %>).to eq 'New value'
|
141
|
+
end
|
142
|
+
|
143
|
+
it "redirects to the <%= ns_file_name %>" do
|
144
|
+
<% unless factory_bot -%>
|
145
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
146
|
+
<% end -%>
|
147
|
+
patch <%= show_helper.sub(/@([^)]+)/, 'id: \1.to_param') %>, params: { <%= singular_table_name %>: new_attributes }
|
148
|
+
<%= file_name %>.reload
|
149
|
+
expect(response).to redirect_to(<%= singular_table_name %>_url(id: <%= file_name %>.to_param))
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
context "with invalid parameters" do
|
154
|
+
it "renders a successful response (i.e. to display the 'edit' template)" do
|
155
|
+
<% unless factory_bot -%>
|
156
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
157
|
+
<% end -%>
|
158
|
+
patch <%= show_helper.sub(/@([^)]+)/, 'id: \1.to_param') %>, params: { <%= singular_table_name %>: invalid_attributes }
|
159
|
+
expect(response).to be_successful
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
describe "DELETE /destroy" do
|
165
|
+
it "destroys the requested <%= ns_file_name %>" do
|
166
|
+
<% if factory_bot -%>
|
167
|
+
<%= file_name %>
|
168
|
+
<% else -%>
|
169
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
170
|
+
<% end -%>
|
171
|
+
expect {
|
172
|
+
delete <%= show_helper.sub(/@([^)]+)/, 'id: \1.to_param') %>
|
173
|
+
}.to change(<%= class_name %>, :count).by(-1)
|
174
|
+
end
|
175
|
+
|
176
|
+
it "redirects to the <%= table_name %> list" do
|
177
|
+
<% if factory_bot -%>
|
178
|
+
<%= file_name %>
|
179
|
+
<% else -%>
|
180
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
181
|
+
<% end -%>
|
182
|
+
delete <%= show_helper.sub(/@([^)]+)/, 'id: \1.to_param') %>
|
183
|
+
expect(response).to redirect_to(<%= index_helper %>_url)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
<% end -%>
|
@@ -6,7 +6,7 @@ require 'spec_helper'
|
|
6
6
|
|
7
7
|
<% output_attributes = attributes.reject{|attribute| [:created_at, :deleted_at, :updated_at].index(attribute.name) or attribute.password_digest? } -%>
|
8
8
|
describe "<%= ns_table_name %>/show", <%= type_metatag(:view) %> do
|
9
|
-
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :
|
9
|
+
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_bot -%>
|
10
10
|
let(:<%= ns_file_name %>) {create :<%= ns_file_name %>}
|
11
11
|
<% else -%>
|
12
12
|
let(:<%= ns_file_name %>) do
|
@@ -30,14 +30,14 @@ describe "<%= ns_table_name %>/show", <%= type_metatag(:view) %> do
|
|
30
30
|
it "renders attributes in dl>dd" do
|
31
31
|
render
|
32
32
|
<% for attribute in output_attributes -%>
|
33
|
-
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :
|
33
|
+
<% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_bot -%>
|
34
34
|
<% if attribute.reference? -%>
|
35
|
-
assert_select 'dl>dd', text: Regexp.new(<%= ns_file_name %>.<%= attribute.name %>.name)
|
35
|
+
assert_select 'dl>dd.<%= attribute.name %>', text: Regexp.new(<%= ns_file_name %>.<%= attribute.name %>.name)
|
36
36
|
<% else -%>
|
37
|
-
assert_select 'dl>dd', text: Regexp.new(<%= ns_file_name %>.<%= attribute.name %>.to_s)
|
37
|
+
assert_select 'dl>dd.<%= attribute.name %>', text: Regexp.new(<%= ns_file_name %>.<%= attribute.name %>.to_s)
|
38
38
|
<% end -%>
|
39
39
|
<% else -%>
|
40
|
-
assert_select 'dl>dd', text: <%= value_for(attribute) %>
|
40
|
+
assert_select 'dl>dd.<%= attribute.name %>', text: <%= value_for(attribute) %>
|
41
41
|
<% end -%>
|
42
42
|
<% end -%>
|
43
43
|
end
|
@@ -2,18 +2,18 @@
|
|
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 2.
|
5
|
+
# stub: rspec_rails_scaffold_templates 2.9 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name = "rspec_rails_scaffold_templates"
|
9
|
-
s.version = "2.
|
8
|
+
s.name = "rspec_rails_scaffold_templates".freeze
|
9
|
+
s.version = "2.9"
|
10
10
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
|
-
s.authors = ["Dmitri Koulikoff"]
|
14
|
-
s.date = "
|
15
|
-
s.description = "RSpec scaffold generator templates that use FactoryGirl and WiceGrid"
|
16
|
-
s.email = "dima@koulikoff.ru"
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib".freeze]
|
13
|
+
s.authors = ["Dmitri Koulikoff".freeze]
|
14
|
+
s.date = "2020-06-05"
|
15
|
+
s.description = "RSpec scaffold generator templates that use FactoryGirl and WiceGrid".freeze
|
16
|
+
s.email = "dima@koulikoff.ru".freeze
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE.txt",
|
19
19
|
"README.rdoc"
|
@@ -35,38 +35,33 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/edit_spec.rb",
|
36
36
|
"lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/index_spec.rb",
|
37
37
|
"lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/new_spec.rb",
|
38
|
+
"lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/request_spec.rb",
|
38
39
|
"lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/show_spec.rb",
|
39
40
|
"rspec_rails_scaffold_templates.gemspec",
|
40
41
|
"spec/rspec_rails_scaffold_templates_spec.rb",
|
41
42
|
"spec/spec_helper.rb"
|
42
43
|
]
|
43
|
-
s.homepage = "http://github.com/dima4p/rspec_rails_scaffold_templates"
|
44
|
-
s.licenses = ["MIT"]
|
45
|
-
s.rubygems_version = "
|
46
|
-
s.summary = "RSpec scaffold generator templates that use FactoryGirl and WiceGrid"
|
44
|
+
s.homepage = "http://github.com/dima4p/rspec_rails_scaffold_templates".freeze
|
45
|
+
s.licenses = ["MIT".freeze]
|
46
|
+
s.rubygems_version = "3.1.2".freeze
|
47
|
+
s.summary = "RSpec scaffold generator templates that use FactoryGirl and WiceGrid".freeze
|
47
48
|
|
48
49
|
if s.respond_to? :specification_version then
|
49
50
|
s.specification_version = 4
|
51
|
+
end
|
50
52
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
else
|
58
|
-
s.add_dependency(%q<rspec>, ["~> 3.1"])
|
59
|
-
s.add_dependency(%q<rdoc>, ["~> 4.1"])
|
60
|
-
s.add_dependency(%q<bundler>, ["~> 1.6"])
|
61
|
-
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
62
|
-
s.add_dependency(%q<simplecov>, ["~> 0.0"])
|
63
|
-
end
|
53
|
+
if s.respond_to? :add_runtime_dependency then
|
54
|
+
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.1"])
|
55
|
+
s.add_development_dependency(%q<rdoc>.freeze, ["~> 4.1"])
|
56
|
+
s.add_development_dependency(%q<bundler>.freeze, ["~> 1.6"])
|
57
|
+
s.add_development_dependency(%q<jeweler>.freeze, ["~> 2.0"])
|
58
|
+
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.0"])
|
64
59
|
else
|
65
|
-
s.add_dependency(%q<rspec
|
66
|
-
s.add_dependency(%q<rdoc
|
67
|
-
s.add_dependency(%q<bundler
|
68
|
-
s.add_dependency(%q<jeweler
|
69
|
-
s.add_dependency(%q<simplecov
|
60
|
+
s.add_dependency(%q<rspec>.freeze, ["~> 3.1"])
|
61
|
+
s.add_dependency(%q<rdoc>.freeze, ["~> 4.1"])
|
62
|
+
s.add_dependency(%q<bundler>.freeze, ["~> 1.6"])
|
63
|
+
s.add_dependency(%q<jeweler>.freeze, ["~> 2.0"])
|
64
|
+
s.add_dependency(%q<simplecov>.freeze, ["~> 0.0"])
|
70
65
|
end
|
71
66
|
end
|
72
67
|
|
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: 2.
|
4
|
+
version: '2.9'
|
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: 2020-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/edit_spec.rb
|
105
105
|
- lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/index_spec.rb
|
106
106
|
- lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/new_spec.rb
|
107
|
+
- lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/request_spec.rb
|
107
108
|
- lib/rspec_rails_scaffold_templates/generators/templates/rspec/scaffold/show_spec.rb
|
108
109
|
- rspec_rails_scaffold_templates.gemspec
|
109
110
|
- spec/rspec_rails_scaffold_templates_spec.rb
|
@@ -127,8 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
128
|
- !ruby/object:Gem::Version
|
128
129
|
version: '0'
|
129
130
|
requirements: []
|
130
|
-
|
131
|
-
rubygems_version: 2.5.1
|
131
|
+
rubygems_version: 3.1.2
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: RSpec scaffold generator templates that use FactoryGirl and WiceGrid
|