enju_leaf 1.2.0.beta.1 → 1.2.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/lib/enju_leaf/engine.rb +1 -15
  3. data/lib/enju_leaf/version.rb +1 -1
  4. data/lib/generators/enju_leaf/quick_install/quick_install_generator.rb +3 -3
  5. data/lib/generators/enju_leaf/setup/setup_generator.rb +0 -1
  6. data/spec/controllers/page_controller_spec.rb +1 -1
  7. data/spec/dummy/app/controllers/application_controller.rb +0 -1
  8. data/spec/dummy/app/helpers/application_helper.rb +2 -1
  9. data/spec/dummy/app/models/user.rb +0 -1
  10. data/spec/dummy/config/application.rb +1 -2
  11. data/{db → spec/dummy/db}/migrate/041_create_roles.rb +0 -0
  12. data/spec/dummy/db/migrate/059_create_libraries.rb +1 -5
  13. data/spec/dummy/db/migrate/069_create_shelves.rb +1 -5
  14. data/{db → spec/dummy/db}/migrate/077_create_user_groups.rb +0 -0
  15. data/spec/dummy/db/migrate/130_create_request_status_types.rb +1 -5
  16. data/spec/dummy/db/migrate/131_create_request_types.rb +1 -5
  17. data/spec/dummy/db/migrate/20100314190054_add_opening_hour_to_library.rb +9 -0
  18. data/{db → spec/dummy/db}/migrate/20100606065209_create_user_has_roles.rb +0 -0
  19. data/{db → spec/dummy/db}/migrate/20110318183304_add_valid_period_for_new_user_to_user_group.rb +0 -0
  20. data/spec/dummy/db/migrate/20111129044509_add_pickup_location_to_reserve.rb +6 -0
  21. data/{db → spec/dummy/db}/migrate/20130221154434_add_additional_attributes_to_user.rb +0 -0
  22. data/spec/dummy/db/migrate/20130412083556_add_latitude_and_longitude_to_library.rb +6 -0
  23. data/{db → spec/dummy/db}/migrate/20140110122216_create_user_import_files.rb +0 -0
  24. data/{db → spec/dummy/db}/migrate/20140110131010_create_user_import_results.rb +0 -0
  25. data/{db → spec/dummy/db}/migrate/20140122054321_create_profiles.rb +0 -0
  26. data/{db → spec/dummy/db}/migrate/20140524074813_create_user_import_file_transitions.rb +0 -0
  27. data/{db → spec/dummy/db}/migrate/20140610123439_drop_email_unique_constraint_enju_leaf_rc10.rb +0 -0
  28. data/{db → spec/dummy/db}/migrate/20140628072217_add_user_encoding_to_user_import_file.rb +0 -0
  29. data/{db → spec/dummy/db}/migrate/20140709113413_create_user_export_files.rb +0 -0
  30. data/{db → spec/dummy/db}/migrate/20140709113905_create_user_export_file_transitions.rb +0 -0
  31. data/{db → spec/dummy/db}/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +0 -0
  32. data/{db → spec/dummy/db}/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +0 -0
  33. data/{db → spec/dummy/db}/migrate/20140811031145_add_expired_at_to_profile.rb +0 -0
  34. data/spec/dummy/db/migrate/20140821151023_create_colors.rb +14 -0
  35. data/{db → spec/dummy/db}/migrate/20141003181336_add_full_name_transcription_to_profile.rb +0 -0
  36. data/{db → spec/dummy/db}/migrate/20141003182825_add_date_of_birth_to_profile.rb +0 -0
  37. data/spec/dummy/db/migrate/20141020120523_add_library_id_to_checkout.rb +6 -0
  38. data/spec/dummy/db/migrate/20150106001709_create_demands.rb +14 -0
  39. data/{db → spec/dummy/db}/migrate/20150421023923_create_identities.rb +0 -0
  40. data/{db → spec/dummy/db}/migrate/20150506105356_add_error_message_to_user_import_result.rb +0 -0
  41. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +13 -0
  42. data/{db → spec/dummy/db}/migrate/20151126005552_add_provider_to_identity.rb +0 -0
  43. data/spec/dummy/db/migrate/20160610093229_add_html_snippet_to_library_group.rb +5 -0
  44. data/{db → spec/dummy/db}/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +0 -0
  45. data/{db → spec/dummy/db}/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +0 -0
  46. data/spec/dummy/db/migrate/20160703184619_add_most_recent_to_reserve_transitions.rb +9 -0
  47. data/spec/dummy/db/migrate/20160703184650_add_most_recent_to_manifestation_checkout_stat_transitions.rb +9 -0
  48. data/spec/dummy/db/migrate/20160703184723_add_most_recent_to_manifestation_reserve_stat_transitions.rb +9 -0
  49. data/spec/dummy/db/migrate/20160703184747_add_most_recent_to_user_checkout_stat_transitions.rb +9 -0
  50. data/spec/dummy/db/migrate/20160703184805_add_most_recent_to_user_reserve_stat_transitions.rb +9 -0
  51. data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +9 -0
  52. data/spec/dummy/db/migrate/20160703190209_add_foreign_key_on_manifestation_id_to_reserve.rb +5 -0
  53. data/spec/dummy/db/schema.rb +47 -12
  54. data/spec/fixtures/library_groups.yml +1 -4
  55. data/spec/models/user_spec.rb +0 -22
  56. data/spec/rails_helper.rb +1 -1
  57. data/spec/views/page/index.html.erb_spec.rb +0 -2
  58. metadata +96 -337
  59. data/app/controllers/concerns/enju_leaf/controller.rb +0 -225
  60. data/app/controllers/my_accounts_controller.rb +0 -93
  61. data/app/controllers/names_controller.rb +0 -60
  62. data/app/controllers/profiles_controller.rb +0 -219
  63. data/app/controllers/roles_controller.rb +0 -61
  64. data/app/controllers/user_export_files_controller.rb +0 -116
  65. data/app/controllers/user_groups_controller.rb +0 -118
  66. data/app/controllers/user_import_files_controller.rb +0 -129
  67. data/app/controllers/user_import_results_controller.rb +0 -57
  68. data/app/mailers/notifier.rb +0 -30
  69. data/app/models/identity.rb +0 -9
  70. data/app/models/profile.rb +0 -101
  71. data/app/models/role.rb +0 -50
  72. data/app/models/user_export_file.rb +0 -67
  73. data/app/models/user_export_file_state_machine.rb +0 -15
  74. data/app/models/user_export_file_transition.rb +0 -20
  75. data/app/models/user_group.rb +0 -29
  76. data/app/models/user_has_role.rb +0 -19
  77. data/app/models/user_import_file.rb +0 -352
  78. data/app/models/user_import_file_state_machine.rb +0 -19
  79. data/app/models/user_import_file_transition.rb +0 -20
  80. data/app/models/user_import_result.rb +0 -20
  81. data/app/policies/application_policy.rb +0 -53
  82. data/app/policies/name_policy.rb +0 -21
  83. data/app/policies/profile_policy.rb +0 -55
  84. data/app/policies/role_policy.rb +0 -21
  85. data/app/policies/user_export_file_policy.rb +0 -21
  86. data/app/policies/user_group_policy.rb +0 -22
  87. data/app/policies/user_import_file_policy.rb +0 -21
  88. data/app/policies/user_import_result_policy.rb +0 -21
  89. data/app/views/my_accounts/_edit_credential.html.erb +0 -99
  90. data/app/views/my_accounts/_form.html.erb +0 -24
  91. data/app/views/my_accounts/_show.html.erb +0 -1
  92. data/app/views/my_accounts/edit.html.erb +0 -32
  93. data/app/views/my_accounts/show.html+phone.erb +0 -1
  94. data/app/views/my_accounts/show.html.erb +0 -49
  95. data/app/views/names/_form.html.erb +0 -41
  96. data/app/views/names/edit.html.erb +0 -6
  97. data/app/views/names/index.html.erb +0 -37
  98. data/app/views/names/new.html.erb +0 -5
  99. data/app/views/names/show.html.erb +0 -34
  100. data/app/views/profiles/_edit_credential.html.erb +0 -88
  101. data/app/views/profiles/_edit_profile.html.erb +0 -42
  102. data/app/views/profiles/_form.html.erb +0 -15
  103. data/app/views/profiles/_show.html.erb +0 -1
  104. data/app/views/profiles/edit.html.erb +0 -33
  105. data/app/views/profiles/index.html.erb +0 -70
  106. data/app/views/profiles/new.html.erb +0 -88
  107. data/app/views/profiles/show.html+phone.erb +0 -1
  108. data/app/views/profiles/show.html.erb +0 -71
  109. data/app/views/roles/_form.html.erb +0 -19
  110. data/app/views/roles/edit.html.erb +0 -13
  111. data/app/views/roles/index.html.erb +0 -32
  112. data/app/views/roles/new.html.erb +0 -12
  113. data/app/views/roles/show.html.erb +0 -46
  114. data/app/views/user_export_files/_form.html.erb +0 -12
  115. data/app/views/user_export_files/edit.html.erb +0 -6
  116. data/app/views/user_export_files/index.html.erb +0 -44
  117. data/app/views/user_export_files/new.html.erb +0 -16
  118. data/app/views/user_export_files/show.html.erb +0 -36
  119. data/app/views/user_groups/_form.html.erb +0 -40
  120. data/app/views/user_groups/edit.html.erb +0 -13
  121. data/app/views/user_groups/index.html.erb +0 -51
  122. data/app/views/user_groups/new.html.erb +0 -12
  123. data/app/views/user_groups/show.html.erb +0 -68
  124. data/app/views/user_import_files/_form.html.erb +0 -61
  125. data/app/views/user_import_files/_results.html.erb +0 -22
  126. data/app/views/user_import_files/edit.html.erb +0 -6
  127. data/app/views/user_import_files/index.html.erb +0 -45
  128. data/app/views/user_import_files/new.html.erb +0 -60
  129. data/app/views/user_import_files/show.html.erb +0 -85
  130. data/app/views/user_import_results/_form.html.erb +0 -29
  131. data/app/views/user_import_results/_list.html.erb +0 -22
  132. data/app/views/user_import_results/_list_lines.html.erb +0 -24
  133. data/app/views/user_import_results/index.html.erb +0 -25
  134. data/app/views/user_import_results/index.txt.erb +0 -3
  135. data/app/views/user_import_results/show.html.erb +0 -33
  136. data/db/migrate/20091202124834_create_versions.rb +0 -18
  137. data/spec/controllers/my_accounts_controller_spec.rb +0 -229
  138. data/spec/controllers/profiles_controller_spec.rb +0 -594
  139. data/spec/controllers/roles_controller_spec.rb +0 -136
  140. data/spec/controllers/user_export_files_controller_spec.rb +0 -296
  141. data/spec/controllers/user_groups_controller_spec.rb +0 -443
  142. data/spec/controllers/user_import_files_controller_spec.rb +0 -305
  143. data/spec/controllers/user_import_results_controller_spec.rb +0 -157
  144. data/spec/fixtures/user_export_files.yml +0 -25
  145. data/spec/fixtures/user_import_files.yml +0 -51
  146. data/spec/fixtures/user_import_results.yml +0 -26
  147. data/spec/fixtures/user_reserve_stats.yml +0 -27
  148. data/spec/models/basket_spec.rb +0 -23
  149. data/spec/models/profile_spec.rb +0 -98
  150. data/spec/models/role_spec.rb +0 -40
  151. data/spec/models/user_export_file_spec.rb +0 -30
  152. data/spec/models/user_group_spec.rb +0 -37
  153. data/spec/models/user_has_role_spec.rb +0 -18
  154. data/spec/models/user_import_file_spec.rb +0 -220
  155. data/spec/models/user_import_result_spec.rb +0 -20
  156. data/spec/requests/profiles_spec.rb +0 -9
  157. data/spec/routing/profiles_routing_spec.rb +0 -35
  158. data/spec/routing/resource_import_files_routing_spec.rb +0 -35
  159. data/spec/routing/roles_routing_spec.rb +0 -35
  160. data/spec/routing/users_spec.rb +0 -14
  161. data/spec/views/my_accounts/show.html.erb_spec.rb +0 -43
  162. data/spec/views/profiles/edit.html.erb_spec.rb +0 -42
  163. data/spec/views/profiles/index.html.erb_spec.rb +0 -19
  164. data/spec/views/profiles/new.html.erb_spec.rb +0 -25
  165. data/spec/views/profiles/show.html.erb_spec.rb +0 -31
  166. data/spec/views/user_export_files/new.html.erb_spec.rb +0 -19
  167. data/spec/views/user_import_results/index.html.erb_spec.rb +0 -29
