rspec_rails_scaffold_templates 2.9 → 3.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eac43d4dbda7c0184d1530a02e53374a4e68a8819d64ee82f684106e7add14d7
|
4
|
+
data.tar.gz: 895477e980276a655294a1cbcabdea7e38a77bccad9075129ad11a1d9b1165e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ef790015a289fbdcc9b95003ce09520fb49a29d40d9e29b1279474c48af1e808b00e66db7b2752486fcdc4d20776a5141a20d2d14e9cae1a6101de3b006621d
|
7
|
+
data.tar.gz: e777a1104fa6c916a600b2034a3d4dddaccc47953ed46355c032c32b822d0f6298db5905a9b4c6d389068dbea506348ce9aff90a85c66d7e0dd0d56ff0c04ce3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0
|
@@ -61,80 +61,96 @@ describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %> do
|
|
61
61
|
|
62
62
|
<% unless options[:singleton] -%>
|
63
63
|
describe "GET /index" do
|
64
|
+
subject(:get_index) {get <%= index_helper %>_url}
|
65
|
+
|
64
66
|
it "renders a successful response" do
|
65
67
|
<%= class_name %>.create! valid_attributes
|
66
|
-
|
68
|
+
get_index
|
67
69
|
expect(response).to be_successful
|
68
70
|
end
|
69
71
|
end
|
70
72
|
<% end -%>
|
71
73
|
|
72
74
|
describe "GET /show" do
|
75
|
+
subject(:get_show) {get <%= show_helper.sub(/@([^)]+)/, 'id: \1.to_param') %>}
|
76
|
+
|
73
77
|
it "renders a successful response" do
|
74
78
|
<% unless factory_bot -%>
|
75
79
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
76
80
|
<% end -%>
|
77
|
-
|
81
|
+
get_show
|
78
82
|
expect(response).to be_successful
|
79
83
|
end
|
80
84
|
end
|
81
85
|
|
82
86
|
describe "GET /new" do
|
87
|
+
subject(:get_new) {get <%= new_helper %>}
|
88
|
+
|
83
89
|
it "renders a successful response" do
|
84
|
-
|
90
|
+
get_new
|
85
91
|
expect(response).to be_successful
|
86
92
|
end
|
87
93
|
end
|
88
94
|
|
89
95
|
describe "GET /edit" do
|
96
|
+
subject(:get_edit) {get <%= edit_helper.sub(/@([^)]*)/, 'id: \1.to_param') %>}
|
97
|
+
|
90
98
|
it "render a successful response" do
|
91
99
|
<% unless factory_bot -%>
|
92
100
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
93
101
|
<% end -%>
|
94
|
-
|
102
|
+
get_edit
|
95
103
|
expect(response).to be_successful
|
96
104
|
end
|
97
105
|
end
|
98
106
|
|
99
107
|
describe "POST /create" do
|
108
|
+
subject(:post_create) do
|
109
|
+
post <%= index_helper %>_url, params: { <%= ns_file_name %>: attributes }
|
110
|
+
end
|
111
|
+
|
100
112
|
context "with valid parameters" do
|
113
|
+
let(:attributes) {valid_attributes}
|
114
|
+
|
101
115
|
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)
|
116
|
+
expect{post_create}.to change(<%= class_name %>, :count).by(1)
|
105
117
|
end
|
106
118
|
|
107
119
|
it "redirects to the created <%= ns_file_name %>" do
|
108
|
-
|
109
|
-
expect(response).to redirect_to(<%= show_helper.gsub("\@#{file_name}", class_name+".last") %>)
|
120
|
+
post_create
|
121
|
+
expect(response).to redirect_to(<%= show_helper.gsub("\@#{file_name}", 'id: ' + class_name + ".last.to_param") %>)
|
110
122
|
end
|
111
123
|
end
|
112
124
|
|
113
125
|
context "with invalid parameters" do
|
126
|
+
let(:attributes) {invalid_attributes}
|
127
|
+
|
114
128
|
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)
|
129
|
+
expect {post_create}.not_to change(<%= class_name %>, :count)
|
118
130
|
end
|
119
131
|
|
120
132
|
it "renders a successful response (i.e. to display the 'new' template)" do
|
121
|
-
|
133
|
+
post_create
|
122
134
|
expect(response).to be_successful
|
123
135
|
end
|
124
136
|
end
|
125
137
|
end
|
126
138
|
|
127
139
|
describe "PATCH /update" do
|
140
|
+
subject(:patch_update) do
|
141
|
+
patch <%= show_helper.sub(/@([^)]+)/, 'id: \1.to_param') %>, params: { <%= singular_table_name %>: attributes }
|
142
|
+
end
|
143
|
+
|
128
144
|
context "with valid parameters" do
|
129
|
-
let(:
|
145
|
+
let(:attributes) { {<%= attribute_name %>: 'New value'} }
|
130
146
|
|
131
147
|
it "updates the requested <%= ns_file_name %>" do
|
132
148
|
# expect_any_instance_of(<%= class_name %>)
|
133
|
-
# .to receive(:update).with(
|
149
|
+
# .to receive(:update).with(attributes.inject({}){|_, (k, v)| _[k] = v.to_s; _})
|
134
150
|
<% unless factory_bot -%>
|
135
151
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
136
152
|
<% end -%>
|
137
|
-
|
153
|
+
patch_update
|
138
154
|
<%= file_name %>.reload
|
139
155
|
# skip("Add assertions for updated state")
|
140
156
|
expect(<%= file_name %>.<%= attribute_name %>).to eq 'New value'
|
@@ -144,33 +160,35 @@ describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %> do
|
|
144
160
|
<% unless factory_bot -%>
|
145
161
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
146
162
|
<% end -%>
|
147
|
-
|
163
|
+
patch_update
|
148
164
|
<%= file_name %>.reload
|
149
165
|
expect(response).to redirect_to(<%= singular_table_name %>_url(id: <%= file_name %>.to_param))
|
150
166
|
end
|
151
167
|
end
|
152
168
|
|
153
169
|
context "with invalid parameters" do
|
170
|
+
let(:attributes) {invalid_attributes}
|
171
|
+
|
154
172
|
it "renders a successful response (i.e. to display the 'edit' template)" do
|
155
173
|
<% unless factory_bot -%>
|
156
174
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
157
175
|
<% end -%>
|
158
|
-
|
176
|
+
patch_update
|
159
177
|
expect(response).to be_successful
|
160
178
|
end
|
161
179
|
end
|
162
180
|
end
|
163
181
|
|
164
182
|
describe "DELETE /destroy" do
|
183
|
+
subject(:delete_destroy) {delete <%= show_helper.sub(/@([^)]+)/, 'id: \1.to_param') %>}
|
184
|
+
|
165
185
|
it "destroys the requested <%= ns_file_name %>" do
|
166
186
|
<% if factory_bot -%>
|
167
187
|
<%= file_name %>
|
168
188
|
<% else -%>
|
169
189
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
170
190
|
<% end -%>
|
171
|
-
expect {
|
172
|
-
delete <%= show_helper.sub(/@([^)]+)/, 'id: \1.to_param') %>
|
173
|
-
}.to change(<%= class_name %>, :count).by(-1)
|
191
|
+
expect {delete_destroy}.to change(<%= class_name %>, :count).by(-1)
|
174
192
|
end
|
175
193
|
|
176
194
|
it "redirects to the <%= table_name %> list" do
|
@@ -179,7 +197,7 @@ describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %> do
|
|
179
197
|
<% else -%>
|
180
198
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
181
199
|
<% end -%>
|
182
|
-
|
200
|
+
delete_destroy
|
183
201
|
expect(response).to redirect_to(<%= index_helper %>_url)
|
184
202
|
end
|
185
203
|
end
|
@@ -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
|
5
|
+
# stub: rspec_rails_scaffold_templates 3.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "rspec_rails_scaffold_templates".freeze
|
9
|
-
s.version = "
|
9
|
+
s.version = "3.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Dmitri Koulikoff".freeze]
|
14
|
-
s.date = "2020-06-
|
14
|
+
s.date = "2020-06-17"
|
15
15
|
s.description = "RSpec scaffold generator templates that use FactoryGirl and WiceGrid".freeze
|
16
16
|
s.email = "dima@koulikoff.ru".freeze
|
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: '
|
4
|
+
version: '3.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: 2020-06-
|
11
|
+
date: 2020-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|