enju_circulation 0.3.9 → 0.4.0.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/app/controllers/checkins_controller.rb +2 -2
- data/app/controllers/user_group_has_checkout_types_controller.rb +1 -1
- data/app/helpers/items_helper.rb +3 -3
- data/app/models/checked_item.rb +7 -17
- data/app/models/checkin.rb +3 -2
- data/app/models/checkout.rb +2 -2
- data/app/models/checkout_stat_has_user.rb +1 -1
- data/app/models/checkout_type.rb +9 -7
- data/app/models/circulation_status.rb +9 -8
- data/app/models/concerns/enju_circulation/enju_item.rb +2 -46
- data/app/models/concerns/enju_circulation/enju_user_group.rb +0 -1
- data/app/models/concerns/enju_circulation/enju_withdraw.rb +1 -7
- data/app/models/manifestation_checkout_stat_transition.rb +1 -1
- data/app/models/manifestation_reserve_stat_transition.rb +1 -1
- data/app/models/reserve.rb +5 -5
- data/app/models/reserve_state_machine.rb +3 -2
- data/app/models/reserve_transition.rb +1 -1
- data/app/models/retain.rb +15 -0
- data/app/models/user_checkout_stat_transition.rb +1 -1
- data/app/models/user_group_has_checkout_type.rb +15 -37
- data/app/models/user_reserve_stat_transition.rb +1 -1
- data/app/views/carrier_type_has_checkout_types/_form.html.erb +2 -2
- data/app/views/carrier_type_has_checkout_types/index.html.erb +2 -2
- data/app/views/carrier_type_has_checkout_types/show.html.erb +2 -2
- data/app/views/carrier_types/_carrier_type_has_checkout_type_fields.html.erb +1 -1
- data/app/views/checked_items/new.html.erb +1 -1
- data/app/views/checkins/_checkin.html.erb +1 -1
- data/app/views/checkout_types/_form.html.erb +1 -1
- data/app/views/checkout_types/index.html.erb +1 -1
- data/app/views/checkout_types/show.html.erb +2 -2
- data/app/views/checkouts/_index_user.html.erb +1 -1
- data/app/views/checkouts/_list.html.erb +2 -9
- data/app/views/checkouts/index.atom.builder +1 -1
- data/app/views/checkouts/index.ics.erb +1 -1
- data/app/views/checkouts/index.rss.builder +1 -1
- data/app/views/circulation_statuses/_form.html.erb +1 -1
- data/app/views/circulation_statuses/index.html.erb +1 -1
- data/app/views/circulation_statuses/show.html.erb +1 -1
- data/app/views/item_has_use_restrictions/index.html.erb +1 -1
- data/app/views/item_has_use_restrictions/show.html.erb +1 -1
- data/app/views/manifestation_checkout_stats/_group_by_carrier_type.html.erb +3 -3
- data/app/views/manifestation_checkout_stats/_group_by_checkout_type.html.erb +3 -3
- data/app/views/manifestations/_circulation_status.html.erb +3 -3
- data/app/views/profiles/_submenu_checkout.html.erb +1 -1
- data/app/views/reserves/_new.html.erb +1 -1
- data/app/views/reserves/_new_user.html.erb +1 -1
- data/app/views/reserves/edit.html.erb +1 -1
- data/app/views/reserves/index.atom.builder +1 -1
- data/app/views/reserves/index.html.erb +1 -1
- data/app/views/reserves/index.rss.builder +1 -1
- data/app/views/reserves/show.html.erb +1 -1
- data/app/views/use_restrictions/_form.html.erb +1 -1
- data/app/views/use_restrictions/index.html.erb +1 -1
- data/app/views/use_restrictions/show.html.erb +1 -1
- data/app/views/user_group_has_checkout_types/edit.html.erb +4 -4
- data/app/views/user_group_has_checkout_types/index.html.erb +2 -2
- data/app/views/user_group_has_checkout_types/new.html.erb +4 -4
- data/app/views/user_group_has_checkout_types/show.html.erb +4 -4
- data/app/views/user_groups/_user_group_has_checkout_type_fields.html.erb +2 -2
- data/config/locales/translation_en.yml +1 -14
- data/config/locales/translation_ja.yml +1 -14
- data/config/routes.rb +1 -2
- data/db/migrate/20110627122938_add_number_of_day_to_notify_overdue_to_user_group.rb +3 -3
- data/db/migrate/20190508160525_create_retains.rb +10 -0
- data/db/migrate/20190629134017_rename_user_group_has_checkout_type_due_date_before_to_due_date_after.rb +5 -0
- data/db/migrate/20190706052525_add_display_name_translations_to_circulation_status.rb +5 -0
- data/db/migrate/20190713114724_add_checkout_id_to_checkin.rb +5 -0
- data/db/migrate/20190814120827_add_display_name_translations_to_checkout_type.rb +5 -0
- data/lib/enju_circulation/version.rb +1 -1
- data/lib/generators/enju_circulation/setup/templates/db/fixtures/checkout_types.yml +3 -5
- data/lib/generators/enju_circulation/setup/templates/db/fixtures/circulation_statuses.yml +16 -48
- data/lib/tasks/enju_circulation_tasks.rake +7 -1
- data/spec/concerns/enju_accept_spec.rb +14 -14
- data/spec/controllers/accepts_controller_spec.rb +294 -0
- data/spec/controllers/baskets_controller_spec.rb +379 -0
- data/spec/controllers/checkins_controller_spec.rb +8 -130
- data/spec/controllers/items_controller_spec.rb +23 -43
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/bin/bundle +1 -1
- data/spec/dummy/bin/setup +1 -3
- data/spec/dummy/bin/update +4 -2
- data/spec/dummy/bin/yarn +3 -3
- data/spec/dummy/config/database.yml +70 -9
- data/spec/dummy/config/initializers/assets.rb +1 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/113_create_events.rb +2 -4
- data/spec/dummy/db/migrate/20081028093607_create_event_import_files.rb +2 -4
- data/spec/dummy/db/migrate/20090519203307_create_participates.rb +2 -4
- data/spec/dummy/db/migrate/20100925074639_create_event_import_results.rb +2 -2
- data/spec/dummy/db/migrate/20140720192418_add_default_library_id_to_event_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20140812152348_create_event_export_files.rb +1 -1
- data/spec/dummy/db/migrate/20140814070854_add_default_event_category_id_to_event_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20151128142913_create_places.rb +14 -0
- data/spec/dummy/db/migrate/20151201163718_add_place_id_to_event.rb +5 -0
- data/spec/dummy/db/migrate/20160703184258_add_most_recent_to_event_import_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160703184311_add_most_recent_to_event_export_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20180107160726_add_constraints_to_most_recent_for_user_import_file_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20180107160740_add_constraints_to_most_recent_for_user_export_file_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20180107164558_add_constraints_to_most_recent_for_event_import_file_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107164617_add_constraints_to_most_recent_for_event_export_file_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20181119170645_add_foreign_key_to_events_referencing_event_categories.rb +5 -0
- data/spec/dummy/db/migrate/20190630113817_add_display_name_translations_to_library_group.rb +12 -0
- data/spec/dummy/db/migrate/20190630115523_add_login_banner_translations_to_library_group.rb +6 -0
- data/spec/dummy/db/migrate/20190630151446_add_display_name_translations_to_role.rb +5 -0
- data/spec/dummy/db/migrate/20190630153136_add_display_name_translations_to_event.rb +6 -0
- data/spec/dummy/db/migrate/20190712163038_add_display_name_translations_to_carrier_type.rb +21 -0
- data/spec/dummy/db/migrate/20190713114940_add_profile_id_to_user.rb +5 -0
- data/spec/dummy/db/migrate/20190713115451_add_full_name_translations_to_profile.rb +5 -0
- data/spec/dummy/db/schema.rb +221 -184
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/private/system/carrier_types/attachments/000/000/001/original/book.png +0 -0
- data/spec/dummy/private/system/carrier_types/attachments/000/000/001/thumb/book.png +0 -0
- data/spec/factories/accept.rb +1 -1
- data/spec/factories/item.rb +4 -4
- data/spec/factories/reserve.rb +1 -5
- data/spec/fixtures/carrier_types.yml +16 -15
- data/spec/fixtures/checkins.yml +2 -1
- data/spec/fixtures/checkout_stat_has_users.yml +1 -1
- data/spec/fixtures/checkout_types.yml +11 -10
- data/spec/fixtures/checkouts.yml +2 -2
- data/spec/fixtures/circulation_statuses.yml +26 -34
- data/spec/fixtures/content_types.yml +20 -31
- data/spec/fixtures/event_categories.yml +23 -23
- data/spec/fixtures/frequencies.yml +17 -25
- data/spec/fixtures/items.yml +1 -1
- data/spec/fixtures/libraries.yml +30 -31
- data/spec/fixtures/library_groups.yml +43 -20
- data/spec/fixtures/request_status_types.yml +14 -14
- data/spec/fixtures/request_types.yml +13 -13
- data/spec/fixtures/reserve_transitions.yml +1 -1
- data/spec/fixtures/reserves.yml +3 -3
- data/spec/fixtures/roles.yml +22 -5
- data/spec/fixtures/shelves.yml +16 -15
- data/spec/fixtures/user_group_has_checkout_types.yml +24 -24
- data/spec/fixtures/user_groups.yml +23 -3
- data/spec/helpers/items_helper_spec.rb +1 -1
- data/spec/models/checkin_spec.rb +2 -1
- data/spec/models/checkout_spec.rb +2 -2
- data/spec/models/checkout_stat_has_user_spec.rb +1 -1
- data/spec/models/checkout_type_spec.rb +8 -7
- data/spec/models/circulation_status_spec.rb +8 -7
- data/spec/models/item_spec.rb +6 -8
- data/spec/models/manifestation_spec.rb +15 -18
- data/spec/models/reserve_spec.rb +3 -3
- data/spec/models/resource_export_file_spec.rb +0 -15
- data/spec/models/retain_spec.rb +16 -0
- data/spec/models/user_group_has_checkout_type_spec.rb +15 -32
- data/spec/models/withdraw_spec.rb +4 -6
- data/spec/policies/manifestation_policy_spec.rb +2 -1
- data/spec/rails_helper.rb +10 -3
- data/spec/views/items/index.html.erb_spec.rb +1 -4
- metadata +396 -446
- data/app/controllers/lending_policies_controller.rb +0 -106
- data/app/models/lending_policy.rb +0 -30
- data/app/views/lending_policies/_form.html.erb +0 -41
- data/app/views/lending_policies/edit.html.erb +0 -13
- data/app/views/lending_policies/index.html.erb +0 -42
- data/app/views/lending_policies/new.html.erb +0 -12
- data/app/views/lending_policies/show.html.erb +0 -50
- data/db/migrate/20090831220301_create_lending_policies.rb +0 -21
- data/spec/controllers/lending_policies_controller_spec.rb +0 -444
- data/spec/controllers/withdraws_controller_spec.rb +0 -26
- data/spec/dummy/config/locales/en.yml +0 -208
- data/spec/dummy/config/locales/ja.yml +0 -200
- data/spec/dummy/db/migrate/20190818075603_add_memo_to_manifestation.rb +0 -5
- data/spec/dummy/db/migrate/20190818075628_add_memo_to_item.rb +0 -5
- data/spec/dummy/db/migrate/20200425072340_create_manifestation_custom_properties.rb +0 -12
- data/spec/dummy/db/migrate/20200425072349_create_item_custom_properties.rb +0 -12
- data/spec/dummy/db/migrate/20200425074758_create_manifestation_custom_values.rb +0 -12
- data/spec/dummy/db/migrate/20200425074822_create_item_custom_values.rb +0 -12
- data/spec/fixtures/accepts.yml +0 -9
- data/spec/fixtures/bookstores.yml +0 -99
- data/spec/fixtures/budget_types.yml +0 -30
- data/spec/fixtures/exemplifies.yml +0 -168
- data/spec/fixtures/lending_policies.yml +0 -98
- data/spec/models/lending_policy_spec.rb +0 -23
- data/spec/system/items_spec.rb +0 -21
- data/spec/system/user_group_has_checkout_types.rb +0 -14
@@ -1,444 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
require 'sunspot/rails/spec_helper'
|
3
|
-
|
4
|
-
describe LendingPoliciesController do
|
5
|
-
fixtures :all
|
6
|
-
disconnect_sunspot
|
7
|
-
|
8
|
-
def valid_attributes
|
9
|
-
FactoryBot.attributes_for(:lending_policy)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe 'GET index' do
|
13
|
-
before(:each) do
|
14
|
-
FactoryBot.create(:lending_policy)
|
15
|
-
end
|
16
|
-
|
17
|
-
describe 'When logged in as Administrator' do
|
18
|
-
login_fixture_admin
|
19
|
-
|
20
|
-
it 'assigns all lending_policies as @lending_policies' do
|
21
|
-
get :index
|
22
|
-
assigns(:lending_policies).should eq(LendingPolicy.page(1))
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe 'When logged in as Librarian' do
|
27
|
-
login_fixture_librarian
|
28
|
-
|
29
|
-
it 'assigns all lending_policies as @lending_policies' do
|
30
|
-
get :index
|
31
|
-
assigns(:lending_policies).should eq(LendingPolicy.page(1))
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe 'When logged in as User' do
|
36
|
-
login_fixture_user
|
37
|
-
|
38
|
-
it 'assigns empty as @lending_policies' do
|
39
|
-
get :index
|
40
|
-
assigns(:lending_policies).should be_nil
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe 'When not logged in' do
|
45
|
-
it 'assigns empty lending_policies as @lending_policies' do
|
46
|
-
get :index
|
47
|
-
assigns(:lending_policies).should be_nil
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe 'GET show' do
|
53
|
-
before(:each) do
|
54
|
-
@lending_policy = FactoryBot.create(:lending_policy)
|
55
|
-
end
|
56
|
-
|
57
|
-
describe 'When logged in as Administrator' do
|
58
|
-
login_fixture_admin
|
59
|
-
|
60
|
-
it 'assigns the requested lending_policy as @lending_policy' do
|
61
|
-
get :show, params: { id: @lending_policy.id }
|
62
|
-
assigns(:lending_policy).should eq(@lending_policy)
|
63
|
-
response.should be_successful
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe 'When logged in as Librarian' do
|
68
|
-
login_fixture_librarian
|
69
|
-
|
70
|
-
it 'assigns the requested lending_policy as @lending_policy' do
|
71
|
-
get :show, params: { id: @lending_policy.id }
|
72
|
-
assigns(:lending_policy).should eq(@lending_policy)
|
73
|
-
response.should be_successful
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe 'When logged in as User' do
|
78
|
-
login_fixture_user
|
79
|
-
|
80
|
-
it 'should be forbidden' do
|
81
|
-
get :show, params: { id: @lending_policy.id }
|
82
|
-
assigns(:lending_policy).should eq(@lending_policy)
|
83
|
-
response.should be_forbidden
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
describe 'When not logged in' do
|
88
|
-
it 'should be redirected to new_user_session_url' do
|
89
|
-
get :show, params: { id: @lending_policy.id }
|
90
|
-
assigns(:lending_policy).should eq(@lending_policy)
|
91
|
-
response.should redirect_to new_user_session_url
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe 'GET new' do
|
97
|
-
describe 'When logged in as Administrator' do
|
98
|
-
login_fixture_admin
|
99
|
-
|
100
|
-
it 'assigns the requested lending_policy as @lending_policy' do
|
101
|
-
get :new
|
102
|
-
assigns(:lending_policy).should be_nil
|
103
|
-
response.should be_forbidden
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
describe 'When logged in as Librarian' do
|
108
|
-
login_fixture_librarian
|
109
|
-
|
110
|
-
it 'should not assign the requested lending_policy as @lending_policy' do
|
111
|
-
get :new
|
112
|
-
assigns(:lending_policy).should be_nil
|
113
|
-
response.should be_forbidden
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
describe 'When logged in as User' do
|
118
|
-
login_fixture_user
|
119
|
-
|
120
|
-
it 'should not assign the requested lending_policy as @lending_policy' do
|
121
|
-
get :new
|
122
|
-
assigns(:lending_policy).should be_nil
|
123
|
-
response.should be_forbidden
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
describe 'When not logged in' do
|
128
|
-
it 'should not assign the requested lending_policy as @lending_policy' do
|
129
|
-
get :new
|
130
|
-
assigns(:lending_policy).should be_nil
|
131
|
-
response.should redirect_to(new_user_session_url)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
describe 'GET edit' do
|
137
|
-
describe 'When logged in as Administrator' do
|
138
|
-
login_fixture_admin
|
139
|
-
|
140
|
-
it 'assigns the requested lending_policy as @lending_policy' do
|
141
|
-
lending_policy = FactoryBot.create(:lending_policy)
|
142
|
-
get :edit, params: { id: lending_policy.id }
|
143
|
-
assigns(:lending_policy).should eq(lending_policy)
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
describe 'When logged in as Librarian' do
|
148
|
-
login_fixture_librarian
|
149
|
-
|
150
|
-
it 'assigns the requested lending_policy as @lending_policy' do
|
151
|
-
lending_policy = FactoryBot.create(:lending_policy)
|
152
|
-
get :edit, params: { id: lending_policy.id }
|
153
|
-
response.should be_forbidden
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
describe 'When logged in as User' do
|
158
|
-
login_fixture_user
|
159
|
-
|
160
|
-
it 'assigns the requested lending_policy as @lending_policy' do
|
161
|
-
lending_policy = FactoryBot.create(:lending_policy)
|
162
|
-
get :edit, params: { id: lending_policy.id }
|
163
|
-
response.should be_forbidden
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
describe 'When not logged in' do
|
168
|
-
it 'should not assign the requested lending_policy as @lending_policy' do
|
169
|
-
lending_policy = FactoryBot.create(:lending_policy)
|
170
|
-
get :edit, params: { id: lending_policy.id }
|
171
|
-
response.should redirect_to(new_user_session_url)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
describe 'POST create' do
|
177
|
-
before(:each) do
|
178
|
-
@attrs = valid_attributes
|
179
|
-
@invalid_attrs = { item_id: '' }
|
180
|
-
end
|
181
|
-
|
182
|
-
describe 'When logged in as Administrator' do
|
183
|
-
login_fixture_admin
|
184
|
-
|
185
|
-
describe 'with valid params' do
|
186
|
-
it 'assigns a newly created lending_policy as @lending_policy' do
|
187
|
-
post :create, params: { lending_policy: @attrs }
|
188
|
-
assigns(:lending_policy).should be_nil
|
189
|
-
end
|
190
|
-
|
191
|
-
it 'should be forbidden' do
|
192
|
-
post :create, params: { lending_policy: @attrs }
|
193
|
-
response.should be_forbidden
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
describe 'with invalid params' do
|
198
|
-
it 'assigns a newly created but unsaved lending_policy as @lending_policy' do
|
199
|
-
post :create, params: { lending_policy: @invalid_attrs }
|
200
|
-
assigns(:lending_policy).should be_nil
|
201
|
-
end
|
202
|
-
|
203
|
-
it 'should be forbidden' do
|
204
|
-
post :create, params: { lending_policy: @invalid_attrs }
|
205
|
-
response.should be_forbidden
|
206
|
-
end
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
describe 'When logged in as Librarian' do
|
211
|
-
login_fixture_librarian
|
212
|
-
|
213
|
-
describe 'with valid params' do
|
214
|
-
it 'assigns a newly created lending_policy as @lending_policy' do
|
215
|
-
post :create, params: { lending_policy: @attrs }
|
216
|
-
assigns(:lending_policy).should be_nil
|
217
|
-
end
|
218
|
-
|
219
|
-
it 'should be forbidden' do
|
220
|
-
post :create, params: { lending_policy: @attrs }
|
221
|
-
response.should be_forbidden
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
describe 'with invalid params' do
|
226
|
-
it 'assigns a newly created but unsaved lending_policy as @lending_policy' do
|
227
|
-
post :create, params: { lending_policy: @invalid_attrs }
|
228
|
-
assigns(:lending_policy).should be_nil
|
229
|
-
end
|
230
|
-
|
231
|
-
it 'should be forbidden' do
|
232
|
-
post :create, params: { lending_policy: @invalid_attrs }
|
233
|
-
response.should be_forbidden
|
234
|
-
end
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
describe 'When logged in as User' do
|
239
|
-
login_fixture_user
|
240
|
-
|
241
|
-
describe 'with valid params' do
|
242
|
-
it 'assigns a newly created lending_policy as @lending_policy' do
|
243
|
-
post :create, params: { lending_policy: @attrs }
|
244
|
-
assigns(:lending_policy).should be_nil
|
245
|
-
end
|
246
|
-
|
247
|
-
it 'should be forbidden' do
|
248
|
-
post :create, params: { lending_policy: @attrs }
|
249
|
-
response.should be_forbidden
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
describe 'with invalid params' do
|
254
|
-
it 'assigns a newly created but unsaved lending_policy as @lending_policy' do
|
255
|
-
post :create, params: { lending_policy: @invalid_attrs }
|
256
|
-
assigns(:lending_policy).should be_nil
|
257
|
-
end
|
258
|
-
|
259
|
-
it 'should be forbidden' do
|
260
|
-
post :create, params: { lending_policy: @invalid_attrs }
|
261
|
-
response.should be_forbidden
|
262
|
-
end
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
describe 'When not logged in' do
|
267
|
-
describe 'with valid params' do
|
268
|
-
it 'assigns a newly created lending_policy as @lending_policy' do
|
269
|
-
post :create, params: { lending_policy: @attrs }
|
270
|
-
assigns(:lending_policy).should be_nil
|
271
|
-
end
|
272
|
-
|
273
|
-
it 'should be forbidden' do
|
274
|
-
post :create, params: { lending_policy: @attrs }
|
275
|
-
response.should redirect_to(new_user_session_url)
|
276
|
-
end
|
277
|
-
end
|
278
|
-
|
279
|
-
describe 'with invalid params' do
|
280
|
-
it 'assigns a newly created but unsaved lending_policy as @lending_policy' do
|
281
|
-
post :create, params: { lending_policy: @invalid_attrs }
|
282
|
-
assigns(:lending_policy).should be_nil
|
283
|
-
end
|
284
|
-
|
285
|
-
it 'should be forbidden' do
|
286
|
-
post :create, params: { lending_policy: @invalid_attrs }
|
287
|
-
response.should redirect_to(new_user_session_url)
|
288
|
-
end
|
289
|
-
end
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
describe 'PUT update' do
|
294
|
-
before(:each) do
|
295
|
-
@lending_policy = FactoryBot.create(:lending_policy)
|
296
|
-
@attrs = valid_attributes
|
297
|
-
@invalid_attrs = { item_id: '' }
|
298
|
-
end
|
299
|
-
|
300
|
-
describe 'When logged in as Administrator' do
|
301
|
-
login_fixture_admin
|
302
|
-
|
303
|
-
describe 'with valid params' do
|
304
|
-
it 'updates the requested lending_policy' do
|
305
|
-
put :update, params: { id: @lending_policy.id, lending_policy: @attrs }
|
306
|
-
end
|
307
|
-
|
308
|
-
it 'assigns the requested lending_policy as @lending_policy' do
|
309
|
-
put :update, params: { id: @lending_policy.id, lending_policy: @attrs }
|
310
|
-
assigns(:lending_policy).should eq(@lending_policy)
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
describe 'with invalid params' do
|
315
|
-
it 'assigns the requested lending_policy as @lending_policy' do
|
316
|
-
put :update, params: { id: @lending_policy.id, lending_policy: @invalid_attrs }
|
317
|
-
response.should render_template('edit')
|
318
|
-
end
|
319
|
-
end
|
320
|
-
end
|
321
|
-
|
322
|
-
describe 'When logged in as Librarian' do
|
323
|
-
login_fixture_librarian
|
324
|
-
|
325
|
-
describe 'with valid params' do
|
326
|
-
it 'updates the requested lending_policy' do
|
327
|
-
put :update, params: { id: @lending_policy.id, lending_policy: @attrs }
|
328
|
-
end
|
329
|
-
|
330
|
-
it 'assigns the requested lending_policy as @lending_policy' do
|
331
|
-
put :update, params: { id: @lending_policy.id, lending_policy: @attrs }
|
332
|
-
assigns(:lending_policy).should eq(@lending_policy)
|
333
|
-
response.should be_forbidden
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
describe 'with invalid params' do
|
338
|
-
it 'assigns the requested lending_policy as @lending_policy' do
|
339
|
-
put :update, params: { id: @lending_policy.id, lending_policy: @invalid_attrs }
|
340
|
-
response.should be_forbidden
|
341
|
-
end
|
342
|
-
end
|
343
|
-
end
|
344
|
-
|
345
|
-
describe 'When logged in as User' do
|
346
|
-
login_fixture_user
|
347
|
-
|
348
|
-
describe 'with valid params' do
|
349
|
-
it 'updates the requested lending_policy' do
|
350
|
-
put :update, params: { id: @lending_policy.id, lending_policy: @attrs }
|
351
|
-
end
|
352
|
-
|
353
|
-
it 'assigns the requested lending_policy as @lending_policy' do
|
354
|
-
put :update, params: { id: @lending_policy.id, lending_policy: @attrs }
|
355
|
-
assigns(:lending_policy).should eq(@lending_policy)
|
356
|
-
response.should be_forbidden
|
357
|
-
end
|
358
|
-
end
|
359
|
-
|
360
|
-
describe 'with invalid params' do
|
361
|
-
it 'assigns the requested lending_policy as @lending_policy' do
|
362
|
-
put :update, params: { id: @lending_policy.id, lending_policy: @invalid_attrs }
|
363
|
-
response.should be_forbidden
|
364
|
-
end
|
365
|
-
end
|
366
|
-
end
|
367
|
-
|
368
|
-
describe 'When not logged in' do
|
369
|
-
describe 'with valid params' do
|
370
|
-
it 'updates the requested lending_policy' do
|
371
|
-
put :update, params: { id: @lending_policy.id, lending_policy: @attrs }
|
372
|
-
end
|
373
|
-
|
374
|
-
it 'should be forbidden' do
|
375
|
-
put :update, params: { id: @lending_policy.id, lending_policy: @attrs }
|
376
|
-
response.should redirect_to(new_user_session_url)
|
377
|
-
end
|
378
|
-
end
|
379
|
-
|
380
|
-
describe 'with invalid params' do
|
381
|
-
it 'assigns the requested lending_policy as @lending_policy' do
|
382
|
-
put :update, params: { id: @lending_policy.id, lending_policy: @invalid_attrs }
|
383
|
-
response.should redirect_to(new_user_session_url)
|
384
|
-
end
|
385
|
-
end
|
386
|
-
end
|
387
|
-
end
|
388
|
-
|
389
|
-
describe 'DELETE destroy' do
|
390
|
-
before(:each) do
|
391
|
-
@lending_policy = FactoryBot.create(:lending_policy)
|
392
|
-
end
|
393
|
-
|
394
|
-
describe 'When logged in as Administrator' do
|
395
|
-
login_fixture_admin
|
396
|
-
|
397
|
-
it 'destroys the requested lending_policy' do
|
398
|
-
delete :destroy, params: { id: @lending_policy.id }
|
399
|
-
end
|
400
|
-
|
401
|
-
it 'redirects to the lending_policies list' do
|
402
|
-
delete :destroy, params: { id: @lending_policy.id }
|
403
|
-
response.should redirect_to(lending_policies_url)
|
404
|
-
end
|
405
|
-
end
|
406
|
-
|
407
|
-
describe 'When logged in as Librarian' do
|
408
|
-
login_fixture_librarian
|
409
|
-
|
410
|
-
it 'destroys the requested lending_policy' do
|
411
|
-
delete :destroy, params: { id: @lending_policy.id }
|
412
|
-
end
|
413
|
-
|
414
|
-
it 'should be forbidden' do
|
415
|
-
delete :destroy, params: { id: @lending_policy.id }
|
416
|
-
response.should be_forbidden
|
417
|
-
end
|
418
|
-
end
|
419
|
-
|
420
|
-
describe 'When logged in as User' do
|
421
|
-
login_fixture_user
|
422
|
-
|
423
|
-
it 'destroys the requested lending_policy' do
|
424
|
-
delete :destroy, params: { id: @lending_policy.id }
|
425
|
-
end
|
426
|
-
|
427
|
-
it 'should be forbidden' do
|
428
|
-
delete :destroy, params: { id: @lending_policy.id }
|
429
|
-
response.should be_forbidden
|
430
|
-
end
|
431
|
-
end
|
432
|
-
|
433
|
-
describe 'When not logged in' do
|
434
|
-
it 'destroys the requested lending_policy' do
|
435
|
-
delete :destroy, params: { id: @lending_policy.id }
|
436
|
-
end
|
437
|
-
|
438
|
-
it 'should be forbidden' do
|
439
|
-
delete :destroy, params: { id: @lending_policy.id }
|
440
|
-
response.should redirect_to(new_user_session_url)
|
441
|
-
end
|
442
|
-
end
|
443
|
-
end
|
444
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
describe WithdrawsController do
|
4
|
-
fixtures :all
|
5
|
-
let(:valid_attributes) do
|
6
|
-
FactoryBot.build(:withdraw).attributes.with_indifferent_access
|
7
|
-
end
|
8
|
-
let(:valid_create_attributes) do
|
9
|
-
{ basket_id: Basket.find(valid_attributes[:basket_id]).id,
|
10
|
-
withdraw: { item_identifier: Item.find(valid_attributes[:item_id]).item_identifier }}
|
11
|
-
end
|
12
|
-
|
13
|
-
describe 'POST create' do
|
14
|
-
describe 'When logged in as Administrator' do
|
15
|
-
login_fixture_admin
|
16
|
-
|
17
|
-
it 'should not withdraw a checked-out item' do
|
18
|
-
expect do
|
19
|
-
post :create, params: { basket_id: valid_create_attributes[:basket_id], withdraw: { item_identifier: reserves(:reserve_00014).item.item_identifier } }
|
20
|
-
end.to change(Withdraw, :count).by(0)
|
21
|
-
expect(assigns(:withdraw)).to be_a(Withdraw)
|
22
|
-
expect(response).to be_successful
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,208 +0,0 @@
|
|
1
|
-
en:
|
2
|
-
date:
|
3
|
-
abbr_day_names:
|
4
|
-
- Sun
|
5
|
-
- Mon
|
6
|
-
- Tue
|
7
|
-
- Wed
|
8
|
-
- Thu
|
9
|
-
- Fri
|
10
|
-
- Sat
|
11
|
-
abbr_month_names:
|
12
|
-
-
|
13
|
-
- Jan
|
14
|
-
- Feb
|
15
|
-
- Mar
|
16
|
-
- Apr
|
17
|
-
- May
|
18
|
-
- Jun
|
19
|
-
- Jul
|
20
|
-
- Aug
|
21
|
-
- Sep
|
22
|
-
- Oct
|
23
|
-
- Nov
|
24
|
-
- Dec
|
25
|
-
day_names:
|
26
|
-
- Sunday
|
27
|
-
- Monday
|
28
|
-
- Tuesday
|
29
|
-
- Wednesday
|
30
|
-
- Thursday
|
31
|
-
- Friday
|
32
|
-
- Saturday
|
33
|
-
formats:
|
34
|
-
default: ! '%Y-%m-%d'
|
35
|
-
long: ! '%B %d, %Y'
|
36
|
-
short: ! '%b %d'
|
37
|
-
month_names:
|
38
|
-
-
|
39
|
-
- January
|
40
|
-
- February
|
41
|
-
- March
|
42
|
-
- April
|
43
|
-
- May
|
44
|
-
- June
|
45
|
-
- July
|
46
|
-
- August
|
47
|
-
- September
|
48
|
-
- October
|
49
|
-
- November
|
50
|
-
- December
|
51
|
-
order:
|
52
|
-
- :year
|
53
|
-
- :month
|
54
|
-
- :day
|
55
|
-
datetime:
|
56
|
-
distance_in_words:
|
57
|
-
about_x_hours:
|
58
|
-
one: about 1 hour
|
59
|
-
other: about %{count} hours
|
60
|
-
about_x_months:
|
61
|
-
one: about 1 month
|
62
|
-
other: about %{count} months
|
63
|
-
about_x_years:
|
64
|
-
one: about 1 year
|
65
|
-
other: about %{count} years
|
66
|
-
almost_x_years:
|
67
|
-
one: almost 1 year
|
68
|
-
other: almost %{count} years
|
69
|
-
half_a_minute: half a minute
|
70
|
-
less_than_x_minutes:
|
71
|
-
one: less than a minute
|
72
|
-
other: less than %{count} minutes
|
73
|
-
less_than_x_seconds:
|
74
|
-
one: less than 1 second
|
75
|
-
other: less than %{count} seconds
|
76
|
-
over_x_years:
|
77
|
-
one: over 1 year
|
78
|
-
other: over %{count} years
|
79
|
-
x_days:
|
80
|
-
one: 1 day
|
81
|
-
other: ! '%{count} days'
|
82
|
-
x_minutes:
|
83
|
-
one: 1 minute
|
84
|
-
other: ! '%{count} minutes'
|
85
|
-
x_months:
|
86
|
-
one: 1 month
|
87
|
-
other: ! '%{count} months'
|
88
|
-
x_seconds:
|
89
|
-
one: 1 second
|
90
|
-
other: ! '%{count} seconds'
|
91
|
-
prompts:
|
92
|
-
day: Day
|
93
|
-
hour: Hour
|
94
|
-
minute: Minute
|
95
|
-
month: Month
|
96
|
-
second: Seconds
|
97
|
-
year: Year
|
98
|
-
errors: &errors
|
99
|
-
format: ! '%{attribute} %{message}'
|
100
|
-
messages:
|
101
|
-
accepted: must be accepted
|
102
|
-
blank: can't be blank
|
103
|
-
confirmation: doesn't match confirmation
|
104
|
-
empty: can't be empty
|
105
|
-
equal_to: must be equal to %{count}
|
106
|
-
even: must be even
|
107
|
-
exclusion: is reserved
|
108
|
-
greater_than: must be greater than %{count}
|
109
|
-
greater_than_or_equal_to: must be greater than or equal to %{count}
|
110
|
-
inclusion: is not included in the list
|
111
|
-
invalid: is invalid
|
112
|
-
less_than: must be less than %{count}
|
113
|
-
less_than_or_equal_to: must be less than or equal to %{count}
|
114
|
-
not_a_number: is not a number
|
115
|
-
not_an_integer: must be an integer
|
116
|
-
odd: must be odd
|
117
|
-
record_invalid: ! 'Validation failed: %{errors}'
|
118
|
-
taken: has already been taken
|
119
|
-
too_long:
|
120
|
-
one: is too long (maximum is 1 character)
|
121
|
-
other: is too long (maximum is %{count} characters)
|
122
|
-
too_short:
|
123
|
-
one: is too short (minimum is 1 character)
|
124
|
-
other: is too short (minimum is %{count} characters)
|
125
|
-
wrong_length:
|
126
|
-
one: is the wrong length (should be 1 character)
|
127
|
-
other: is the wrong length (should be %{count} characters)
|
128
|
-
template:
|
129
|
-
body: ! 'There were problems with the following fields:'
|
130
|
-
header:
|
131
|
-
one: 1 error prohibited this %{model} from being saved
|
132
|
-
other: ! '%{count} errors prohibited this %{model} from being saved'
|
133
|
-
helpers:
|
134
|
-
select:
|
135
|
-
prompt: Please select
|
136
|
-
submit:
|
137
|
-
create: Create %{model}
|
138
|
-
submit: Save %{model}
|
139
|
-
update: Update %{model}
|
140
|
-
number:
|
141
|
-
currency:
|
142
|
-
format:
|
143
|
-
delimiter: ! ','
|
144
|
-
format: ! '%u%n'
|
145
|
-
precision: 2
|
146
|
-
separator: .
|
147
|
-
significant: false
|
148
|
-
strip_insignificant_zeros: false
|
149
|
-
unit: $
|
150
|
-
format:
|
151
|
-
delimiter: ! ','
|
152
|
-
precision: 3
|
153
|
-
separator: .
|
154
|
-
significant: false
|
155
|
-
strip_insignificant_zeros: false
|
156
|
-
human:
|
157
|
-
decimal_units:
|
158
|
-
format: ! '%n %u'
|
159
|
-
units:
|
160
|
-
billion: Billion
|
161
|
-
million: Million
|
162
|
-
quadrillion: Quadrillion
|
163
|
-
thousand: Thousand
|
164
|
-
trillion: Trillion
|
165
|
-
unit: ''
|
166
|
-
format:
|
167
|
-
delimiter: ''
|
168
|
-
precision: 3
|
169
|
-
significant: true
|
170
|
-
strip_insignificant_zeros: true
|
171
|
-
storage_units:
|
172
|
-
format: ! '%n %u'
|
173
|
-
units:
|
174
|
-
byte:
|
175
|
-
one: Byte
|
176
|
-
other: Bytes
|
177
|
-
gb: GB
|
178
|
-
kb: KB
|
179
|
-
mb: MB
|
180
|
-
tb: TB
|
181
|
-
percentage:
|
182
|
-
format:
|
183
|
-
delimiter: ''
|
184
|
-
precision:
|
185
|
-
format:
|
186
|
-
delimiter: ''
|
187
|
-
support:
|
188
|
-
array:
|
189
|
-
last_word_connector: ! ', and '
|
190
|
-
two_words_connector: ! ' and '
|
191
|
-
words_connector: ! ', '
|
192
|
-
time:
|
193
|
-
am: am
|
194
|
-
formats:
|
195
|
-
default: ! '%a, %d %b %Y %H:%M:%S %z'
|
196
|
-
long: ! '%B %d, %Y %H:%M'
|
197
|
-
short: ! '%d %b %H:%M'
|
198
|
-
only_date: "%b %d, %Y"
|
199
|
-
only_year_and_month: "%m %Y"
|
200
|
-
only_month: "%m"
|
201
|
-
pm: pm
|
202
|
-
# remove these aliases after 'activemodel' and 'activerecord' namespaces are removed from Rails repository
|
203
|
-
activemodel:
|
204
|
-
errors:
|
205
|
-
<<: *errors
|
206
|
-
activerecord:
|
207
|
-
errors:
|
208
|
-
<<: *errors
|