enju_library 0.2.0 → 0.2.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/app/controllers/concerns/enju_library/controller.rb +12 -3
- data/app/controllers/libraries_controller.rb +1 -0
- data/app/controllers/shelves_controller.rb +2 -1
- data/app/models/library.rb +1 -1
- data/app/models/library_group.rb +22 -17
- data/app/models/shelf.rb +1 -1
- data/app/views/libraries/_form.html.erb +1 -0
- data/app/views/library_groups/_color_fields.html.erb +0 -1
- data/app/views/library_groups/_form.html.erb +1 -4
- data/config/locales/translation_en.yml +1 -0
- data/config/locales/translation_ja.yml +1 -0
- data/config/routes.rb +1 -0
- data/lib/enju_library/version.rb +1 -1
- data/lib/tasks/enju_library_tasks.rake +2 -2
- data/spec/controllers/accepts_controller_spec.rb +96 -96
- data/spec/controllers/baskets_controller_spec.rb +126 -126
- data/spec/controllers/bookstores_controller_spec.rb +152 -152
- data/spec/controllers/budget_types_controller_spec.rb +48 -49
- data/spec/controllers/libraries_controller_spec.rb +183 -183
- data/spec/controllers/library_groups_controller_spec.rb +47 -47
- data/spec/controllers/request_status_types_controller_spec.rb +152 -152
- data/spec/controllers/request_types_controller_spec.rb +152 -152
- data/spec/controllers/search_engines_controller_spec.rb +152 -152
- data/spec/controllers/shelves_controller_spec.rb +152 -152
- data/spec/controllers/subscribes_controller_spec.rb +151 -151
- data/spec/controllers/subscriptions_controller_spec.rb +152 -152
- data/spec/controllers/user_export_files_controller_spec.rb +75 -75
- data/spec/controllers/user_groups_controller_spec.rb +108 -108
- data/spec/controllers/user_import_files_controller_spec.rb +73 -73
- data/spec/controllers/user_import_results_controller_spec.rb +33 -34
- data/spec/controllers/withdraws_controller_spec.rb +42 -45
- data/spec/fixtures/libraries.yml +1 -1
- data/spec/fixtures/library_groups.yml +22 -17
- data/spec/fixtures/shelves.yml +1 -1
- data/spec/models/library_group_spec.rb +22 -17
- data/spec/models/library_spec.rb +1 -1
- data/spec/models/shelf_spec.rb +1 -1
- data/spec/views/library_groups/edit.html.erb_spec.rb +8 -0
- metadata +11 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 711cb2a18f1e3b7d5b1a24895d3b813ba8a473fd
|
4
|
+
data.tar.gz: 53f08ee0f42d4ef78d765feebd194bff4f8021d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6c42ed7816ec5c125c5797b927d8f0569ad132cf84575a6dbccf3ba98c52fa6d6252fcdff13e253cd21330c2c27f412836aa0150bc3520186fe97d05077b970
|
7
|
+
data.tar.gz: 68a3820c1a175bd4c3a3ec1eea729443bba1853cfe0da0a3f878ef65ec05ff65fb59fc413d51a804526a87708b8139d43ff48566da815f3d3467dce13ee770ed
|
@@ -9,6 +9,7 @@ module EnjuLibrary
|
|
9
9
|
#rescue_from ActiveRecord::RecordNotFound, with: :render_404
|
10
10
|
rescue_from Errno::ECONNREFUSED, with: :render_500_nosolr
|
11
11
|
#rescue_from ActionView::MissingTemplate, with: :render_404_invalid_format
|
12
|
+
helper_method :filtered_params
|
12
13
|
end
|
13
14
|
|
14
15
|
private
|
@@ -96,6 +97,7 @@ module EnjuLibrary
|
|
96
97
|
I18n.locale = @locale = session[:locale] = I18n.default_locale
|
97
98
|
end
|
98
99
|
rescue InvalidLocaleError
|
100
|
+
reset_session
|
99
101
|
@locale = I18n.default_locale
|
100
102
|
end
|
101
103
|
|
@@ -137,7 +139,7 @@ module EnjuLibrary
|
|
137
139
|
def convert_charset
|
138
140
|
case params[:format]
|
139
141
|
when 'csv'
|
140
|
-
return unless LibraryGroup.site_config.
|
142
|
+
return unless LibraryGroup.site_config.csv_charset_conversion
|
141
143
|
# TODO: 他の言語
|
142
144
|
if @locale.to_sym == :ja
|
143
145
|
headers["Content-Type"] = "text/csv; charset=Shift_JIS"
|
@@ -183,7 +185,7 @@ module EnjuLibrary
|
|
183
185
|
def get_top_page_content
|
184
186
|
if defined?(EnjuNews)
|
185
187
|
@news_feeds = Rails.cache.fetch('news_feed_all'){NewsFeed.order(:position)}
|
186
|
-
@news_posts = NewsPost.limit(LibraryGroup.site_config.
|
188
|
+
@news_posts = NewsPost.limit(LibraryGroup.site_config.news_post_number_top_page || 10)
|
187
189
|
end
|
188
190
|
@libraries = Library.real
|
189
191
|
end
|
@@ -219,7 +221,7 @@ module EnjuLibrary
|
|
219
221
|
end
|
220
222
|
|
221
223
|
def store_current_location
|
222
|
-
store_location_for(:user, request.url)
|
224
|
+
store_location_for(:user, request.url) if request.format == 'text/html'
|
223
225
|
end
|
224
226
|
|
225
227
|
def get_library_group
|
@@ -257,5 +259,12 @@ module EnjuLibrary
|
|
257
259
|
authorize @subscription, :show?
|
258
260
|
end
|
259
261
|
end
|
262
|
+
|
263
|
+
def filtered_params
|
264
|
+
params.permit([:q, :query, :view, :format, :order, :sort_by, :page, :per_page])
|
265
|
+
end
|
266
|
+
|
267
|
+
class InvalidLocaleError < StandardError
|
268
|
+
end
|
260
269
|
end
|
261
270
|
end
|
@@ -33,8 +33,9 @@ class ShelvesController < ApplicationController
|
|
33
33
|
if library
|
34
34
|
with(:library).equal_to library.name
|
35
35
|
order_by :position, :asc
|
36
|
+
else
|
37
|
+
order_by sort[:sort_by], sort[:order]
|
36
38
|
end
|
37
|
-
order_by sort[:sort_by], sort[:order]
|
38
39
|
facet :library
|
39
40
|
end
|
40
41
|
@shelves = search.results
|
data/app/models/library.rb
CHANGED
@@ -111,7 +111,7 @@ end
|
|
111
111
|
# note :text
|
112
112
|
# call_number_rows :integer default(1), not null
|
113
113
|
# call_number_delimiter :string default("|"), not null
|
114
|
-
# library_group_id :integer
|
114
|
+
# library_group_id :integer not null
|
115
115
|
# users_count :integer default(0), not null
|
116
116
|
# position :integer
|
117
117
|
# country_id :integer
|
data/app/models/library_group.rb
CHANGED
@@ -68,21 +68,26 @@ end
|
|
68
68
|
#
|
69
69
|
# Table name: library_groups
|
70
70
|
#
|
71
|
-
# id
|
72
|
-
# name
|
73
|
-
# display_name
|
74
|
-
# short_name
|
75
|
-
# my_networks
|
76
|
-
# login_banner
|
77
|
-
# note
|
78
|
-
# country_id
|
79
|
-
# position
|
80
|
-
# created_at
|
81
|
-
# updated_at
|
82
|
-
# admin_networks
|
83
|
-
# allow_bookmark_external_url
|
84
|
-
# url
|
85
|
-
# settings
|
86
|
-
# html_snippet
|
87
|
-
#
|
71
|
+
# id :integer not null, primary key
|
72
|
+
# name :string not null
|
73
|
+
# display_name :text
|
74
|
+
# short_name :string not null
|
75
|
+
# my_networks :text
|
76
|
+
# login_banner :text
|
77
|
+
# note :text
|
78
|
+
# country_id :integer
|
79
|
+
# position :integer
|
80
|
+
# created_at :datetime
|
81
|
+
# updated_at :datetime
|
82
|
+
# admin_networks :text
|
83
|
+
# allow_bookmark_external_url :boolean default(FALSE), not null
|
84
|
+
# url :string default("http://localhost:3000/")
|
85
|
+
# settings :text
|
86
|
+
# html_snippet :text
|
87
|
+
# book_jacket_source :string
|
88
|
+
# max_number_of_results :integer default(500)
|
89
|
+
# family_name_first :boolean default(TRUE)
|
90
|
+
# screenshot_generator :string
|
91
|
+
# pub_year_facet_range_interval :integer default(10)
|
92
|
+
# user_id :integer
|
88
93
|
#
|
data/app/models/shelf.rb
CHANGED
@@ -45,7 +45,7 @@
|
|
45
45
|
<% if defined?(EnjuManifestationViewer) %>
|
46
46
|
<div class="field">
|
47
47
|
<%= f.label :book_jacket_source -%>
|
48
|
-
<%= f.select :book_jacket_source, [[t('book_jacket.google'), 'google'], [t('book_jacket.hanmotocom'), 'hanmotocom']] -%><br />
|
48
|
+
<%= f.select :book_jacket_source, [[t('book_jacket.google'), 'google'], [t('book_jacket.openbd'), 'openbd'], [t('book_jacket.hanmotocom'), 'hanmotocom']] -%><br />
|
49
49
|
</div>
|
50
50
|
<% end %>
|
51
51
|
|
@@ -54,9 +54,6 @@
|
|
54
54
|
<%= f.fields_for :colors do |color_form| %>
|
55
55
|
<%= render 'color_fields', f: color_form %>
|
56
56
|
<% end %>
|
57
|
-
<div class="links">
|
58
|
-
<p><%= link_to_add_association t('page.add'), f, :colors %></p>
|
59
|
-
</div>
|
60
57
|
</div>
|
61
58
|
|
62
59
|
<div class="field">
|
data/config/routes.rb
CHANGED
data/lib/enju_library/version.rb
CHANGED
@@ -26,11 +26,11 @@ EOS
|
|
26
26
|
Next-L Enju, an open-source integrated library system. You can edit this message after logging in as Administrator.
|
27
27
|
EOS
|
28
28
|
footer_ja = <<"EOS"
|
29
|
-
[Next-L Enju Leaf
|
29
|
+
[Next-L Enju Leaf __VERSION__](https://github.com/next-l/enju_leaf), オープンソース統合図書館システム
|
30
30
|
Developed by [Kosuke Tanabe](https://github.com/nabeta) and [Project Next-L](http://www.next-l.jp) \| [このシステムについて](/page/about) \| [不具合を報告する](https://github.com/next-l/enju_leaf/issues) \| [マニュアル](https://next-l.github.com/manual/1.2/)
|
31
31
|
EOS
|
32
32
|
footer_en = <<"EOS"
|
33
|
-
[Next-L Enju Leaf
|
33
|
+
[Next-L Enju Leaf __VERSION__](https://github.com/next-l/enju_leaf), an open source integrated library system
|
34
34
|
Developed by [Kosuke Tanabe](https://github.com/nabeta) and [Project Next-L](http://www.next-l.jp) \| [About this system](/page/about) \| [Report bugs](https://github.com/next-l/enju_leaf/issues) \| [Manual](https://next-l.github.com/manual/1.2/)
|
35
35
|
EOS
|
36
36
|
library_group.login_banner_ja = login_ja if library_group.login_banner_ja.blank?
|
@@ -3,53 +3,53 @@ require 'rails_helper'
|
|
3
3
|
describe AcceptsController do
|
4
4
|
fixtures :all
|
5
5
|
|
6
|
-
def mock_user(stubs={})
|
6
|
+
def mock_user(stubs = {})
|
7
7
|
(@mock_user ||= mock_model(Accept).as_null_object).tap do |user|
|
8
8
|
user.stub(stubs) unless stubs.empty?
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe
|
13
|
-
describe
|
12
|
+
describe 'GET index' do
|
13
|
+
describe 'When logged in as Administrator' do
|
14
14
|
login_fixture_admin
|
15
15
|
|
16
|
-
it
|
16
|
+
it 'assigns all accepts as @accepts' do
|
17
17
|
get :index
|
18
18
|
assigns(:accepts).should_not be_nil
|
19
19
|
response.should be_success
|
20
20
|
end
|
21
21
|
|
22
|
-
describe
|
23
|
-
it
|
24
|
-
get :index, :
|
22
|
+
describe 'When basket_id is specified' do
|
23
|
+
it 'assigns all accepts as @accepts' do
|
24
|
+
get :index, basket_id: 10
|
25
25
|
assigns(:accepts).should eq baskets(:basket_00010).accepts.order('accepts.created_at DESC').page(1)
|
26
26
|
response.should be_success
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
describe
|
31
|
+
describe 'When logged in as Librarian' do
|
32
32
|
login_fixture_librarian
|
33
33
|
|
34
|
-
it
|
34
|
+
it 'assigns all accepts as @accepts' do
|
35
35
|
get :index
|
36
36
|
assigns(:accepts).should_not be_nil
|
37
37
|
response.should be_success
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
41
|
-
it
|
42
|
-
get :index, :
|
40
|
+
describe 'When basket_id is specified' do
|
41
|
+
it 'assigns all accepts as @accepts' do
|
42
|
+
get :index, basket_id: 9
|
43
43
|
assigns(:accepts).should eq baskets(:basket_00009).accepts.order('accepts.created_at DESC').page(1)
|
44
44
|
response.should be_success
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
describe
|
49
|
+
describe 'When logged in as User' do
|
50
50
|
login_fixture_user
|
51
51
|
|
52
|
-
it
|
52
|
+
it 'should not assign all accepts as @accepts' do
|
53
53
|
get :index
|
54
54
|
assigns(:accepts).should be_nil
|
55
55
|
response.should be_forbidden
|
@@ -57,79 +57,79 @@ describe AcceptsController do
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
describe
|
61
|
-
describe
|
60
|
+
describe 'GET show' do
|
61
|
+
describe 'When logged in as Administrator' do
|
62
62
|
login_fixture_admin
|
63
63
|
|
64
|
-
it
|
64
|
+
it 'assigns the requested accept as @accept' do
|
65
65
|
accept = FactoryGirl.create(:accept)
|
66
|
-
get :show, :
|
66
|
+
get :show, id: accept.id
|
67
67
|
assigns(:accept).should eq(accept)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
describe
|
71
|
+
describe 'When logged in as Librarian' do
|
72
72
|
login_fixture_librarian
|
73
73
|
|
74
|
-
it
|
74
|
+
it 'assigns the requested accept as @accept' do
|
75
75
|
accept = FactoryGirl.create(:accept)
|
76
|
-
get :show, :
|
76
|
+
get :show, id: accept.id
|
77
77
|
assigns(:accept).should eq(accept)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
describe
|
81
|
+
describe 'When logged in as User' do
|
82
82
|
login_fixture_user
|
83
83
|
|
84
|
-
it
|
84
|
+
it 'assigns the requested accept as @accept' do
|
85
85
|
accept = FactoryGirl.create(:accept)
|
86
|
-
get :show, :
|
86
|
+
get :show, id: accept.id
|
87
87
|
assigns(:accept).should eq(accept)
|
88
88
|
response.should be_forbidden
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
describe
|
93
|
-
it
|
92
|
+
describe 'When not logged in' do
|
93
|
+
it 'assigns the requested accept as @accept' do
|
94
94
|
accept = FactoryGirl.create(:accept)
|
95
|
-
get :show, :
|
95
|
+
get :show, id: accept.id
|
96
96
|
assigns(:accept).should eq(accept)
|
97
97
|
response.should redirect_to new_user_session_url
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
describe
|
103
|
-
describe
|
102
|
+
describe 'GET new' do
|
103
|
+
describe 'When logged in as Administrator' do
|
104
104
|
login_fixture_admin
|
105
105
|
|
106
|
-
it
|
106
|
+
it 'assigns the requested accept as @accept' do
|
107
107
|
get :new
|
108
108
|
assigns(:accept).should_not be_valid
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
describe
|
112
|
+
describe 'When logged in as Librarian' do
|
113
113
|
login_fixture_librarian
|
114
114
|
|
115
|
-
it
|
115
|
+
it 'assigns the requested accept as @accept' do
|
116
116
|
get :new
|
117
117
|
assigns(:accept).should_not be_valid
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
describe
|
121
|
+
describe 'When logged in as User' do
|
122
122
|
login_fixture_user
|
123
123
|
|
124
|
-
it
|
124
|
+
it 'should not assign the requested accept as @accept' do
|
125
125
|
get :new
|
126
126
|
assigns(:accept).should be_nil
|
127
127
|
response.should be_forbidden
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
describe
|
132
|
-
it
|
131
|
+
describe 'When not logged in' do
|
132
|
+
it 'should not assign the requested accept as @accept' do
|
133
133
|
get :new
|
134
134
|
assigns(:accept).should be_nil
|
135
135
|
response.should redirect_to(new_user_session_url)
|
@@ -137,156 +137,156 @@ describe AcceptsController do
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
describe
|
140
|
+
describe 'POST create' do
|
141
141
|
before(:each) do
|
142
|
-
@attrs = {:
|
143
|
-
@invalid_attrs = {:
|
142
|
+
@attrs = { item_identifier: '00003' }
|
143
|
+
@invalid_attrs = { item_identifier: 'invalid' }
|
144
144
|
end
|
145
145
|
|
146
|
-
describe
|
146
|
+
describe 'When logged in as Administrator' do
|
147
147
|
login_fixture_admin
|
148
148
|
|
149
|
-
describe
|
150
|
-
it
|
151
|
-
post :create, :
|
149
|
+
describe 'with valid params' do
|
150
|
+
it 'assigns a newly created accept as @accept' do
|
151
|
+
post :create, accept: @attrs
|
152
152
|
assigns(:accept).should be_nil
|
153
153
|
end
|
154
154
|
|
155
|
-
it
|
156
|
-
post :create, :
|
155
|
+
it 'should not create a new accept without basket_id' do
|
156
|
+
post :create, accept: @attrs
|
157
157
|
response.should be_forbidden
|
158
158
|
end
|
159
159
|
|
160
|
-
describe
|
161
|
-
it
|
162
|
-
post :create, :
|
160
|
+
describe 'When basket_id is specified' do
|
161
|
+
it 'redirects to the created accept' do
|
162
|
+
post :create, accept: @attrs, basket_id: 9
|
163
163
|
response.should redirect_to(accepts_url(basket_id: assigns(:accept).basket.id))
|
164
164
|
assigns(:accept).item.circulation_status.name.should eq 'Available On Shelf'
|
165
165
|
end
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
|
-
describe
|
170
|
-
it
|
171
|
-
post :create, :
|
169
|
+
describe 'with invalid params' do
|
170
|
+
it 'assigns a newly created but unsaved accept as @accept' do
|
171
|
+
post :create, accept: @invalid_attrs
|
172
172
|
assigns(:accept).should be_nil
|
173
173
|
end
|
174
174
|
|
175
|
-
it
|
176
|
-
post :create, :
|
175
|
+
it 'should be forbidden' do
|
176
|
+
post :create, accept: @invalid_attrs
|
177
177
|
response.should be_forbidden
|
178
178
|
end
|
179
179
|
end
|
180
180
|
|
181
|
-
it
|
182
|
-
post :create, :
|
181
|
+
it 'should not create accept without item_id' do
|
182
|
+
post :create, accept: { item_identifier: nil }, basket_id: 9
|
183
183
|
assigns(:accept).should_not be_valid
|
184
184
|
response.should be_success
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
188
|
-
describe
|
188
|
+
describe 'When logged in as Librarian' do
|
189
189
|
login_fixture_librarian
|
190
190
|
|
191
|
-
describe
|
192
|
-
it
|
193
|
-
post :create, :
|
191
|
+
describe 'with valid params' do
|
192
|
+
it 'assigns a newly created accept as @accept' do
|
193
|
+
post :create, accept: @attrs
|
194
194
|
assigns(:accept).should be_nil
|
195
195
|
end
|
196
196
|
|
197
|
-
it
|
198
|
-
post :create, :
|
197
|
+
it 'should not create a new accept without basket_id' do
|
198
|
+
post :create, accept: @attrs
|
199
199
|
response.should be_forbidden
|
200
200
|
end
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
|
-
describe
|
204
|
+
describe 'When logged in as User' do
|
205
205
|
login_fixture_user
|
206
206
|
|
207
|
-
describe
|
208
|
-
it
|
209
|
-
post :create, :
|
207
|
+
describe 'with valid params' do
|
208
|
+
it 'assigns a newly created accept as @accept' do
|
209
|
+
post :create, accept: @attrs
|
210
210
|
assigns(:accept).should be_nil
|
211
211
|
end
|
212
212
|
|
213
|
-
it
|
214
|
-
post :create, :
|
213
|
+
it 'should be forbidden' do
|
214
|
+
post :create, accept: @attrs
|
215
215
|
response.should be_forbidden
|
216
216
|
end
|
217
217
|
end
|
218
218
|
end
|
219
219
|
|
220
|
-
describe
|
220
|
+
describe 'When not logged in' do
|
221
221
|
before(:each) do
|
222
|
-
@attrs = {:
|
223
|
-
@invalid_attrs = {:
|
222
|
+
@attrs = { item_identifier: '00003' }
|
223
|
+
@invalid_attrs = { item_identifier: 'invalid' }
|
224
224
|
end
|
225
225
|
|
226
|
-
describe
|
227
|
-
it
|
228
|
-
post :create, :
|
226
|
+
describe 'with valid params' do
|
227
|
+
it 'assigns a newly created accept as @accept' do
|
228
|
+
post :create, accept: @attrs
|
229
229
|
end
|
230
230
|
|
231
|
-
it
|
232
|
-
post :create, :
|
231
|
+
it 'should redirect to new session url' do
|
232
|
+
post :create, accept: @attrs
|
233
233
|
response.should redirect_to new_user_session_url
|
234
234
|
end
|
235
235
|
end
|
236
236
|
end
|
237
237
|
end
|
238
238
|
|
239
|
-
describe
|
239
|
+
describe 'DELETE destroy' do
|
240
240
|
before(:each) do
|
241
241
|
@accept = FactoryGirl.create(:accept)
|
242
242
|
end
|
243
243
|
|
244
|
-
describe
|
244
|
+
describe 'When logged in as Administrator' do
|
245
245
|
login_fixture_admin
|
246
246
|
|
247
|
-
it
|
248
|
-
delete :destroy, :
|
247
|
+
it 'destroys the requested accept' do
|
248
|
+
delete :destroy, id: @accept.id
|
249
249
|
end
|
250
250
|
|
251
|
-
it
|
252
|
-
delete :destroy, :
|
251
|
+
it 'redirects to the accepts list' do
|
252
|
+
delete :destroy, id: @accept.id
|
253
253
|
response.should redirect_to(accepts_url)
|
254
254
|
end
|
255
255
|
end
|
256
256
|
|
257
|
-
describe
|
257
|
+
describe 'When logged in as Librarian' do
|
258
258
|
login_fixture_librarian
|
259
259
|
|
260
|
-
it
|
261
|
-
delete :destroy, :
|
260
|
+
it 'destroys the requested accept' do
|
261
|
+
delete :destroy, id: @accept.id
|
262
262
|
end
|
263
263
|
|
264
|
-
it
|
265
|
-
delete :destroy, :
|
264
|
+
it 'redirects to the accepts list' do
|
265
|
+
delete :destroy, id: @accept.id
|
266
266
|
response.should redirect_to(accepts_url)
|
267
267
|
end
|
268
268
|
end
|
269
269
|
|
270
|
-
describe
|
270
|
+
describe 'When logged in as User' do
|
271
271
|
login_fixture_user
|
272
272
|
|
273
|
-
it
|
274
|
-
delete :destroy, :
|
273
|
+
it 'destroys the requested accept' do
|
274
|
+
delete :destroy, id: @accept.id
|
275
275
|
end
|
276
276
|
|
277
|
-
it
|
278
|
-
delete :destroy, :
|
277
|
+
it 'should be forbidden' do
|
278
|
+
delete :destroy, id: @accept.id
|
279
279
|
response.should be_forbidden
|
280
280
|
end
|
281
281
|
end
|
282
282
|
|
283
|
-
describe
|
284
|
-
it
|
285
|
-
delete :destroy, :
|
283
|
+
describe 'When not logged in' do
|
284
|
+
it 'destroys the requested accept' do
|
285
|
+
delete :destroy, id: @accept.id
|
286
286
|
end
|
287
287
|
|
288
|
-
it
|
289
|
-
delete :destroy, :
|
288
|
+
it 'should be forbidden' do
|
289
|
+
delete :destroy, id: @accept.id
|
290
290
|
response.should redirect_to(new_user_session_url)
|
291
291
|
end
|
292
292
|
end
|