@@ -1,305 +0,0 @@
1
- require 'rails_helper'
2
-
3
- describe UserImportFilesController do
4
- fixtures :all
5
-
6
- describe "GET index" do
7
- describe "When logged in as Administrator" do
8
- login_fixture_admin
9
-
10
- it "assigns all user_import_files as @user_import_files" do
11
- get :index
12
- assigns(:user_import_files).should eq(UserImportFile.order('id DESC').page(1))
13
- end
14
- end
15
-
16
- describe "When logged in as Librarian" do
17
- login_fixture_librarian
18
-
19
- it "assigns all user_import_files as @user_import_files" do
20
- get :index
21
- assigns(:user_import_files).should eq(UserImportFile.order('id DESC').page(1))
22
- end
23
- end
24
-
25
- describe "When logged in as User" do
26
- login_fixture_user
27
-
28
- it "assigns empty as @user_import_files" do
29
- get :index
30
- assigns(:user_import_files).should be_nil
31
- expect(response).to be_forbidden
32
- end
33
- end
34
-
35
- describe "When not logged in" do
36
- it "assigns empty as @user_import_files" do
37
- get :index
38
- assigns(:user_import_files).should be_nil
39
- expect(response).to redirect_to(new_user_session_url)
40
- end
41
- end
42
- end
43
-
44
- describe "GET show" do
45
- describe "When logged in as Administrator" do
46
- login_fixture_admin
47
-
48
- it "assigns the requested user_import_file as @user_import_file" do
49
- get :show, id: user_import_files(:two).id
50
- assigns(:user_import_file).should eq(user_import_files(:two))
51
- expect(response).to be_success
52
- end
53
-
54
- it "assigns user_import_results" do
55
- get :show, id: user_import_files(:one).id
56
- expect(response).to be_success
57
- expect(assigns(:user_import_file)).to eq user_import_files(:one)
58
- expect(assigns(:user_import_results)).to include user_import_results(:one)
59
- end
60
- end
61
-
62
- describe "When logged in as Librarian" do
63
- login_fixture_librarian
64
-
65
- it "assigns the requested user_import_file as @user_import_file" do
66
- get :show, id: user_import_files(:two).id
67
- assigns(:user_import_file).should eq(user_import_files(:two))
68
- expect(response).to be_success
69
- end
70
- end
71
-
72
- describe "When logged in as User" do
73
- login_fixture_user
74
-
75
- it "assigns the requested user_import_file as @user_import_file" do
76
- get :show, id: user_import_files(:two).id
77
- assigns(:user_import_file).should eq(user_import_files(:two))
78
- expect(response).to be_forbidden
79
- end
80
- end
81
-
82
- describe "When not logged in" do
83
- it "assigns the requested user_import_file as @user_import_file" do
84
- get :show, id: user_import_files(:two).id
85
- assigns(:user_import_file).should eq(user_import_files(:two))
86
- expect(response).to redirect_to(new_user_session_url)
87
- end
88
- end
89
- end
90
-
91
- describe "GET new" do
92
- describe "When logged in as Administrator" do
93
- login_fixture_admin
94
-
95
- it "assigns the requested user_import_file as @user_import_file" do
96
- get :new
97
- assigns(:user_import_file).should_not be_valid
98
- expect(response).to be_success
99
- end
100
- end
101
-
102
- describe "When logged in as Librarian" do
103
- login_fixture_librarian
104
-
105
- it "should not assign the requested user_import_file as @user_import_file" do
106
- get :new
107
- assigns(:user_import_file).should_not be_valid
108
- expect(response).to be_success
109
- end
110
- end
111
-
112
- describe "When logged in as User" do
113
- login_fixture_user
114
-
115
- it "should not assign the requested user_import_file as @user_import_file" do
116
- get :new
117
- assigns(:user_import_file).should be_nil
118
- expect(response).to be_forbidden
119
- end
120
- end
121
-
122
- describe "When not logged in" do
123
- it "should not assign the requested user_import_file as @user_import_file" do
124
- get :new
125
- assigns(:user_import_file).should be_nil
126
- expect(response).to redirect_to(new_user_session_url)
127
- end
128
- end
129
- end
130
-
131
- describe "POST create" do
132
- describe "When logged in as Librarian" do
133
- before(:each) do
134
- profile = FactoryGirl.create(:profile)
135
- @user = FactoryGirl.create(:librarian)
136
- @user.profile = profile
137
- sign_in @user
138
- end
139
-
140
- it "should create agent_import_file" do
141
- post :create, user_import_file: {user_import: fixture_file_upload("/../../examples/user_import_file_sample.tsv", 'text/csv') }
142
- assigns(:user_import_file).should be_valid
143
- assigns(:user_import_file).user.username.should eq @user.username
144
- expect(response).to redirect_to user_import_file_url(assigns(:user_import_file))
145
- end
146
- end
147
-
148
- describe "When logged in as User" do
149
- before(:each) do
150
- profile = FactoryGirl.create(:profile)
151
- @user = FactoryGirl.create(:user)
152
- @user.profile = profile
153
- sign_in @user
154
- end
155
-
156
- it "should be forbidden" do
157
- post :create, user_import_file: {user_import: fixture_file_upload("/../../examples/user_import_file_sample.tsv", 'text/csv') }
158
- assigns(:user_import_file).should be_nil
159
- expect(response).to be_forbidden
160
- end
161
- end
162
-
163
- describe "When not logged in" do
164
- it "should be redirected to new session url" do
165
- post :create, user_import_file: {user_import: fixture_file_upload("/../../examples/user_import_file_sample.tsv", 'text/csv') }
166
- assigns(:user_import_file).should be_nil
167
- expect(response).to redirect_to new_user_session_url
168
- end
169
- end
170
- end
171
-
172
- describe "GET edit" do
173
- describe "When logged in as Administrator" do
174
- login_fixture_admin
175
-
176
- it "assigns the requested user_import_file as @user_import_file" do
177
- user_import_file = user_import_files(:one)
178
- get :edit, id: user_import_file.id
179
- assigns(:user_import_file).should eq(user_import_file)
180
- end
181
- end
182
-
183
- describe "When logged in as Librarian" do
184
- login_fixture_librarian
185
-
186
- it "assigns the requested user_import_file as @user_import_file" do
187
- user_import_file = user_import_files(:one)
188
- get :edit, id: user_import_file.id
189
- assigns(:user_import_file).should eq(user_import_file)
190
- end
191
- end
192
-
193
- describe "When logged in as User" do
194
- login_fixture_user
195
-
196
- it "assigns the requested user_import_file as @user_import_file" do
197
- user_import_file = user_import_files(:one)
198
- get :edit, id: user_import_file.id
199
- expect(response).to be_forbidden
200
- end
201
- end
202
-
203
- describe "When not logged in" do
204
- it "should not assign the requested user_import_file as @user_import_file" do
205
- user_import_file = user_import_files(:one)
206
- get :edit, id: user_import_file.id
207
- expect(response).to redirect_to(new_user_session_url)
208
- end
209
- end
210
- end
211
-
212
- describe "PUT update" do
213
- describe "When logged in as Administrator" do
214
- login_fixture_admin
215
-
216
- it "should update user_import_file" do
217
- post :create, user_import_file: {user_import: fixture_file_upload("/../../examples/user_import_file_sample.tsv", 'text/csv') }
218
- put :update, id: assigns(:user_import_file).id, user_import_file: { note: 'test' }
219
- expect(response).to redirect_to user_import_file_url(assigns(:user_import_file))
220
- end
221
- end
222
-
223
- describe "When logged in as Librarian" do
224
- login_fixture_librarian
225
-
226
- it "should update user_import_file" do
227
- post :create, user_import_file: {user_import: fixture_file_upload("/../../examples/user_import_file_sample.tsv", 'text/csv') }
228
- put :update, id: assigns(:user_import_file).id, user_import_file: { note: 'test' }
229
- expect(response).to redirect_to user_import_file_url(assigns(:user_import_file))
230
- end
231
- end
232
-
233
- describe "When logged in as User" do
234
- login_fixture_user
235
-
236
- it "should not update user_import_file" do
237
- put :update, id: user_import_files(:two).id, user_import_file: { }
238
- expect(response).to be_forbidden
239
- end
240
- end
241
-
242
- describe "When not logged in" do
243
- it "should not update user_import_file" do
244
- put :update, id: user_import_files(:two).id, user_import_file: { }
245
- expect(response).to redirect_to new_user_session_url
246
- end
247
- end
248
- end
249
-
250
- describe "DELETE destroy" do
251
- before(:each) do
252
- @user_import_file = user_import_files(:one)
253
- end
254
-
255
- describe "When logged in as Administrator" do
256
- login_fixture_admin
257
-
258
- it "destroys the requested user_import_file" do
259
- delete :destroy, id: @user_import_file.id
260
- end
261
-
262
- it "redirects to the user_import_files list" do
263
- delete :destroy, id: @user_import_file.id
264
- expect(response).to redirect_to(user_import_files_url)
265
- end
266
- end
267
-
268
- describe "When logged in as Librarian" do
269
- login_fixture_librarian
270
-
271
- it "destroys the requested user_import_file" do
272
- delete :destroy, id: @user_import_file.id
273
- end
274
-
275
- it "redirects to the user_import_files list" do
276
- delete :destroy, id: @user_import_file.id
277
- expect(response).to redirect_to(user_import_files_url)
278
- end
279
- end
280
-
281
- describe "When logged in as User" do
282
- login_fixture_user
283
-
284
- it "destroys the requested user_import_file" do
285
- delete :destroy, id: @user_import_file.id
286
- end
287
-
288
- it "should be forbidden" do
289
- delete :destroy, id: @user_import_file.id
290
- expect(response).to be_forbidden
291
- end
292
- end
293
-
294
- describe "When not logged in" do
295
- it "destroys the requested user_import_file" do
296
- delete :destroy, id: @user_import_file.id
297
- end
298
-
299
- it "should be forbidden" do
300
- delete :destroy, id: @user_import_file.id
301
- expect(response).to redirect_to(new_user_session_url)
302
- end
303
- end
304
- end
305
- end
@@ -1,157 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require 'rails_helper'
3
-
4
- describe UserImportResultsController do
5
- fixtures :all
6
-
7
- describe "GET index" do
8
- describe "When logged in as Administrator" do
9
- login_fixture_admin
10
-
11
- it "assigns all user_import_results as @user_import_results" do
12
- get :index
13
- assigns(:user_import_results).should eq(UserImportResult.page(1))
14
- end
15
-
16
- describe "With @user_import_file parameter" do
17
- before(:each) do
18
- @file = UserImportFile.create user_import: File.new("#{Rails.root}/../../examples/user_import_file_sample_long.tsv"), user: users(:admin)
19
- @file.default_user_group = UserGroup.find(2)
20
- @file.default_library = Library.find(3)
21
- @file.save
22
- @file.import_start
23
- end
24
- render_views
25
- it "should assign all user_import_results for the user_import_file with a page parameter" do
26
- get :index, user_import_file_id: @file.id
27
- results = assigns(:user_import_results)
28
- results.should_not be_empty
29
- get :index, user_import_file_id: @file.id, page: 2
30
- results2 = assigns(:user_import_results)
31
- results2.first.should_not eq results.first
32
- response.body.should match /<td>11<\/td>/
33
- end
34
- end
35
- end
36
-
37
- describe "When logged in as Librarian" do
38
- login_fixture_librarian
39
-
40
- it "assigns all user_import_results as @user_import_results" do
41
- get :index
42
- assigns(:user_import_results).should eq(UserImportResult.page(1))
43
- end
44
- end
45
-
46
- describe "When logged in as User" do
47
- login_fixture_user
48
-
49
- it "assigns empty as @user_import_results" do
50
- get :index
51
- assigns(:user_import_results).should be_nil
52
- response.should be_forbidden
53
- end
54
- end
55
-
56
- describe "When not logged in" do
57
- it "assigns empty as @user_import_results" do
58
- get :index
59
- assigns(:user_import_results).should be_nil
60
- response.should redirect_to(new_user_session_url)
61
- end
62
- end
63
- end
64
-
65
- describe "GET show" do
66
- describe "When logged in as Administrator" do
67
- login_fixture_admin
68
-
69
- it "assigns the requested user_import_result as @user_import_result" do
70
- get :show, id: 1
71
- assigns(:user_import_result).should eq(UserImportResult.find(1))
72
- end
73
- end
74
-
75
- describe "When logged in as Librarian" do
76
- login_fixture_librarian
77
-
78
- it "assigns the requested user_import_result as @user_import_result" do
79
- get :show, id: 1
80
- assigns(:user_import_result).should eq(UserImportResult.find(1))
81
- end
82
- end
83
-
84
- describe "When logged in as User" do
85
- login_fixture_user
86
-
87
- it "assigns the requested user_import_result as @user_import_result" do
88
- get :show, id: 1
89
- assigns(:user_import_result).should eq(UserImportResult.find(1))
90
- end
91
- end
92
-
93
- describe "When not logged in" do
94
- it "assigns the requested user_import_result as @user_import_result" do
95
- get :show, id: 1
96
- assigns(:user_import_result).should eq(UserImportResult.find(1))
97
- response.should redirect_to(new_user_session_url)
98
- end
99
- end
100
- end
101
-
102
- describe "DELETE destroy" do
103
- before(:each) do
104
- @user_import_result = user_import_results(:one)
105
- end
106
-
107
- describe "When logged in as Administrator" do
108
- login_fixture_admin
109
-
110
- it "destroys the requested user_import_result" do
111
- delete :destroy, id: @user_import_result.id
112
- end
113
-
114
- it "should be forbidden" do
115
- delete :destroy, id: @user_import_result.id
116
- response.should be_forbidden
117
- end
118
- end
119
-
120
- describe "When logged in as Librarian" do
121
- login_fixture_librarian
122
-
123
- it "destroys the requested user_import_result" do
124
- delete :destroy, id: @user_import_result.id
125
- end
126
-
127
- it "should be forbidden" do
128
- delete :destroy, id: @user_import_result.id
129
- response.should be_forbidden
130
- end
131
- end
132
-
133
- describe "When logged in as User" do
134
- login_fixture_user
135
-
136
- it "destroys the requested user_import_result" do
137
- delete :destroy, id: @user_import_result.id
138
- end
139
-
140
- it "should be forbidden" do
141
- delete :destroy, id: @user_import_result.id
142
- response.should be_forbidden
143
- end
144
- end
145
-
146
- describe "When not logged in" do
147
- it "destroys the requested user_import_result" do
148
- delete :destroy, id: @user_import_result.id
149
- end
150
-
151
- it "should be forbidden" do
152
- delete :destroy, id: @user_import_result.id
153
- response.should redirect_to(new_user_session_url)
154
- end
155
- end
156
- end
157
- end