edgarj 0.02.00 → 4.00.01
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.rdoc +8 -2
- data/Rakefile +3 -9
- data/app/views/edgarj/popup/_message_popup.html.erb +1 -0
- data/app/views/edgarj/popup/message_popup.js.erb +1 -0
- data/lib/edgarj.rb +2 -2
- data/lib/edgarj/engine.rb +4 -6
- data/lib/edgarj/version.rb +1 -1
- data/lib/tasks/edgarj_tasks.rake +4 -32
- data/lib/tasks/{pakcage.rake → package.rake} +1 -1
- data/test/{functional → controllers}/edgarj/edgarj_controller_test.rb +0 -0
- data/test/{functional → controllers}/edgarj/model_permissions_controller_test.rb +0 -0
- data/test/{functional → controllers}/edgarj/user_group_users_controller_test.rb +0 -0
- data/test/dummy/app/models/user.rb +0 -2
- data/test/dummy/config.ru +1 -1
- data/test/dummy/config/application.rb +0 -36
- data/test/dummy/config/boot.rb +4 -9
- data/test/dummy/config/database.yml +8 -8
- data/test/dummy/config/environments/development.rb +7 -17
- data/test/dummy/config/environments/production.rb +2 -1
- data/test/dummy/config/environments/test.rb +7 -2
- data/test/dummy/config/initializers/config.rb +3 -0
- data/test/dummy/config/initializers/secret_token.rb +1 -1
- data/test/dummy/config/settings/development.yml +0 -0
- data/test/dummy/config/settings/production.yml +0 -0
- data/test/dummy/config/settings/test.yml +0 -0
- data/test/dummy/db/schema.rb +34 -34
- data/test/dummy/test/{functional → controllers}/authors_controller_test.rb +0 -0
- data/test/dummy/test/{functional → controllers}/authors_popup_controller_test.rb +0 -0
- data/test/dummy/test/{functional → controllers}/books_controller_test.rb +0 -0
- data/test/dummy/test/{unit → models}/author_test.rb +0 -0
- data/test/dummy/test/{unit → models}/book_test.rb +0 -0
- data/test/dummy/test/{unit → models}/rails_config_test.rb +0 -0
- data/test/{edgar_test.rb → edgarj_test.rb} +0 -0
- data/test/fixtures/edgarj/model_permissions.yml +14 -14
- data/test/fixtures/edgarj/page_infos.yml +3 -3
- data/test/{unit → models}/edgarj/model_permission_test.rb +0 -0
- data/test/{unit → models}/edgarj/page_info_test.rb +0 -0
- data/test/{unit → models}/edgarj/sssn_test.rb +1 -1
- data/test/{unit → models}/edgarj/user_group_test.rb +0 -0
- data/test/{unit → models}/edgarj/user_group_user_test.rb +0 -0
- data/test/{unit → models}/helpers/edgarj/model_permissions_helper_test.rb +0 -0
- data/test/{unit → models}/helpers/edgarj/user_group_users_helper_test.rb +0 -0
- data/test/test_helper.rb +3 -3
- metadata +115 -154
- data/app/views/edgarj/popup/_message_popup.html.erb +0 -15
- data/app/views/edgarj/popup/message_popup.js.erb +0 -3
- data/lib/core_ext/rails_config.rb +0 -10
- data/lib/edgarj/templates/rails/helper/helper.rb +0 -10
- data/lib/edgarj/templates/test_unit/scaffold/functional_test.rb +0 -575
- data/lib/generators/edgarj/popup_scaffold/USAGE +0 -6
- data/lib/generators/edgarj/popup_scaffold/popup_scaffold_generator.rb +0 -35
- data/lib/generators/edgarj/popup_scaffold/templates/controller.rb +0 -13
- data/lib/generators/edgarj/popup_scaffold/templates/functional_test.rb +0 -207
- data/lib/generators/edgarj/popup_scaffold/templates/helper.rb +0 -9
- data/lib/generators/edgarj/scaffold/USAGE +0 -17
- data/lib/generators/edgarj/scaffold/scaffold_generator.rb +0 -40
- data/lib/generators/edgarj/scaffold/templates/controller.rb +0 -13
- data/test/dummy/config/initializers/strong_parameter.rb +0 -3
- data/test/dummy/script/rails +0 -6
@@ -1,15 +0,0 @@
|
|
1
|
-
<!-- edgarj/_message_popup.html.erb -->
|
2
|
-
<%#
|
3
|
-
message popup template.
|
4
|
-
%>
|
5
|
-
|
6
|
-
<center>
|
7
|
-
<div id=edgarj_message_error ><%= flash[:error] || '' %></div>
|
8
|
-
<div id=edgarj_message_notice><%= flash[:notice] || '' %></div>
|
9
|
-
<hr>
|
10
|
-
<%= button_tag t('close'),
|
11
|
-
type: 'button',
|
12
|
-
id: 'edgarj_message_popup_close',
|
13
|
-
onClick: "$('#edgarj_message_popup').dialog('close');"
|
14
|
-
%>
|
15
|
-
</center>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<% model_name = class_name.singularize -%>
|
2
|
-
<% module_namespacing do -%>
|
3
|
-
module <%= class_name %>Helper
|
4
|
-
class <%= model_name %>Drawer < Edgarj::Drawer::Normal
|
5
|
-
def initialize(view_context, params, page_info, model_class = <%= model_name %>)
|
6
|
-
super
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
<% end -%>
|
@@ -1,575 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
<% module_namespacing do -%>
|
4
|
-
# Edgarj chooses traditional testing framework(TestUnit) with
|
5
|
-
# shoulda-context and fixture rather than rspec.
|
6
|
-
#
|
7
|
-
# EdgarjController assumes authentication, model_permission, and
|
8
|
-
# user_scoped so that functional test should cover the following
|
9
|
-
# combinations:
|
10
|
-
#
|
11
|
-
# 1. methods for CRUD, clear, search, search_clear, search_save, search_load,
|
12
|
-
# csv_download, and file_download.
|
13
|
-
# 2. authenticated or not.
|
14
|
-
# 3. User has enough role (model_permission) or not.
|
15
|
-
# 4. User is in user_scoped or not.
|
16
|
-
#
|
17
|
-
# This edgarj:scaffold generated functional test just covers 1 and 2 above
|
18
|
-
# because 3 and 4 require to prepare fixtures. For the latter cases,
|
19
|
-
# skipping tests are provided.
|
20
|
-
#
|
21
|
-
# Please read the file below as a reference:
|
22
|
-
#
|
23
|
-
# edgarj/test/dummy/test/functional/authors_controller_test.rb
|
24
|
-
#
|
25
|
-
class <%= controller_class_name %>ControllerTest < ActionController::TestCase
|
26
|
-
context 'root user' do
|
27
|
-
setup do
|
28
|
-
login_as(:root)
|
29
|
-
@<%= singular_table_name %> = <%= table_name %>(:one)
|
30
|
-
@pi = create_page_info(@sssn, '<%= table_name %>', <%= class_name %>)
|
31
|
-
end
|
32
|
-
|
33
|
-
should 'get index' do
|
34
|
-
get :index
|
35
|
-
assert_response :success
|
36
|
-
assert_not_nil assigns(:list)
|
37
|
-
end
|
38
|
-
|
39
|
-
should 'paginate' do
|
40
|
-
xhr :get, :index, page: 2
|
41
|
-
assert_response :success
|
42
|
-
assert_not_nil assigns(:list)
|
43
|
-
end
|
44
|
-
|
45
|
-
should 'sort' do
|
46
|
-
xhr :put, :page_info_save,
|
47
|
-
id: @pi.id,
|
48
|
-
edgarj_page_info: {
|
49
|
-
dir: 'asc',
|
50
|
-
order_by: 'created_at'
|
51
|
-
}
|
52
|
-
assert_response :success
|
53
|
-
assert_not_nil assigns(:list)
|
54
|
-
assert_equal 'asc', assigns(:page_info).dir
|
55
|
-
assert_equal 'created_at', assigns(:page_info).order_by
|
56
|
-
end
|
57
|
-
|
58
|
-
should 'create <%= singular_table_name %>' do
|
59
|
-
assert_difference('<%= class_name %>.count') do
|
60
|
-
xhr :post, :create, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
61
|
-
end
|
62
|
-
assert_response :success
|
63
|
-
assert assigns(:record)
|
64
|
-
end
|
65
|
-
|
66
|
-
should 'not create invalid <%= singular_table_name %>' do
|
67
|
-
skip 'not create invalid <%= singular_table_name %>'
|
68
|
-
assert_no_difference('<%= class_name %>.count') do
|
69
|
-
#xhr :post, :create, invalid resource attributes...
|
70
|
-
end
|
71
|
-
assert_response :success
|
72
|
-
assert assigns(:record)
|
73
|
-
end
|
74
|
-
|
75
|
-
should 'show <%= singular_table_name %> in HTML' do
|
76
|
-
get :show, id: <%= "@#{singular_table_name}" %>
|
77
|
-
assert_response :success
|
78
|
-
assert_not_nil assigns(:record)
|
79
|
-
end
|
80
|
-
|
81
|
-
should 'show <%= singular_table_name %> in JS' do
|
82
|
-
xhr :get, :show, id: <%= "@#{singular_table_name}" %>
|
83
|
-
assert_response :success
|
84
|
-
assert_not_nil assigns(:record)
|
85
|
-
end
|
86
|
-
|
87
|
-
should 'update <%= singular_table_name %>' do
|
88
|
-
xhr :put, :update, id: <%= "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
89
|
-
assert_response :success
|
90
|
-
assert assigns(:record)
|
91
|
-
end
|
92
|
-
|
93
|
-
should 'destroy <%= singular_table_name %>' do
|
94
|
-
assert_difference('<%= class_name %>.count', -1) do
|
95
|
-
xhr :delete, :destroy, id: <%= "@#{singular_table_name}" %>
|
96
|
-
end
|
97
|
-
assert_response :success
|
98
|
-
assert assigns(:record)
|
99
|
-
assert assigns(:list)
|
100
|
-
end
|
101
|
-
|
102
|
-
should 'clear <%= singular_table_name %>' do
|
103
|
-
assert_no_difference('<%= class_name %>.count') do
|
104
|
-
xhr :get, :clear
|
105
|
-
end
|
106
|
-
assert_response :success
|
107
|
-
assert_not_nil assigns(:record)
|
108
|
-
end
|
109
|
-
|
110
|
-
should 'csv_download <%= table_name %>' do
|
111
|
-
get :csv_download
|
112
|
-
assert_response :success
|
113
|
-
end
|
114
|
-
|
115
|
-
should 'search' do
|
116
|
-
xhr :get, :search, edgarj_search_form: {}
|
117
|
-
assert_response :success
|
118
|
-
assert assigns(:list).count >= 1
|
119
|
-
end
|
120
|
-
|
121
|
-
should 'search_clear <%= singular_table_name %>' do
|
122
|
-
xhr :get, :search_clear
|
123
|
-
assert_response :success
|
124
|
-
end
|
125
|
-
|
126
|
-
should 'search_save <%= singular_table_name %>' do
|
127
|
-
skip 'search_save'
|
128
|
-
end
|
129
|
-
|
130
|
-
should 'search_load <%= singular_table_name %>' do
|
131
|
-
skip 'search_load'
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
# All of tests in this context is skipped because it is required
|
136
|
-
# to prepare read-only user.
|
137
|
-
# When complete the preparation, delete the skip lines.
|
138
|
-
context 'read-only user' do
|
139
|
-
setup do
|
140
|
-
# prepare fixtures of model_permissions, user_groups, and
|
141
|
-
# user_group_users for read-only user of the
|
142
|
-
# <%= controller_class_name %>Controller and login by him/her.
|
143
|
-
#
|
144
|
-
login_as(:<%= singular_table_name %>_reader)
|
145
|
-
@pi = create_page_info(@sssn, '<%= table_name %>', <%= class_name %>)
|
146
|
-
end
|
147
|
-
|
148
|
-
should 'get index' do
|
149
|
-
skip 'get index'
|
150
|
-
get :index
|
151
|
-
assert_response :success
|
152
|
-
assert_not_nil assigns(:list)
|
153
|
-
end
|
154
|
-
|
155
|
-
should 'paginate' do
|
156
|
-
skip 'paginate'
|
157
|
-
xhr :get, :index, page: 2
|
158
|
-
assert_response :success
|
159
|
-
assert_not_nil assigns(:list)
|
160
|
-
end
|
161
|
-
|
162
|
-
should 'sort' do
|
163
|
-
skip 'sort'
|
164
|
-
xhr :put, :page_info_save,
|
165
|
-
id: @pi.id,
|
166
|
-
edgarj_page_info: {
|
167
|
-
dir: 'asc',
|
168
|
-
order_by: 'created_at'
|
169
|
-
}
|
170
|
-
assert_response :success
|
171
|
-
assert_not_nil assigns(:list)
|
172
|
-
assert_equal 'asc', assigns(:page_info).dir
|
173
|
-
assert_equal 'created_at', assigns(:page_info).order_by
|
174
|
-
end
|
175
|
-
|
176
|
-
should 'not create <%= singular_table_name %>' do
|
177
|
-
skip 'not create <%= singular_table_name %>'
|
178
|
-
assert_no_difference('<%= class_name %>.count') do
|
179
|
-
xhr :post, :create, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
180
|
-
end
|
181
|
-
assert_template 'message_popup'
|
182
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
183
|
-
end
|
184
|
-
|
185
|
-
should 'not create invalid <%= singular_table_name %>' do
|
186
|
-
skip 'not create invalid <%= singular_table_name %>'
|
187
|
-
assert_no_difference('<%= class_name %>.count') do
|
188
|
-
#xhr :post, :create, invalid resource attributes...
|
189
|
-
end
|
190
|
-
assert_template 'message_popup'
|
191
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
192
|
-
end
|
193
|
-
|
194
|
-
should 'show <%= singular_table_name %> in HTML' do
|
195
|
-
skip 'show <%= singular_table_name %> in HTML'
|
196
|
-
get :show, id: <%= "@#{singular_table_name}" %>
|
197
|
-
assert_response :success
|
198
|
-
assert_not_nil assigns(:record)
|
199
|
-
end
|
200
|
-
|
201
|
-
should 'show <%= singular_table_name %> in JS' do
|
202
|
-
skip 'show <%= singular_table_name %> in JS'
|
203
|
-
xhr :get, :show, id: <%= "@#{singular_table_name}" %>
|
204
|
-
assert_response :success
|
205
|
-
assert_not_nil assigns(:record)
|
206
|
-
end
|
207
|
-
|
208
|
-
should 'not update <%= singular_table_name %>' do
|
209
|
-
skip 'not update <%= singular_table_name %>'
|
210
|
-
xhr :put, :update, id: <%= "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
211
|
-
assert_template 'message_popup'
|
212
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
213
|
-
old_<%= singular_table_name %> = @<%= singular_table_name %>
|
214
|
-
assert_equal(
|
215
|
-
old_<%= singular_table_name %>,
|
216
|
-
@<%= singular_table_name %>.reload)
|
217
|
-
end
|
218
|
-
|
219
|
-
should 'not destroy <%= singular_table_name %>' do
|
220
|
-
skip 'not destroy <%= singular_table_name %>'
|
221
|
-
assert_no_difference('<%= class_name %>.count') do
|
222
|
-
xhr :delete, :destroy, id: <%= "@#{singular_table_name}" %>
|
223
|
-
end
|
224
|
-
assert_template 'message_popup'
|
225
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
226
|
-
end
|
227
|
-
|
228
|
-
should 'clear <%= singular_table_name %>' do
|
229
|
-
skip 'clear <%= singular_table_name %>'
|
230
|
-
assert_no_difference('<%= class_name %>.count') do
|
231
|
-
xhr :get, :clear
|
232
|
-
end
|
233
|
-
assert_response :success
|
234
|
-
assert_not_nil assigns(:record)
|
235
|
-
end
|
236
|
-
|
237
|
-
should 'csv_download <%= table_name %>' do
|
238
|
-
skip 'csv_download <%= table_name %>'
|
239
|
-
get :csv_download
|
240
|
-
assert_response :success
|
241
|
-
end
|
242
|
-
|
243
|
-
should 'search' do
|
244
|
-
skip 'search <%= table_name %>'
|
245
|
-
xhr :get, :search, edgarj_search_form: {}
|
246
|
-
assert_response :success
|
247
|
-
assert assigns(:list).count >= 1
|
248
|
-
end
|
249
|
-
|
250
|
-
should 'search_clear <%= singular_table_name %>' do
|
251
|
-
skip 'search_clear <%= singular_table_name %>'
|
252
|
-
xhr :get, :search_clear
|
253
|
-
assert_response :success
|
254
|
-
end
|
255
|
-
|
256
|
-
should 'search_save <%= singular_table_name %>' do
|
257
|
-
skip 'search_save'
|
258
|
-
end
|
259
|
-
|
260
|
-
should 'search_load <%= singular_table_name %>' do
|
261
|
-
skip 'search_load'
|
262
|
-
end
|
263
|
-
end
|
264
|
-
|
265
|
-
# All of tests in this context is skipped because it is required
|
266
|
-
# to prepare 'permitted but user_scoped' user.
|
267
|
-
# When complete the preparation, delete the skip lines.
|
268
|
-
context 'permitted and user_scoped user' do
|
269
|
-
setup do
|
270
|
-
# prepare fixtures of model_permissions, user_groups, and
|
271
|
-
# user_group_users for permitted and user_scoped user of the
|
272
|
-
# <%= controller_class_name %>Controller and login by him/her.
|
273
|
-
#
|
274
|
-
#login_as(:permitted_n_user_scoped_on_<%= table_name %>)
|
275
|
-
#@pi = create_page_info(@sssn, '<%= table_name %>', <%= class_name %>)
|
276
|
-
|
277
|
-
@<%= singular_table_name %> = <%= table_name %>(:one)
|
278
|
-
@<%= singular_table_name %>_scoped_out = <%= table_name %>(:two)
|
279
|
-
end
|
280
|
-
|
281
|
-
should 'search 1 hit since role and user_scoped satisfy' do
|
282
|
-
skip 'search 1 hit since role and user_scoped satisfy'
|
283
|
-
xhr :get, :search, edgarj_search_form: {_id: @<%= singular_table_name %>.id}
|
284
|
-
assert_response :success
|
285
|
-
assert_equal 1, assigns(:list).count
|
286
|
-
end
|
287
|
-
|
288
|
-
should 'not search 1 hit since key is out-of-scope' do
|
289
|
-
skip 'not search 1 hit since key is out-of-scope'
|
290
|
-
xhr :get, :search, edgarj_search_form: {_id: @<%= singular_table_name %>_scoped_out.id}
|
291
|
-
assert_response :success
|
292
|
-
assert_equal 0, assigns(:list).count
|
293
|
-
end
|
294
|
-
|
295
|
-
should 'show assigned <%= singular_table_name %> in HTML' do
|
296
|
-
skip 'show assigned <%= singular_table_name %> in HTML'
|
297
|
-
get :show, id: <%= "@#{singular_table_name}" %>
|
298
|
-
assert_response :success
|
299
|
-
assert_not_nil assigns(:record)
|
300
|
-
end
|
301
|
-
|
302
|
-
should 'show assigned <%= singular_table_name %> in JS' do
|
303
|
-
skip 'show assigned <%= singular_table_name %> in JS'
|
304
|
-
xhr :get, :show, id: <%= "@#{singular_table_name}" %>
|
305
|
-
assert_response :success
|
306
|
-
assert_not_nil assigns(:record)
|
307
|
-
end
|
308
|
-
|
309
|
-
should 'not show non-assigned <%= singular_table_name %> in HTML' do
|
310
|
-
skip 'not show non-assigned <%= singular_table_name %> in HTML'
|
311
|
-
get :show, id: <%= "@#{singular_table_name}_scoped_out" %>
|
312
|
-
assert_response :redirect
|
313
|
-
assert_nil assigns(:record)
|
314
|
-
assert_equal I18n.t('edgarj.default.not_found'), flash[:error]
|
315
|
-
end
|
316
|
-
|
317
|
-
should 'not show non-assigned <%= singular_table_name %> in JS' do
|
318
|
-
skip 'not show non-assigned <%= singular_table_name %> in JS'
|
319
|
-
xhr :get, :show, id: <%= "@#{singular_table_name}_scoped_out" %>
|
320
|
-
assert_response :success
|
321
|
-
assert_nil assigns(:record)
|
322
|
-
assert_equal I18n.t('edgarj.default.not_found'), flash[:error]
|
323
|
-
end
|
324
|
-
|
325
|
-
should 'update <%= singular_table_name %>' do
|
326
|
-
skip 'update <%= singular_table_name %>'
|
327
|
-
xhr :put, :update, id: <%= "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
328
|
-
assert_response :success
|
329
|
-
assert assigns(:record)
|
330
|
-
end
|
331
|
-
|
332
|
-
should 'not update non-assigned <%= singular_table_name %>' do
|
333
|
-
skip 'not update non-assigned <%= singular_table_name %>'
|
334
|
-
xhr :put, :update, id: <%= "@#{singular_table_name}_scoped_out" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
335
|
-
assert_nil assigns(:record)
|
336
|
-
assert_equal I18n.t('edgarj.default.not_found'), flash[:error]
|
337
|
-
old_<%= singular_table_name %> = @<%= singular_table_name %>_scoped_out
|
338
|
-
assert_equal(
|
339
|
-
old_<%= singular_table_name %>,
|
340
|
-
@<%= singular_table_name %>_scoped_out.reload)
|
341
|
-
end
|
342
|
-
|
343
|
-
should 'destroy <%= singular_table_name %>' do
|
344
|
-
skip 'destroy <%= singular_table_name %>'
|
345
|
-
assert_difference('<%= class_name %>.count', -1) do
|
346
|
-
xhr :delete, :destroy, id: <%= "@#{singular_table_name}" %>
|
347
|
-
end
|
348
|
-
assert_response :success
|
349
|
-
assert assigns(:record)
|
350
|
-
assert assigns(:list)
|
351
|
-
end
|
352
|
-
|
353
|
-
should 'not destroy non-assigned <%= singular_table_name %>' do
|
354
|
-
skip 'not destroy non-assigned <%= singular_table_name %>'
|
355
|
-
assert_no_difference('<%= class_name %>.count') do
|
356
|
-
xhr :delete, :destroy, id: <%= "@#{singular_table_name}_scoped_out" %>
|
357
|
-
end
|
358
|
-
assert_equal I18n.t('edgarj.default.not_found'), flash[:error]
|
359
|
-
end
|
360
|
-
end
|
361
|
-
|
362
|
-
context 'not-permitted user' do
|
363
|
-
setup do
|
364
|
-
login_as(:not_permitted)
|
365
|
-
@<%= singular_table_name %> = <%= table_name %>(:one)
|
366
|
-
end
|
367
|
-
|
368
|
-
should 'not get index' do
|
369
|
-
get :index
|
370
|
-
|
371
|
-
assert_redirected_to top_path
|
372
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
373
|
-
end
|
374
|
-
|
375
|
-
should 'not paginate' do
|
376
|
-
xhr :get, :index, page: 2
|
377
|
-
|
378
|
-
assert_template 'message_popup'
|
379
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
380
|
-
end
|
381
|
-
|
382
|
-
should 'not sort' do
|
383
|
-
xhr :put, :page_info_save,
|
384
|
-
id: edgarj_page_infos(:root_zip_address),
|
385
|
-
edgarj_page_info: {
|
386
|
-
dir: 'asc',
|
387
|
-
order_by: 'name'
|
388
|
-
}
|
389
|
-
assert_template 'message_popup'
|
390
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
391
|
-
end
|
392
|
-
|
393
|
-
should 'not create <%= singular_table_name %>' do
|
394
|
-
assert_no_difference('<%= class_name %>.count') do
|
395
|
-
xhr :post, :create, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
396
|
-
end
|
397
|
-
|
398
|
-
assert_template 'message_popup'
|
399
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
400
|
-
end
|
401
|
-
|
402
|
-
should 'not show <%= singular_table_name %> in HTML' do
|
403
|
-
get :show, id: @<%= singular_table_name %>
|
404
|
-
assert_redirected_to top_path
|
405
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
406
|
-
end
|
407
|
-
|
408
|
-
should 'not show <%= singular_table_name %> in JS' do
|
409
|
-
xhr :get, :show, id: @<%= singular_table_name %>
|
410
|
-
|
411
|
-
assert_template 'message_popup'
|
412
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
413
|
-
end
|
414
|
-
|
415
|
-
should 'not update <%= singular_table_name %>' do
|
416
|
-
xhr :put, :update, id: <%= "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %>
|
417
|
-
assert_template 'message_popup'
|
418
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
419
|
-
old_<%= singular_table_name %> = @<%= singular_table_name %>
|
420
|
-
assert_equal(
|
421
|
-
old_<%= singular_table_name %>,
|
422
|
-
@<%= singular_table_name %>.reload)
|
423
|
-
end
|
424
|
-
|
425
|
-
should 'not destroy <%= singular_table_name %>' do
|
426
|
-
assert_no_difference('<%= class_name %>.count') do
|
427
|
-
xhr :delete, :destroy, id: @<%= singular_table_name %>
|
428
|
-
end
|
429
|
-
assert_template 'message_popup'
|
430
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
431
|
-
end
|
432
|
-
|
433
|
-
should 'not clear' do
|
434
|
-
assert_no_difference('<%= class_name %>.count') do
|
435
|
-
xhr :get, :clear
|
436
|
-
end
|
437
|
-
|
438
|
-
assert_template 'message_popup'
|
439
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
440
|
-
end
|
441
|
-
|
442
|
-
should 'not csv_download' do
|
443
|
-
get :csv_download
|
444
|
-
|
445
|
-
assert_redirected_to top_path
|
446
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
447
|
-
end
|
448
|
-
|
449
|
-
should 'not search' do
|
450
|
-
xhr :get, :search, edgarj_search_form: {_id: @<%= singular_table_name %>.id}
|
451
|
-
|
452
|
-
assert_template 'message_popup'
|
453
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
454
|
-
end
|
455
|
-
|
456
|
-
should 'not search_clear' do
|
457
|
-
xhr :get, :search_clear
|
458
|
-
|
459
|
-
assert_template 'message_popup'
|
460
|
-
assert_equal I18n.t('edgarj.default.permission_no'), flash[:error]
|
461
|
-
end
|
462
|
-
|
463
|
-
should 'not search_save' do
|
464
|
-
skip 'search_save'
|
465
|
-
end
|
466
|
-
|
467
|
-
should 'not search_load' do
|
468
|
-
skip 'search_load'
|
469
|
-
end
|
470
|
-
|
471
|
-
# test Edgarj::AuthenticationMixin
|
472
|
-
|
473
|
-
should 'current_user' do
|
474
|
-
get :index
|
475
|
-
assert_equal users(:not_permitted), @controller.send(:current_user)
|
476
|
-
end
|
477
|
-
end
|
478
|
-
|
479
|
-
context 'not-login' do
|
480
|
-
setup do
|
481
|
-
@<%= singular_table_name %> = <%= table_name %>(:one)
|
482
|
-
end
|
483
|
-
|
484
|
-
should 'not get index' do
|
485
|
-
get :index
|
486
|
-
assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
|
487
|
-
end
|
488
|
-
|
489
|
-
should 'not paginate' do
|
490
|
-
xhr :get, :index, page: 2
|
491
|
-
assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
|
492
|
-
end
|
493
|
-
|
494
|
-
should 'not sort' do
|
495
|
-
xhr :put, :page_info_save,
|
496
|
-
# ensure what happens when not-login user puts with
|
497
|
-
# current edgarj_page_info-id
|
498
|
-
id: edgarj_page_infos(:root_zip_address),
|
499
|
-
edgarj_page_info: {
|
500
|
-
dir: 'asc',
|
501
|
-
order_by: 'name'
|
502
|
-
}
|
503
|
-
assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
|
504
|
-
end
|
505
|
-
|
506
|
-
should 'not create <%= singular_table_name %>' do
|
507
|
-
assert_no_difference('<%= class_name %>.count') do
|
508
|
-
xhr :post, :create, <%= singular_table_name %>: { name: @<%= singular_table_name %>.name }
|
509
|
-
end
|
510
|
-
assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
|
511
|
-
end
|
512
|
-
|
513
|
-
should 'not create <%= singular_table_name %> invalid' do
|
514
|
-
assert_no_difference('<%= class_name %>.count') do
|
515
|
-
xhr :post, :create, <%= singular_table_name %>: { name: nil }
|
516
|
-
end
|
517
|
-
assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
|
518
|
-
end
|
519
|
-
|
520
|
-
should 'not show <%= singular_table_name %> in HTML' do
|
521
|
-
get :show, id: @<%= singular_table_name %>
|
522
|
-
assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
|
523
|
-
end
|
524
|
-
|
525
|
-
should 'not show <%= singular_table_name %> in JS' do
|
526
|
-
xhr :get, :show, id: @<%= singular_table_name %>
|
527
|
-
assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
|
528
|
-
end
|
529
|
-
|
530
|
-
should 'not update <%= singular_table_name %>' do
|
531
|
-
assert_no_difference('<%= class_name %>.count') do
|
532
|
-
xhr :put, :update, id: @<%= singular_table_name %>, <%= singular_table_name %>: { name: @<%= singular_table_name %>.name }
|
533
|
-
end
|
534
|
-
assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
|
535
|
-
end
|
536
|
-
|
537
|
-
should 'not destroy <%= singular_table_name %>' do
|
538
|
-
assert_no_difference('<%= class_name %>.count') do
|
539
|
-
xhr :delete, :destroy, id: @<%= singular_table_name %>
|
540
|
-
end
|
541
|
-
assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
|
542
|
-
end
|
543
|
-
|
544
|
-
should 'not clear' do
|
545
|
-
assert_no_difference('<%= class_name %>.count') do
|
546
|
-
xhr :get, :clear
|
547
|
-
end
|
548
|
-
assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
|
549
|
-
end
|
550
|
-
|
551
|
-
should 'not csv_download' do
|
552
|
-
get :csv_download
|
553
|
-
assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
|
554
|
-
end
|
555
|
-
|
556
|
-
should 'not search' do
|
557
|
-
xhr :get, :search, edgarj_search_form: {_id: <%= table_name %>(:one).id}
|
558
|
-
assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
|
559
|
-
end
|
560
|
-
|
561
|
-
should 'not search_clear' do
|
562
|
-
xhr :get, :search_clear
|
563
|
-
assert_equal I18n.t('edgarj.default.login_failed'), flash[:error]
|
564
|
-
end
|
565
|
-
|
566
|
-
should 'not search_save' do
|
567
|
-
skip 'search_save'
|
568
|
-
end
|
569
|
-
|
570
|
-
should 'not search_load' do
|
571
|
-
skip 'search_load'
|
572
|
-
end
|
573
|
-
end
|
574
|
-
end
|
575
|
-
<% end -%>
|