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,136 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe RolesController 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 roles as @roles" do
11
- get :index
12
- expect(assigns(:roles)).to eq(Role.order(:position))
13
- end
14
- end
15
-
16
- describe "When logged in as Librarian" do
17
- login_fixture_librarian
18
-
19
- it "assigns all roles as @roles" do
20
- get :index
21
- expect(assigns(:roles)).to eq(Role.order(:position))
22
- end
23
- end
24
-
25
- describe "When logged in as User" do
26
- login_fixture_user
27
-
28
- it "assigns all roles as @roles" do
29
- get :index
30
- expect(assigns(:roles)).to be_nil
31
- end
32
- end
33
-
34
- describe "When not logged in" do
35
- it "assigns all roles as @roles" do
36
- get :index
37
- expect(assigns(:roles)).to be_nil
38
- end
39
- end
40
- end
41
-
42
- describe "GET show" do
43
- describe "When logged in as Administrator" do
44
- login_fixture_admin
45
-
46
- it "assigns the requested role as @role" do
47
- role = Role.find(1)
48
- get :show, id: role.id
49
- expect(assigns(:role)).to eq(role)
50
- end
51
- end
52
-
53
- describe "When not logged in" do
54
- it "assigns the requested role as @role" do
55
- role = Role.find(1)
56
- get :show, id: role.id
57
- expect(assigns(:role)).to eq(role)
58
- end
59
- end
60
- end
61
-
62
- describe "GET edit" do
63
- describe "When logged in as Administrator" do
64
- login_fixture_admin
65
-
66
- it "assigns the requested role as @role" do
67
- role = Role.find(1)
68
- get :edit, id: role.id
69
- expect(assigns(:role)).to eq(role)
70
- end
71
- end
72
-
73
- describe "When not logged in" do
74
- it "should not assign the requested role as @role" do
75
- role = Role.find(1)
76
- get :edit, id: role.id
77
- expect(response).to redirect_to(new_user_session_url)
78
- end
79
- end
80
- end
81
-
82
- describe "PUT update" do
83
- before(:each) do
84
- @role = Role.find(1)
85
- @attrs = {:display_name => 'guest user'}
86
- @invalid_attrs = {name: ''}
87
- end
88
-
89
- describe "When logged in as Administrator" do
90
- login_fixture_admin
91
-
92
- describe "with valid params" do
93
- it "updates the requested role" do
94
- put :update, id: @role.id, :role => @attrs
95
- end
96
-
97
- it "assigns the requested role as @role" do
98
- put :update, id: @role.id, :role => @attrs
99
- expect(assigns(:role)).to eq(@role)
100
- end
101
-
102
- it "moves its position when specified" do
103
- put :update, id: @role.id, :role => @attrs, move: 'lower'
104
- expect(response).to redirect_to(roles_url)
105
- end
106
- end
107
-
108
- describe "with invalid params" do
109
- it "assigns the requested role as @role" do
110
- put :update, id: @role.id, :role => @invalid_attrs
111
- expect(response).to render_template("edit")
112
- end
113
- end
114
- end
115
-
116
- describe "When not logged in" do
117
- describe "with valid params" do
118
- it "updates the requested role" do
119
- put :update, id: @role.id, :role => @attrs
120
- end
121
-
122
- it "should be forbidden" do
123
- put :update, id: @role.id, :role => @attrs
124
- expect(response).to redirect_to(new_user_session_url)
125
- end
126
- end
127
-
128
- describe "with invalid params" do
129
- it "assigns the requested role as @role" do
130
- put :update, id: @role.id, :role => @invalid_attrs
131
- expect(response).to redirect_to(new_user_session_url)
132
- end
133
- end
134
- end
135
- end
136
- end
@@ -1,296 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe UserExportFilesController 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_export_files as @user_export_files" do
11
- get :index
12
- assigns(:user_export_files).should eq(UserExportFile.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 empty as @user_export_files" do
20
- get :index
21
- assigns(:user_export_files).should be_nil
22
- end
23
- end
24
-
25
- describe "When logged in as User" do
26
- login_fixture_user
27
-
28
- it "assigns empty as @user_export_files" do
29
- get :index
30
- assigns(:user_export_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_export_files" do
37
- get :index
38
- assigns(:user_export_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_export_file as @user_export_file" do
49
- get :show, id: user_export_files(:user_export_file_00003).id
50
- assigns(:user_export_file).should eq(user_export_files(:user_export_file_00003))
51
- expect(response).to be_success
52
- end
53
- end
54
-
55
- describe "When logged in as Librarian" do
56
- login_fixture_librarian
57
-
58
- it "assigns the requested user_export_file as @user_export_file" do
59
- get :show, id: user_export_files(:user_export_file_00003).id
60
- assigns(:user_export_file).should eq(user_export_files(:user_export_file_00003))
61
- expect(response).to be_forbidden
62
- end
63
- end
64
-
65
- describe "When logged in as User" do
66
- login_fixture_user
67
-
68
- it "assigns the requested user_export_file as @user_export_file" do
69
- get :show, id: user_export_files(:user_export_file_00003).id
70
- assigns(:user_export_file).should eq(user_export_files(:user_export_file_00003))
71
- expect(response).to be_forbidden
72
- end
73
- end
74
-
75
- describe "When not logged in" do
76
- it "assigns the requested user_export_file as @user_export_file" do
77
- get :show, id: user_export_files(:user_export_file_00003).id
78
- assigns(:user_export_file).should eq(user_export_files(:user_export_file_00003))
79
- expect(response).to redirect_to(new_user_session_url)
80
- end
81
- end
82
- end
83
-
84
- describe "GET new" do
85
- describe "When logged in as Administrator" do
86
- login_fixture_admin
87
-
88
- it "assigns the requested user_export_file as @user_export_file" do
89
- get :new
90
- assigns(:user_export_file).should be_valid
91
- expect(response).to be_success
92
- end
93
- end
94
-
95
- describe "When logged in as Librarian" do
96
- login_fixture_librarian
97
-
98
- it "should not assign the requested user_export_file as @user_export_file" do
99
- get :new
100
- assigns(:user_export_file).should be_nil
101
- expect(response).to be_forbidden
102
- end
103
- end
104
-
105
- describe "When logged in as User" do
106
- login_fixture_user
107
-
108
- it "should not assign the requested user_export_file as @user_export_file" do
109
- get :new
110
- assigns(:user_export_file).should be_nil
111
- expect(response).to be_forbidden
112
- end
113
- end
114
-
115
- describe "When not logged in" do
116
- it "should not assign the requested user_export_file as @user_export_file" do
117
- get :new
118
- assigns(:user_export_file).should be_nil
119
- expect(response).to redirect_to(new_user_session_url)
120
- end
121
- end
122
- end
123
-
124
- describe "POST create" do
125
- describe "When logged in as Administrator" do
126
- login_fixture_admin
127
-
128
- it "should create agent_export_file" do
129
- post :create, user_export_file: {mode: 'export'}
130
- assigns(:user_export_file).should be_valid
131
- assigns(:user_export_file).user.username.should eq @user.username
132
- expect(response).to redirect_to user_export_file_url(assigns(:user_export_file))
133
- end
134
- end
135
-
136
- describe "When logged in as Librarian" do
137
- login_fixture_librarian
138
-
139
- it "should create agent_export_file" do
140
- post :create, user_export_file: {mode: 'export'}
141
- assigns(:user_export_file).should be_nil
142
- expect(response).to be_forbidden
143
- end
144
- end
145
-
146
- describe "When logged in as User" do
147
- login_fixture_user
148
-
149
- it "should be forbidden" do
150
- post :create, user_export_file: {mode: 'export'}
151
- assigns(:user_export_file).should be_nil
152
- expect(response).to be_forbidden
153
- end
154
- end
155
-
156
- describe "When not logged in" do
157
- it "should be redirected to new session url" do
158
- post :create, user_export_file: {mode: 'export'}
159
- assigns(:user_export_file).should be_nil
160
- expect(response).to redirect_to new_user_session_url
161
- end
162
- end
163
- end
164
-
165
- describe "GET edit" do
166
- describe "When logged in as Administrator" do
167
- login_fixture_admin
168
-
169
- it "assigns the requested user_export_file as @user_export_file" do
170
- user_export_file = user_export_files(:user_export_file_00001)
171
- get :edit, id: user_export_file.id
172
- assigns(:user_export_file).should eq(user_export_file)
173
- end
174
- end
175
-
176
- describe "When logged in as Librarian" do
177
- login_fixture_librarian
178
-
179
- it "assigns the requested user_export_file as @user_export_file" do
180
- user_export_file = user_export_files(:user_export_file_00001)
181
- get :edit, id: user_export_file.id
182
- expect(response).to be_forbidden
183
- end
184
- end
185
-
186
- describe "When logged in as User" do
187
- login_fixture_user
188
-
189
- it "assigns the requested user_export_file as @user_export_file" do
190
- user_export_file = user_export_files(:user_export_file_00001)
191
- get :edit, id: user_export_file.id
192
- expect(response).to be_forbidden
193
- end
194
- end
195
-
196
- describe "When not logged in" do
197
- it "should not assign the requested user_export_file as @user_export_file" do
198
- user_export_file = user_export_files(:user_export_file_00001)
199
- get :edit, id: user_export_file.id
200
- expect(response).to redirect_to(new_user_session_url)
201
- end
202
- end
203
- end
204
-
205
- describe "PUT update" do
206
- describe "When logged in as Administrator" do
207
- login_fixture_admin
208
-
209
- it "should update user_export_file" do
210
- put :update, id: user_export_files(:user_export_file_00003).id, user_export_file: {mode: 'export'}
211
- expect(response).to redirect_to user_export_file_url(assigns(:user_export_file))
212
- end
213
- end
214
-
215
- describe "When logged in as Librarian" do
216
- login_fixture_librarian
217
-
218
- it "should update user_export_file" do
219
- put :update, id: user_export_files(:user_export_file_00003).id, user_export_file: {mode: 'export'}
220
- expect(response).to be_forbidden
221
- end
222
- end
223
-
224
- describe "When logged in as User" do
225
- login_fixture_user
226
-
227
- it "should not update user_export_file" do
228
- put :update, id: user_export_files(:user_export_file_00003).id, user_export_file: {mode: 'export'}
229
- expect(response).to be_forbidden
230
- end
231
- end
232
-
233
- describe "When not logged in" do
234
- it "should not update user_export_file" do
235
- put :update, id: user_export_files(:user_export_file_00003).id, user_export_file: {mode: 'export'}
236
- expect(response).to redirect_to new_user_session_url
237
- end
238
- end
239
- end
240
-
241
- describe "DELETE destroy" do
242
- before(:each) do
243
- @user_export_file = user_export_files(:user_export_file_00001)
244
- end
245
-
246
- describe "When logged in as Administrator" do
247
- login_fixture_admin
248
-
249
- it "destroys the requested user_export_file" do
250
- delete :destroy, id: @user_export_file.id
251
- end
252
-
253
- it "redirects to the user_export_files list" do
254
- delete :destroy, id: @user_export_file.id
255
- expect(response).to redirect_to(user_export_files_url)
256
- end
257
- end
258
-
259
- describe "When logged in as Librarian" do
260
- login_fixture_librarian
261
-
262
- it "destroys the requested user_export_file" do
263
- delete :destroy, id: @user_export_file.id
264
- end
265
-
266
- it "should be forbidden" do
267
- delete :destroy, id: @user_export_file.id
268
- expect(response).to be_forbidden
269
- end
270
- end
271
-
272
- describe "When logged in as User" do
273
- login_fixture_user
274
-
275
- it "destroys the requested user_export_file" do
276
- delete :destroy, id: @user_export_file.id
277
- end
278
-
279
- it "should be forbidden" do
280
- delete :destroy, id: @user_export_file.id
281
- expect(response).to be_forbidden
282
- end
283
- end
284
-
285
- describe "When not logged in" do
286
- it "destroys the requested user_export_file" do
287
- delete :destroy, id: @user_export_file.id
288
- end
289
-
290
- it "should be forbidden" do
291
- delete :destroy, id: @user_export_file.id
292
- expect(response).to redirect_to(new_user_session_url)
293
- end
294
- end
295
- end
296
- end
@@ -1,443 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe UserGroupsController do
4
- fixtures :all
5
-
6
- def valid_attributes
7
- FactoryGirl.attributes_for(:user_group)
8
- end
9
-
10
- describe "GET index" do
11
- before(:each) do
12
- FactoryGirl.create(:user_group)
13
- end
14
-
15
- describe "When logged in as Administrator" do
16
- login_fixture_admin
17
-
18
- it "assigns all user_groups as @user_groups" do
19
- get :index
20
- assigns(:user_groups).should eq(UserGroup.order(:position))
21
- end
22
- end
23
-
24
- describe "When logged in as Librarian" do
25
- login_fixture_librarian
26
-
27
- it "assigns all user_groups as @user_groups" do
28
- get :index
29
- assigns(:user_groups).should eq(UserGroup.order(:position))
30
- end
31
- end
32
-
33
- describe "When logged in as User" do
34
- login_fixture_user
35
-
36
- it "assigns all user_groups as @user_groups" do
37
- get :index
38
- assigns(:user_groups).should eq(UserGroup.order(:position))
39
- end
40
- end
41
-
42
- describe "When not logged in" do
43
- it "assigns all user_groups as @user_groups" do
44
- get :index
45
- assigns(:user_groups).should eq(UserGroup.order(:position))
46
- end
47
- end
48
- end
49
-
50
- describe "GET show" do
51
- describe "When logged in as Administrator" do
52
- login_fixture_admin
53
-
54
- it "assigns the requested user_group as @user_group" do
55
- user_group = FactoryGirl.create(:user_group)
56
- get :show, id: user_group.id
57
- assigns(:user_group).should eq(user_group)
58
- end
59
- end
60
-
61
- describe "When logged in as Librarian" do
62
- login_fixture_librarian
63
-
64
- it "assigns the requested user_group as @user_group" do
65
- user_group = FactoryGirl.create(:user_group)
66
- get :show, id: user_group.id
67
- assigns(:user_group).should eq(user_group)
68
- end
69
- end
70
-
71
- describe "When logged in as User" do
72
- login_fixture_user
73
-
74
- it "assigns the requested user_group as @user_group" do
75
- user_group = FactoryGirl.create(:user_group)
76
- get :show, id: user_group.id
77
- assigns(:user_group).should eq(user_group)
78
- end
79
- end
80
-
81
- describe "When not logged in" do
82
- it "assigns the requested user_group as @user_group" do
83
- user_group = FactoryGirl.create(:user_group)
84
- get :show, id: user_group.id
85
- assigns(:user_group).should eq(user_group)
86
- end
87
- end
88
- end
89
-
90
- describe "GET new" do
91
- describe "When logged in as Administrator" do
92
- login_fixture_admin
93
-
94
- it "assigns the requested user_group as @user_group" do
95
- get :new
96
- assigns(:user_group).should_not be_valid
97
- expect(response).to be_success
98
- end
99
- end
100
-
101
- describe "When logged in as Librarian" do
102
- login_fixture_librarian
103
-
104
- it "should not assign the requested user_group as @user_group" do
105
- get :new
106
- assigns(:user_group).should be_nil
107
- expect(response).to be_forbidden
108
- end
109
- end
110
-
111
- describe "When logged in as User" do
112
- login_fixture_user
113
-
114
- it "should not assign the requested user_group as @user_group" do
115
- get :new
116
- assigns(:user_group).should be_nil
117
- expect(response).to be_forbidden
118
- end
119
- end
120
-
121
- describe "When not logged in" do
122
- it "should not assign the requested user_group as @user_group" do
123
- get :new
124
- assigns(:user_group).should be_nil
125
- expect(response).to redirect_to(new_user_session_url)
126
- end
127
- end
128
- end
129
-
130
- describe "GET edit" do
131
- describe "When logged in as Administrator" do
132
- login_fixture_admin
133
-
134
- it "assigns the requested user_group as @user_group" do
135
- user_group = FactoryGirl.create(:user_group)
136
- get :edit, id: user_group.id
137
- assigns(:user_group).should eq(user_group)
138
- end
139
- end
140
-
141
- describe "When logged in as Librarian" do
142
- login_fixture_librarian
143
-
144
- it "assigns the requested user_group as @user_group" do
145
- user_group = FactoryGirl.create(:user_group)
146
- get :edit, id: user_group.id
147
- expect(response).to be_forbidden
148
- end
149
- end
150
-
151
- describe "When logged in as User" do
152
- login_fixture_user
153
-
154
- it "assigns the requested user_group as @user_group" do
155
- user_group = FactoryGirl.create(:user_group)
156
- get :edit, id: user_group.id
157
- expect(response).to be_forbidden
158
- end
159
- end
160
-
161
- describe "When not logged in" do
162
- it "should not assign the requested user_group as @user_group" do
163
- user_group = FactoryGirl.create(:user_group)
164
- get :edit, id: user_group.id
165
- expect(response).to redirect_to(new_user_session_url)
166
- end
167
- end
168
- end
169
-
170
- describe "POST create" do
171
- before(:each) do
172
- @attrs = valid_attributes
173
- @invalid_attrs = {name: ''}
174
- end
175
-
176
- describe "When logged in as Administrator" do
177
- login_fixture_admin
178
-
179
- describe "with valid params" do
180
- it "assigns a newly created user_group as @user_group" do
181
- post :create, user_group: @attrs
182
- assigns(:user_group).should be_valid
183
- end
184
-
185
- it "redirects to the created patron" do
186
- post :create, user_group: @attrs
187
- expect(response).to redirect_to(assigns(:user_group))
188
- end
189
- end
190
-
191
- describe "with invalid params" do
192
- it "assigns a newly created but unsaved user_group as @user_group" do
193
- post :create, user_group: @invalid_attrs
194
- assigns(:user_group).should_not be_valid
195
- end
196
-
197
- it "re-renders the 'new' template" do
198
- post :create, user_group: @invalid_attrs
199
- expect(response).to render_template("new")
200
- end
201
- end
202
- end
203
-
204
- describe "When logged in as Librarian" do
205
- login_fixture_librarian
206
-
207
- describe "with valid params" do
208
- it "assigns a newly created user_group as @user_group" do
209
- post :create, user_group: @attrs
210
- assigns(:user_group).should be_nil
211
- end
212
-
213
- it "should be forbidden" do
214
- post :create, user_group: @attrs
215
- expect(response).to be_forbidden
216
- end
217
- end
218
-
219
- describe "with invalid params" do
220
- it "assigns a newly created but unsaved user_group as @user_group" do
221
- post :create, user_group: @invalid_attrs
222
- assigns(:user_group).should be_nil
223
- end
224
-
225
- it "should be forbidden" do
226
- post :create, user_group: @invalid_attrs
227
- expect(response).to be_forbidden
228
- end
229
- end
230
- end
231
-
232
- describe "When logged in as User" do
233
- login_fixture_user
234
-
235
- describe "with valid params" do
236
- it "assigns a newly created user_group as @user_group" do
237
- post :create, user_group: @attrs
238
- assigns(:user_group).should be_nil
239
- end
240
-
241
- it "should be forbidden" do
242
- post :create, user_group: @attrs
243
- expect(response).to be_forbidden
244
- end
245
- end
246
-
247
- describe "with invalid params" do
248
- it "assigns a newly created but unsaved user_group as @user_group" do
249
- post :create, user_group: @invalid_attrs
250
- assigns(:user_group).should be_nil
251
- end
252
-
253
- it "should be forbidden" do
254
- post :create, user_group: @invalid_attrs
255
- expect(response).to be_forbidden
256
- end
257
- end
258
- end
259
-
260
- describe "When not logged in" do
261
- describe "with valid params" do
262
- it "assigns a newly created user_group as @user_group" do
263
- post :create, user_group: @attrs
264
- assigns(:user_group).should be_nil
265
- end
266
-
267
- it "should be forbidden" do
268
- post :create, user_group: @attrs
269
- expect(response).to redirect_to(new_user_session_url)
270
- end
271
- end
272
-
273
- describe "with invalid params" do
274
- it "assigns a newly created but unsaved user_group as @user_group" do
275
- post :create, user_group: @invalid_attrs
276
- assigns(:user_group).should be_nil
277
- end
278
-
279
- it "should be forbidden" do
280
- post :create, user_group: @invalid_attrs
281
- expect(response).to redirect_to(new_user_session_url)
282
- end
283
- end
284
- end
285
- end
286
-
287
- describe "PUT update" do
288
- before(:each) do
289
- @user_group = FactoryGirl.create(:user_group)
290
- @attrs = valid_attributes
291
- @invalid_attrs = {name: ''}
292
- end
293
-
294
- describe "When logged in as Administrator" do
295
- login_fixture_admin
296
-
297
- describe "with valid params" do
298
- it "updates the requested user_group" do
299
- put :update, id: @user_group.id, user_group: @attrs
300
- end
301
-
302
- it "assigns the requested user_group as @user_group" do
303
- put :update, id: @user_group.id, user_group: @attrs
304
- assigns(:user_group).should eq(@user_group)
305
- end
306
-
307
- it "moves its position when specified" do
308
- put :update, id: @user_group.id, user_group: @attrs, :move => 'lower'
309
- expect(response).to redirect_to(user_groups_url)
310
- end
311
- end
312
-
313
- describe "with invalid params" do
314
- it "assigns the requested user_group as @user_group" do
315
- put :update, id: @user_group.id, user_group: @invalid_attrs
316
- expect(response).to render_template("edit")
317
- end
318
- end
319
- end
320
-
321
- describe "When logged in as Librarian" do
322
- login_fixture_librarian
323
-
324
- describe "with valid params" do
325
- it "updates the requested user_group" do
326
- put :update, id: @user_group.id, user_group: @attrs
327
- end
328
-
329
- it "assigns the requested user_group as @user_group" do
330
- put :update, id: @user_group.id, user_group: @attrs
331
- assigns(:user_group).should eq(@user_group)
332
- expect(response).to be_forbidden
333
- end
334
- end
335
-
336
- describe "with invalid params" do
337
- it "assigns the requested user_group as @user_group" do
338
- put :update, id: @user_group.id, user_group: @invalid_attrs
339
- expect(response).to be_forbidden
340
- end
341
- end
342
- end
343
-
344
- describe "When logged in as User" do
345
- login_fixture_user
346
-
347
- describe "with valid params" do
348
- it "updates the requested user_group" do
349
- put :update, id: @user_group.id, user_group: @attrs
350
- end
351
-
352
- it "assigns the requested user_group as @user_group" do
353
- put :update, id: @user_group.id, user_group: @attrs
354
- assigns(:user_group).should eq(@user_group)
355
- expect(response).to be_forbidden
356
- end
357
- end
358
-
359
- describe "with invalid params" do
360
- it "assigns the requested user_group as @user_group" do
361
- put :update, id: @user_group.id, user_group: @invalid_attrs
362
- expect(response).to be_forbidden
363
- end
364
- end
365
- end
366
-
367
- describe "When not logged in" do
368
- describe "with valid params" do
369
- it "updates the requested user_group" do
370
- put :update, id: @user_group.id, user_group: @attrs
371
- end
372
-
373
- it "should be forbidden" do
374
- put :update, id: @user_group.id, user_group: @attrs
375
- expect(response).to redirect_to(new_user_session_url)
376
- end
377
- end
378
-
379
- describe "with invalid params" do
380
- it "assigns the requested user_group as @user_group" do
381
- put :update, id: @user_group.id, user_group: @invalid_attrs
382
- expect(response).to redirect_to(new_user_session_url)
383
- end
384
- end
385
- end
386
- end
387
-
388
- describe "DELETE destroy" do
389
- before(:each) do
390
- @user_group = FactoryGirl.create(:user_group)
391
- end
392
-
393
- describe "When logged in as Administrator" do
394
- login_fixture_admin
395
-
396
- it "destroys the requested user_group" do
397
- delete :destroy, id: @user_group.id
398
- end
399
-
400
- it "redirects to the user_groups list" do
401
- delete :destroy, id: @user_group.id
402
- expect(response).to redirect_to(user_groups_url)
403
- end
404
- end
405
-
406
- describe "When logged in as Librarian" do
407
- login_fixture_librarian
408
-
409
- it "destroys the requested user_group" do
410
- delete :destroy, id: @user_group.id
411
- end
412
-
413
- it "should be forbidden" do
414
- delete :destroy, id: @user_group.id
415
- expect(response).to be_forbidden
416
- end
417
- end
418
-
419
- describe "When logged in as User" do
420
- login_fixture_user
421
-
422
- it "destroys the requested user_group" do
423
- delete :destroy, id: @user_group.id
424
- end
425
-
426
- it "should be forbidden" do
427
- delete :destroy, id: @user_group.id
428
- expect(response).to be_forbidden
429
- end
430
- end
431
-
432
- describe "When not logged in" do
433
- it "destroys the requested user_group" do
434
- delete :destroy, id: @user_group.id
435
- end
436
-
437
- it "should be forbidden" do
438
- delete :destroy, id: @user_group.id
439
- expect(response).to redirect_to(new_user_session_url)
440
- end
441
- end
442
- end
443
- end