enju_biblio 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/icons/book.png +0 -0
- data/app/assets/images/icons/cd.png +0 -0
- data/app/assets/images/icons/dvd.png +0 -0
- data/app/assets/images/icons/monitor.png +0 -0
- data/app/controllers/carrier_types_controller.rb +8 -3
- data/app/controllers/manifestations_controller.rb +17 -4
- data/app/controllers/picture_files_controller.rb +1 -1
- data/app/controllers/series_statements_controller.rb +6 -0
- data/app/helpers/manifestations_helper.rb +1 -1
- data/app/models/agent_import_file_transition.rb +1 -0
- data/app/models/carrier_type.rb +11 -7
- data/app/models/import_request_transition.rb +1 -0
- data/app/models/manifestation.rb +5 -0
- data/app/models/resource_export_file_transition.rb +1 -0
- data/app/models/resource_import_file_transition.rb +1 -0
- data/app/views/carrier_types/index.html.erb +4 -1
- data/app/views/manifestations/_show_detail_librarian.html.erb +4 -0
- data/app/views/manifestations/index.html.erb +3 -0
- data/config/locales/translation_en.yml +2 -0
- data/config/locales/translation_ja.yml +2 -0
- data/lib/enju_biblio/biblio_helper.rb +1 -12
- data/lib/enju_biblio/version.rb +1 -1
- data/lib/generators/enju_biblio/setup/templates/config/schedule.rb +3 -3
- data/lib/tasks/carrier_type.rb +30 -18
- data/lib/tasks/enju_biblio_tasks.rake +2 -0
- data/spec/controllers/agent_import_files_controller_spec.rb +87 -87
- data/spec/controllers/agent_import_results_controller_spec.rb +22 -22
- data/spec/controllers/agent_merge_lists_controller_spec.rb +157 -157
- data/spec/controllers/agent_merges_controller_spec.rb +151 -151
- data/spec/controllers/agent_relationship_types_controller_spec.rb +152 -152
- data/spec/controllers/agent_relationships_controller_spec.rb +153 -153
- data/spec/controllers/agent_types_controller_spec.rb +49 -50
- data/spec/controllers/agents_controller_spec.rb +234 -234
- data/spec/controllers/carrier_types_controller_spec.rb +123 -103
- data/spec/controllers/content_types_controller_spec.rb +51 -52
- data/spec/controllers/countries_controller_spec.rb +156 -156
- data/spec/controllers/create_types_controller_spec.rb +48 -49
- data/spec/controllers/creates_controller_spec.rb +154 -154
- data/spec/controllers/donates_controller_spec.rb +153 -153
- data/spec/controllers/form_of_works_controller_spec.rb +48 -49
- data/spec/controllers/frequencies_controller_spec.rb +51 -52
- data/spec/controllers/identifier_types_controller_spec.rb +48 -49
- data/spec/controllers/import_requests_controller_spec.rb +165 -164
- data/spec/controllers/items_controller_spec.rb +214 -216
- data/spec/controllers/languages_controller_spec.rb +109 -109
- data/spec/controllers/licenses_controller_spec.rb +48 -49
- data/spec/controllers/manifestation_relationship_types_controller_spec.rb +152 -152
- data/spec/controllers/manifestation_relationships_controller_spec.rb +153 -153
- data/spec/controllers/manifestations_controller_spec.rb +319 -289
- data/spec/controllers/medium_of_performances_controller_spec.rb +48 -49
- data/spec/controllers/owns_controller_spec.rb +153 -153
- data/spec/controllers/picture_files_controller_spec.rb +156 -156
- data/spec/controllers/produce_types_controller_spec.rb +48 -49
- data/spec/controllers/produces_controller_spec.rb +154 -154
- data/spec/controllers/realize_types_controller_spec.rb +48 -49
- data/spec/controllers/realizes_controller_spec.rb +155 -155
- data/spec/controllers/resource_export_files_controller_spec.rb +72 -72
- data/spec/controllers/resource_import_files_controller_spec.rb +90 -90
- data/spec/controllers/resource_import_results_controller_spec.rb +43 -43
- data/spec/controllers/series_statement_merge_lists_controller_spec.rb +153 -153
- data/spec/controllers/series_statement_merges_controller_spec.rb +151 -151
- data/spec/controllers/series_statements_controller_spec.rb +154 -154
- data/spec/factories/checkout.rb +9 -0
- data/spec/factories/library.rb +13 -0
- data/spec/factories/shelf.rb +6 -0
- data/spec/fixtures/carrier_types.yml +11 -7
- data/spec/models/carrier_type_spec.rb +11 -7
- data/spec/models/resource_export_file_spec.rb +58 -16
- data/spec/support/resque.rb +0 -1
- data/spec/views/manifestations/show.html.erb_spec.rb +5 -0
- data/spec/views/resource_import_files/index.html.erb_spec.rb +1 -1
- data/spec/views/resource_import_files/show.html.erb_spec.rb +1 -1
- data/spec/views/resource_import_results/index.html.erb_spec.rb +1 -1
- data/spec/views/resource_import_results/show.html.erb_spec.rb +1 -1
- metadata +49 -39
@@ -1,5 +1,3 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
require 'rails_helper'
|
4
2
|
|
5
3
|
describe ManifestationsController do
|
@@ -9,226 +7,246 @@ describe ManifestationsController do
|
|
9
7
|
FactoryGirl.attributes_for(:manifestation)
|
10
8
|
end
|
11
9
|
|
12
|
-
describe
|
10
|
+
describe 'GET index', solr: true do
|
13
11
|
before do
|
14
12
|
Manifestation.reindex
|
15
13
|
end
|
16
14
|
|
17
|
-
describe
|
15
|
+
describe 'When logged in as Administrator' do
|
18
16
|
login_fixture_admin
|
19
17
|
|
20
|
-
it
|
18
|
+
it 'assigns all manifestations as @manifestations' do
|
21
19
|
get :index
|
22
20
|
expect(assigns(:manifestations)).to_not be_nil
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
26
|
-
describe
|
24
|
+
describe 'When logged in as Librarian' do
|
27
25
|
login_fixture_librarian
|
28
26
|
|
29
|
-
it
|
27
|
+
it 'assigns all manifestations as @manifestations' do
|
30
28
|
get :index
|
31
29
|
expect(assigns(:manifestations)).to_not be_nil
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
35
|
-
describe
|
33
|
+
describe 'When logged in as User' do
|
36
34
|
login_fixture_user
|
37
35
|
|
38
|
-
it
|
36
|
+
it 'assigns all manifestations as @manifestations' do
|
39
37
|
get :index
|
40
38
|
expect(assigns(:manifestations)).to_not be_nil
|
41
39
|
end
|
42
40
|
end
|
43
41
|
|
44
|
-
describe
|
45
|
-
it
|
42
|
+
describe 'When not logged in' do
|
43
|
+
it 'assigns all manifestations as @manifestations' do
|
46
44
|
get :index
|
47
45
|
expect(assigns(:manifestations)).to_not be_nil
|
48
46
|
end
|
49
47
|
|
50
|
-
it
|
51
|
-
get :index, :
|
48
|
+
it 'assigns all manifestations as @manifestations in xml format without operation' do
|
49
|
+
get :index, format: 'xml'
|
52
50
|
expect(response).to be_success
|
53
51
|
expect(assigns(:manifestations)).to_not be_nil
|
54
52
|
end
|
55
53
|
|
56
|
-
it
|
57
|
-
get :index, :
|
54
|
+
it 'assigns all manifestations as @manifestations in txt format without operation' do
|
55
|
+
get :index, format: 'txt'
|
58
56
|
expect(response).to be_success
|
59
57
|
expect(assigns(:manifestations)).to_not be_nil
|
60
58
|
expect(response).to render_template('manifestations/index')
|
61
59
|
end
|
62
60
|
|
63
|
-
it
|
64
|
-
get :index, :
|
61
|
+
it 'assigns all manifestations as @manifestations in sru format without operation' do
|
62
|
+
get :index, format: 'sru'
|
65
63
|
assert_response :success
|
66
64
|
expect(assigns(:manifestations)).to be_nil
|
67
65
|
expect(response).to render_template('manifestations/explain')
|
68
66
|
end
|
69
67
|
|
70
|
-
it
|
71
|
-
get :index, :
|
68
|
+
it 'assigns all manifestations as @manifestations in sru format with operation' do
|
69
|
+
get :index, format: 'sru', operation: 'searchRetrieve', query: 'ruby'
|
72
70
|
expect(assigns(:manifestations)).to_not be_nil
|
73
71
|
expect(response).to render_template('manifestations/index')
|
74
72
|
end
|
75
73
|
|
76
|
-
it
|
77
|
-
get :index, :
|
74
|
+
it 'assigns all manifestations as @manifestations in sru format with operation and title' do
|
75
|
+
get :index, format: 'sru', query: 'title=ruby', operation: 'searchRetrieve'
|
78
76
|
expect(assigns(:manifestations)).to_not be_nil
|
79
77
|
expect(response).to render_template('manifestations/index')
|
80
78
|
end
|
81
79
|
|
82
|
-
it
|
83
|
-
get :index, :
|
80
|
+
it 'assigns all manifestations as @manifestations in openurl' do
|
81
|
+
get :index, api: 'openurl', title: 'ruby'
|
84
82
|
expect(assigns(:manifestations)).to_not be_nil
|
85
83
|
end
|
86
84
|
|
87
|
-
it
|
88
|
-
get :index, :
|
85
|
+
it 'assigns all manifestations as @manifestations when pub_date_from and pub_date_until are specified' do
|
86
|
+
get :index, pub_date_from: '2000', pub_date_until: '2007'
|
89
87
|
assigns(:query).should eq "date_of_publication_d:[#{Time.zone.parse('2000-01-01').beginning_of_day.utc.iso8601} TO #{Time.zone.parse('2007-12-31').end_of_year.utc.iso8601}]"
|
90
88
|
expect(assigns(:manifestations)).to_not be_nil
|
91
89
|
end
|
92
90
|
|
93
|
-
it
|
94
|
-
get :index, :
|
91
|
+
it 'assigns all manifestations as @manifestations when old pub_date_from and pub_date_until are specified' do
|
92
|
+
get :index, pub_date_from: '200', pub_date_until: '207'
|
95
93
|
assigns(:query).should eq "date_of_publication_d:[#{Time.zone.parse('200-01-01').utc.iso8601} TO #{Time.zone.parse('207-12-31').end_of_year.utc.iso8601}]"
|
96
94
|
expect(assigns(:manifestations)).to_not be_nil
|
97
95
|
end
|
98
96
|
|
99
|
-
it
|
100
|
-
get :index, :
|
97
|
+
it 'assigns all manifestations as @manifestations when acquired_from and pub_date_until are specified' do
|
98
|
+
get :index, acquired_from: '2000', acquired_until: '2007'
|
101
99
|
assigns(:query).should eq "acquired_at_d:[#{Time.zone.parse('2000-01-01').beginning_of_day.utc.iso8601} TO #{Time.zone.parse('2007-12-31').end_of_year.utc.iso8601}]"
|
102
100
|
expect(assigns(:manifestations)).to_not be_nil
|
103
101
|
end
|
104
102
|
|
105
|
-
it
|
106
|
-
get :index, :
|
103
|
+
it 'assigns all manifestations as @manifestations when old acquired_from and pub_date_until are specified' do
|
104
|
+
get :index, acquired_from: '200', acquired_until: '207'
|
107
105
|
assigns(:query).should eq "acquired_at_d:[#{Time.zone.parse('200-01-01').utc.iso8601} TO #{Time.zone.parse('207-12-31').end_of_day.utc.iso8601}]"
|
108
106
|
expect(assigns(:manifestations)).to_not be_nil
|
109
107
|
end
|
110
108
|
|
111
|
-
it
|
112
|
-
get :index, :
|
109
|
+
it 'assigns all manifestations as @manifestations when number_of_pages_at_least and number_of_pages_at_most are specified' do
|
110
|
+
get :index, number_of_pages_at_least: '100', number_of_pages_at_most: '200'
|
113
111
|
expect(assigns(:manifestations)).to_not be_nil
|
114
112
|
end
|
115
113
|
|
116
|
-
it
|
117
|
-
get :index, :
|
114
|
+
it 'assigns all manifestations as @manifestations in mods format' do
|
115
|
+
get :index, format: 'mods'
|
118
116
|
expect(assigns(:manifestations)).to_not be_nil
|
119
|
-
expect(response).to render_template(
|
117
|
+
expect(response).to render_template('manifestations/index')
|
120
118
|
end
|
121
119
|
|
122
|
-
it
|
123
|
-
get :index, :
|
120
|
+
it 'assigns all manifestations as @manifestations in rdf format' do
|
121
|
+
get :index, format: 'rdf'
|
124
122
|
expect(assigns(:manifestations)).to_not be_nil
|
125
|
-
expect(response).to render_template(
|
123
|
+
expect(response).to render_template('manifestations/index')
|
126
124
|
end
|
127
125
|
|
128
|
-
it
|
129
|
-
get :index, :
|
126
|
+
it 'should get index with manifestation_id' do
|
127
|
+
get :index, manifestation_id: 1
|
130
128
|
expect(response).to be_success
|
131
129
|
expect(assigns(:manifestation)).to eq Manifestation.find(1)
|
132
130
|
assigns(:manifestations).collect(&:id).should eq assigns(:manifestation).derived_manifestations.collect(&:id)
|
133
131
|
end
|
134
132
|
|
135
|
-
it
|
136
|
-
get :index, :
|
133
|
+
it 'should get index with query' do
|
134
|
+
get :index, query: '2005'
|
137
135
|
expect(response).to be_success
|
138
136
|
expect(assigns(:manifestations)).to_not be_blank
|
139
137
|
end
|
140
138
|
|
141
|
-
it
|
142
|
-
get :index, :
|
139
|
+
it 'should get index with page number' do
|
140
|
+
get :index, query: '2005', number_of_pages_at_least: 1, number_of_pages_at_most: 100
|
143
141
|
expect(response).to be_success
|
144
142
|
assigns(:query).should eq '2005 number_of_pages_i:[1 TO 100]'
|
145
143
|
end
|
146
144
|
|
147
|
-
it
|
148
|
-
get :index, :
|
145
|
+
it 'should get index with pub_date_from' do
|
146
|
+
get :index, query: '2005', pub_date_from: '2000'
|
149
147
|
expect(response).to be_success
|
150
148
|
expect(assigns(:manifestations)).to be_truthy
|
151
149
|
assigns(:query).should eq '2005 date_of_publication_d:[2000-01-01T00:00:00Z TO *]'
|
152
150
|
end
|
153
151
|
|
154
|
-
it
|
155
|
-
get :index, :
|
152
|
+
it 'should get index with pub_date_until' do
|
153
|
+
get :index, query: '2005', pub_date_until: '2000'
|
156
154
|
expect(response).to be_success
|
157
155
|
expect(assigns(:manifestations)).to be_truthy
|
158
156
|
assigns(:query).should eq '2005 date_of_publication_d:[* TO 2000-12-31T23:59:59Z]'
|
159
157
|
end
|
160
158
|
|
161
|
-
it
|
162
|
-
get :index, :
|
159
|
+
it 'should get tag_cloud' do
|
160
|
+
get :index, query: '2005', view: 'tag_cloud'
|
163
161
|
expect(response).to be_success
|
164
|
-
expect(response).to render_template(
|
162
|
+
expect(response).to render_template('manifestations/_tag_cloud')
|
165
163
|
end
|
166
164
|
|
167
|
-
it
|
168
|
-
get :index, :
|
165
|
+
it 'should show manifestation with isbn', solr: true do
|
166
|
+
get :index, isbn: '4798002062'
|
169
167
|
expect(response).to be_success
|
170
168
|
expect(assigns(:manifestations).count).to eq 1
|
171
169
|
end
|
172
170
|
|
173
|
-
it
|
174
|
-
get :index, :
|
171
|
+
it 'should not show missing manifestation with isbn', solr: true do
|
172
|
+
get :index, isbn: '47980020620'
|
175
173
|
expect(response).to be_success
|
176
174
|
expect(assigns(:manifestations)).to be_empty
|
177
175
|
end
|
178
176
|
|
179
|
-
it
|
180
|
-
get :index, :
|
177
|
+
it 'should show manifestation with library 3', solr: true do
|
178
|
+
get :index, library_adv: ['hachioji']
|
181
179
|
expect(response).to be_success
|
182
180
|
expect(assigns(:manifestations).size).to eq 1
|
183
181
|
end
|
184
182
|
|
185
|
-
it
|
186
|
-
get :index, :
|
183
|
+
it 'should show manifestation with library 2 or 3', solr: true do
|
184
|
+
get :index, library_adv: %w(hachioji kamata)
|
187
185
|
expect(response).to be_success
|
188
186
|
expect(assigns(:manifestations).size).to eq 2
|
189
187
|
end
|
190
188
|
|
191
|
-
it "should show manifestation with
|
192
|
-
|
189
|
+
it "should show manifestation with shelf", solr: true do
|
190
|
+
shelf = FactoryGirl.create(:shelf)
|
191
|
+
library = shelf.library
|
192
|
+
item = FactoryGirl.create(:item, shelf: shelf)
|
193
|
+
get :index, :"#{library.name}_shelf" => [shelf.name]
|
194
|
+
expect(response).to be_success
|
195
|
+
expect(assigns(:manifestations).size).to eq 1
|
196
|
+
expect(assigns(:manifestations).first).to eq item.manifestation
|
197
|
+
end
|
198
|
+
|
199
|
+
it 'should show manifestation with call_number', solr: true do
|
200
|
+
get :index, call_number: '547|ヤ'
|
193
201
|
expect(response).to be_success
|
194
202
|
expect(assigns(:manifestations)).not_to be_empty
|
195
203
|
end
|
196
204
|
|
197
|
-
it
|
198
|
-
classification = FactoryGirl.create(:classification, :
|
199
|
-
|
200
|
-
get :index, :
|
201
|
-
|
202
|
-
|
205
|
+
it 'should show manifestation with NDC', solr: true do
|
206
|
+
classification = FactoryGirl.create(:classification, category: '007.3', classification_type_id: 1)
|
207
|
+
Manifestation.first.classifications << classification
|
208
|
+
get :index, classification: '007', classification_type: 1
|
209
|
+
expect(response).to be_success
|
210
|
+
expect(assigns(:manifestations)).not_to be_empty
|
203
211
|
end
|
204
212
|
|
205
|
-
it
|
206
|
-
get :index, :
|
213
|
+
it 'should not search with classification if classification is blank' do
|
214
|
+
get :index, classification: '', classification_type: 1
|
207
215
|
expect(response).to be_success
|
208
216
|
expect(assigns(:query)).not_to match /classification/
|
209
217
|
end
|
210
218
|
|
211
|
-
it
|
219
|
+
it 'should show manifestation with subject', solr: true do
|
220
|
+
subject = FactoryGirl.create(:subject, term: 'test_subject')
|
221
|
+
manifestation = FactoryGirl.create(:manifestation)
|
222
|
+
manifestation.subjects << subject
|
223
|
+
get :index, subject_text: 'test_subject'
|
224
|
+
expect(response).to be_success
|
225
|
+
expect(assigns(:manifestations)).not_to be_empty
|
226
|
+
expect(assigns(:manifestations).first).to eq manifestation
|
227
|
+
end
|
228
|
+
|
229
|
+
it 'should accept per_page params' do
|
212
230
|
get :index, per_page: 3
|
213
231
|
expect(assigns(:manifestations).count).to eq 3
|
214
232
|
expect(assigns(:manifestations).total_count).to eq 118
|
215
233
|
end
|
216
234
|
|
217
|
-
it
|
218
|
-
|
219
|
-
|
220
|
-
|
235
|
+
it 'should accept page parameter' do
|
236
|
+
get :index
|
237
|
+
original_manifestations = assigns(:manifestations)
|
238
|
+
expect(original_manifestations.count).to eq 10
|
221
239
|
get :index, page: 2
|
222
|
-
|
223
|
-
|
224
|
-
|
240
|
+
manifestations_page2 = assigns(:manifestations)
|
241
|
+
expect(manifestations_page2.count).to eq 10
|
242
|
+
expect(original_manifestations.first).not_to eq manifestations_page2.first
|
225
243
|
end
|
226
244
|
|
227
|
-
it
|
228
|
-
get :index, sort_by:
|
245
|
+
it 'should accept sort_by parameter' do
|
246
|
+
get :index, sort_by: 'created_at:desc'
|
229
247
|
manifestations = assigns(:manifestations)
|
230
248
|
expect(manifestations.first.created_at).to be >= manifestations.last.created_at
|
231
|
-
get :index, sort_by:
|
249
|
+
get :index, sort_by: 'created_at:asc'
|
232
250
|
manifestations = assigns(:manifestations)
|
233
251
|
expect(manifestations.first.created_at).to be <= manifestations.last.created_at
|
234
252
|
end
|
@@ -243,172 +261,186 @@ describe ManifestationsController do
|
|
243
261
|
expect(manifestations).not_to be_blank
|
244
262
|
expect(manifestations.map{|e| e.id }).to include periodical.id
|
245
263
|
end
|
264
|
+
|
265
|
+
describe "with render_views" do
|
266
|
+
render_views
|
267
|
+
it "should accept query & language parameters" do
|
268
|
+
get :index, query: "test"
|
269
|
+
puts response.body
|
270
|
+
expect(response.body).to have_link "unknown (1)", href: "/manifestations?language=unknown&query=test"
|
271
|
+
end
|
272
|
+
|
273
|
+
it "should accept facets and query parameters in sort_by menu" do
|
274
|
+
get :index, query: "test", carrier_type: "volume"
|
275
|
+
expect(response.body).to have_selector "div.right input[type=hidden][name=query][value=test]", visible: false
|
276
|
+
expect(response.body).to have_selector "div.right input[type=hidden][name=carrier_type][value=volume]", visible: false
|
277
|
+
end
|
278
|
+
end
|
246
279
|
end
|
247
280
|
end
|
248
281
|
|
249
|
-
describe
|
250
|
-
describe
|
282
|
+
describe 'GET show' do
|
283
|
+
describe 'When logged in as Administrator' do
|
251
284
|
login_fixture_admin
|
252
285
|
|
253
|
-
it
|
254
|
-
get :show, :
|
286
|
+
it 'assigns the requested manifestation as @manifestation' do
|
287
|
+
get :show, id: 1
|
255
288
|
expect(assigns(:manifestation)).to eq(Manifestation.find(1))
|
256
289
|
end
|
257
290
|
end
|
258
291
|
|
259
|
-
describe
|
292
|
+
describe 'When logged in as Librarian' do
|
260
293
|
login_fixture_librarian
|
261
294
|
|
262
|
-
it
|
263
|
-
get :show, :
|
295
|
+
it 'assigns the requested manifestation as @manifestation' do
|
296
|
+
get :show, id: 1
|
264
297
|
expect(assigns(:manifestation)).to eq(Manifestation.find(1))
|
265
298
|
end
|
266
299
|
|
267
|
-
it
|
268
|
-
get :show, :
|
300
|
+
it 'should show manifestation with agent who does not produce it' do
|
301
|
+
get :show, id: 3, agent_id: 3
|
269
302
|
expect(assigns(:manifestation)).to eq assigns(:agent).manifestations.find(3)
|
270
303
|
expect(response).to be_success
|
271
304
|
end
|
272
305
|
|
273
|
-
it
|
274
|
-
manifestation = FactoryGirl.create(:manifestation, :
|
275
|
-
|
276
|
-
|
306
|
+
it 'should not show manifestation with required_role of admin' do
|
307
|
+
manifestation = FactoryGirl.create(:manifestation, required_role_id: 4)
|
308
|
+
get :show, id: manifestation.id
|
309
|
+
expect(response).not_to be_success
|
277
310
|
end
|
278
311
|
end
|
279
312
|
|
280
|
-
describe
|
313
|
+
describe 'When logged in as User' do
|
281
314
|
login_fixture_user
|
282
315
|
|
283
|
-
it
|
284
|
-
get :show, :
|
316
|
+
it 'assigns the requested manifestation as @manifestation' do
|
317
|
+
get :show, id: 1
|
285
318
|
expect(assigns(:manifestation)).to eq(Manifestation.find(1))
|
286
319
|
end
|
287
320
|
|
288
|
-
it
|
289
|
-
get :show, :
|
321
|
+
it 'should send manifestation detail email' do
|
322
|
+
get :show, id: 1, mode: 'send_email'
|
290
323
|
expect(response).to redirect_to manifestation_url(assigns(:manifestation))
|
291
324
|
end
|
292
325
|
|
293
|
-
#it "should show myself" do
|
326
|
+
# it "should show myself" do
|
294
327
|
# get :show, :id => users(:user1).agent
|
295
328
|
# expect(response).to be_success
|
296
|
-
#end
|
329
|
+
# end
|
297
330
|
end
|
298
331
|
|
299
|
-
describe
|
300
|
-
it
|
301
|
-
get :show, :
|
332
|
+
describe 'When not logged in' do
|
333
|
+
it 'assigns the requested manifestation as @manifestation' do
|
334
|
+
get :show, id: 1
|
302
335
|
expect(assigns(:manifestation)).to eq(Manifestation.find(1))
|
303
336
|
end
|
304
337
|
|
305
|
-
it
|
306
|
-
get :show, :
|
338
|
+
it 'guest should show manifestation mods template' do
|
339
|
+
get :show, id: 22, format: 'mods'
|
307
340
|
expect(assigns(:manifestation)).to eq Manifestation.find(22)
|
308
|
-
expect(response).to render_template(
|
341
|
+
expect(response).to render_template('manifestations/show')
|
309
342
|
end
|
310
343
|
|
311
|
-
it
|
312
|
-
get :show, :
|
344
|
+
it 'should show manifestation rdf template' do
|
345
|
+
get :show, id: 22, format: 'rdf'
|
313
346
|
expect(assigns(:manifestation)).to eq Manifestation.find(22)
|
314
|
-
expect(response).to render_template(
|
347
|
+
expect(response).to render_template('manifestations/show')
|
315
348
|
end
|
316
349
|
|
317
|
-
it
|
318
|
-
get :show, :
|
350
|
+
it 'should show manifestation with holding' do
|
351
|
+
get :show, id: 1, mode: 'holding'
|
319
352
|
expect(response).to be_success
|
320
353
|
end
|
321
354
|
|
322
|
-
it
|
323
|
-
get :show, :
|
355
|
+
it 'should show manifestation with tag_edit' do
|
356
|
+
get :show, id: 1, mode: 'tag_edit'
|
324
357
|
expect(response).to render_template('manifestations/_tag_edit')
|
325
358
|
expect(response).to be_success
|
326
359
|
end
|
327
360
|
|
328
|
-
it
|
329
|
-
get :show, :
|
361
|
+
it 'should show manifestation with tag_list' do
|
362
|
+
get :show, id: 1, mode: 'tag_list'
|
330
363
|
expect(response).to render_template('manifestations/_tag_list')
|
331
364
|
expect(response).to be_success
|
332
365
|
end
|
333
366
|
|
334
|
-
it
|
335
|
-
get :show, :
|
367
|
+
it 'should show manifestation with show_creators' do
|
368
|
+
get :show, id: 1, mode: 'show_creators'
|
336
369
|
expect(response).to render_template('manifestations/_show_creators')
|
337
370
|
expect(response).to be_success
|
338
371
|
end
|
339
372
|
|
340
|
-
it
|
341
|
-
get :show, :
|
373
|
+
it 'should show manifestation with show_all_creators' do
|
374
|
+
get :show, id: 1, mode: 'show_all_creators'
|
342
375
|
expect(response).to render_template('manifestations/_show_creators')
|
343
376
|
expect(response).to be_success
|
344
377
|
end
|
345
378
|
|
346
379
|
it "should not send manifestation's detail email" do
|
347
|
-
get :show, :
|
380
|
+
get :show, id: 1, mode: 'send_email'
|
348
381
|
expect(response).to redirect_to new_user_session_url
|
349
382
|
end
|
350
383
|
end
|
351
384
|
end
|
352
385
|
|
353
|
-
describe
|
354
|
-
describe
|
386
|
+
describe 'GET new' do
|
387
|
+
describe 'When logged in as Administrator' do
|
355
388
|
login_fixture_admin
|
356
389
|
|
357
|
-
it
|
390
|
+
it 'assigns the requested manifestation as @manifestation' do
|
358
391
|
get :new
|
359
392
|
expect(assigns(:manifestation)).to_not be_valid
|
360
393
|
end
|
361
394
|
|
362
|
-
it
|
395
|
+
it 'should get new template without expression_id' do
|
363
396
|
get :new
|
364
397
|
expect(response).to be_success
|
365
398
|
end
|
366
|
-
|
367
|
-
it
|
368
|
-
get :new, :
|
399
|
+
|
400
|
+
it 'should get new template with expression_id' do
|
401
|
+
get :new, expression_id: 1
|
369
402
|
expect(response).to be_success
|
370
403
|
end
|
371
404
|
end
|
372
405
|
|
373
|
-
describe
|
406
|
+
describe 'When logged in as Librarian' do
|
374
407
|
login_fixture_librarian
|
375
408
|
|
376
|
-
it
|
409
|
+
it 'assigns the requested manifestation as @manifestation' do
|
377
410
|
get :new
|
378
411
|
expect(assigns(:manifestation)).to_not be_valid
|
379
412
|
end
|
380
413
|
|
381
|
-
it
|
414
|
+
it 'should get new template without expression_id' do
|
382
415
|
get :new
|
383
416
|
expect(response).to be_success
|
384
417
|
end
|
385
|
-
|
386
|
-
it
|
387
|
-
get :new, :
|
418
|
+
|
419
|
+
it 'should get new template with expression_id' do
|
420
|
+
get :new, expression_id: 1
|
388
421
|
expect(response).to be_success
|
389
422
|
end
|
390
423
|
|
391
|
-
it
|
424
|
+
it 'should get new template with parent_id' do
|
392
425
|
serial = FactoryGirl.create(:manifestation_serial,
|
393
|
-
statement_of_responsibility:
|
394
|
-
title_alternative:
|
395
|
-
publication_place:
|
426
|
+
statement_of_responsibility: 'statement_of_responsibility1',
|
427
|
+
title_alternative: 'title_alternative1',
|
428
|
+
publication_place: 'publication_place1',
|
396
429
|
height: 123,
|
397
430
|
width: 123,
|
398
431
|
depth: 123,
|
399
|
-
price:
|
400
|
-
access_address:
|
432
|
+
price: 'price1',
|
433
|
+
access_address: 'http://example.jp',
|
401
434
|
language_id: FactoryGirl.create(:language).id,
|
402
435
|
frequency_id: FactoryGirl.create(:frequency).id,
|
403
|
-
required_role_id: FactoryGirl.create(:role).id
|
404
|
-
)
|
436
|
+
required_role_id: FactoryGirl.create(:role).id)
|
405
437
|
serial.creators << FactoryGirl.create(:agent)
|
406
438
|
serial.contributors << FactoryGirl.create(:agent)
|
407
439
|
serial.publishers << FactoryGirl.create(:agent)
|
408
440
|
serial.subjects << FactoryGirl.create(:subject)
|
409
441
|
serial.classifications << FactoryGirl.create(:classification)
|
410
442
|
serial.save!
|
411
|
-
get :new, :
|
443
|
+
get :new, parent_id: serial.id
|
412
444
|
expect(response).to be_success
|
413
445
|
manifestation = assigns(:manifestation)
|
414
446
|
parent = assigns(:parent)
|
@@ -431,21 +463,20 @@ describe ManifestationsController do
|
|
431
463
|
expect(manifestation.frequency).to eq parent.frequency
|
432
464
|
expect(manifestation.required_role).to eq parent.required_role
|
433
465
|
end
|
434
|
-
|
435
466
|
end
|
436
467
|
|
437
|
-
describe
|
468
|
+
describe 'When logged in as User' do
|
438
469
|
login_fixture_user
|
439
470
|
|
440
|
-
it
|
471
|
+
it 'should not assign the requested manifestation as @manifestation' do
|
441
472
|
get :new
|
442
473
|
expect(assigns(:manifestation)).to be_nil
|
443
474
|
expect(response).to be_forbidden
|
444
475
|
end
|
445
476
|
end
|
446
477
|
|
447
|
-
describe
|
448
|
-
it
|
478
|
+
describe 'When not logged in' do
|
479
|
+
it 'should not assign the requested manifestation as @manifestation' do
|
449
480
|
get :new
|
450
481
|
expect(assigns(:manifestation)).to be_nil
|
451
482
|
expect(response).to redirect_to(new_user_session_url)
|
@@ -453,376 +484,375 @@ describe ManifestationsController do
|
|
453
484
|
end
|
454
485
|
end
|
455
486
|
|
456
|
-
describe
|
457
|
-
describe
|
487
|
+
describe 'GET edit' do
|
488
|
+
describe 'When logged in as Administrator' do
|
458
489
|
login_fixture_admin
|
459
490
|
|
460
|
-
it
|
491
|
+
it 'assigns the requested manifestation as @manifestation' do
|
461
492
|
manifestation = FactoryGirl.create(:manifestation)
|
462
|
-
get :edit, :
|
493
|
+
get :edit, id: manifestation.id
|
463
494
|
expect(assigns(:manifestation)).to eq(manifestation)
|
464
495
|
end
|
465
496
|
end
|
466
497
|
|
467
|
-
describe
|
498
|
+
describe 'When logged in as Librarian' do
|
468
499
|
login_fixture_librarian
|
469
500
|
|
470
|
-
it
|
501
|
+
it 'assigns the requested manifestation as @manifestation' do
|
471
502
|
manifestation = FactoryGirl.create(:manifestation)
|
472
|
-
get :edit, :
|
503
|
+
get :edit, id: manifestation.id
|
473
504
|
expect(assigns(:manifestation)).to eq(manifestation)
|
474
505
|
end
|
475
506
|
|
476
507
|
render_views
|
477
|
-
it
|
508
|
+
it 'assigns the identifiers to @manifestation' do
|
478
509
|
manifestation = FactoryGirl.create(:manifestation)
|
479
510
|
identifier = FactoryGirl.create(:identifier)
|
480
511
|
manifestation.identifiers << identifier
|
481
|
-
get :edit, :
|
512
|
+
get :edit, id: manifestation.id
|
482
513
|
expect(assigns(:manifestation)).to eq manifestation
|
483
514
|
expect(assigns(:manifestation).identifiers).to eq manifestation.identifiers
|
484
|
-
expect(response).to render_template(partial:
|
515
|
+
expect(response).to render_template(partial: 'manifestations/_identifier_fields')
|
485
516
|
end
|
486
517
|
end
|
487
518
|
|
488
|
-
describe
|
519
|
+
describe 'When logged in as User' do
|
489
520
|
login_fixture_user
|
490
521
|
|
491
|
-
it
|
522
|
+
it 'assigns the requested manifestation as @manifestation' do
|
492
523
|
manifestation = FactoryGirl.create(:manifestation)
|
493
|
-
get :edit, :
|
524
|
+
get :edit, id: manifestation.id
|
494
525
|
expect(response).to be_forbidden
|
495
526
|
end
|
496
527
|
|
497
|
-
it
|
498
|
-
get :edit, :
|
528
|
+
it 'should edit manifestation with tag_edit' do
|
529
|
+
get :edit, id: 1, mode: 'tag_edit'
|
499
530
|
expect(response).to be_success
|
500
531
|
end
|
501
532
|
end
|
502
533
|
|
503
|
-
describe
|
504
|
-
it
|
534
|
+
describe 'When not logged in' do
|
535
|
+
it 'should not assign the requested manifestation as @manifestation' do
|
505
536
|
manifestation = FactoryGirl.create(:manifestation)
|
506
|
-
get :edit, :
|
537
|
+
get :edit, id: manifestation.id
|
507
538
|
expect(response).to redirect_to(new_user_session_url)
|
508
539
|
end
|
509
540
|
end
|
510
541
|
end
|
511
542
|
|
512
|
-
describe
|
543
|
+
describe 'POST create' do
|
513
544
|
before(:each) do
|
514
545
|
@attrs = valid_attributes
|
515
|
-
@invalid_attrs = {:
|
546
|
+
@invalid_attrs = { original_title: '' }
|
516
547
|
end
|
517
548
|
|
518
|
-
describe
|
549
|
+
describe 'When logged in as Administrator' do
|
519
550
|
login_fixture_admin
|
520
551
|
|
521
|
-
describe
|
522
|
-
it
|
523
|
-
post :create, :
|
552
|
+
describe 'with valid params' do
|
553
|
+
it 'assigns a newly created manifestation as @manifestation' do
|
554
|
+
post :create, manifestation: @attrs
|
524
555
|
expect(assigns(:manifestation)).to be_valid
|
525
556
|
end
|
526
557
|
|
527
|
-
it
|
528
|
-
post :create, :
|
558
|
+
it 'assigns a series_statement' do
|
559
|
+
post :create, manifestation: @attrs.merge(series_statements_attributes: { '0' => { original_title: SeriesStatement.find(1).original_title } })
|
529
560
|
assigns(:manifestation).reload
|
530
561
|
assigns(:manifestation).series_statements.pluck(:original_title).include?(series_statements(:one).original_title).should be_truthy
|
531
562
|
end
|
532
563
|
|
533
|
-
it
|
534
|
-
post :create, :
|
564
|
+
it 'redirects to the created manifestation' do
|
565
|
+
post :create, manifestation: @attrs
|
535
566
|
expect(response).to redirect_to(manifestation_url(assigns(:manifestation)))
|
536
567
|
end
|
537
568
|
end
|
538
569
|
|
539
|
-
describe
|
540
|
-
it
|
541
|
-
post :create, :
|
570
|
+
describe 'with invalid params' do
|
571
|
+
it 'assigns a newly created but unsaved manifestation as @manifestation' do
|
572
|
+
post :create, manifestation: @invalid_attrs
|
542
573
|
expect(assigns(:manifestation)).to_not be_valid
|
543
574
|
end
|
544
575
|
|
545
576
|
it "re-renders the 'new' template" do
|
546
|
-
post :create, :
|
547
|
-
expect(response).to render_template(
|
577
|
+
post :create, manifestation: @invalid_attrs
|
578
|
+
expect(response).to render_template('new')
|
548
579
|
end
|
549
580
|
end
|
550
581
|
end
|
551
582
|
|
552
|
-
describe
|
583
|
+
describe 'When logged in as Librarian' do
|
553
584
|
login_fixture_librarian
|
554
585
|
|
555
|
-
describe
|
556
|
-
it
|
557
|
-
post :create, :
|
586
|
+
describe 'with valid params' do
|
587
|
+
it 'assigns a newly created manifestation as @manifestation' do
|
588
|
+
post :create, manifestation: @attrs
|
558
589
|
expect(assigns(:manifestation)).to be_valid
|
559
590
|
end
|
560
591
|
|
561
|
-
it
|
562
|
-
post :create, :
|
592
|
+
it 'redirects to the created manifestation' do
|
593
|
+
post :create, manifestation: @attrs
|
563
594
|
expect(response).to redirect_to(manifestation_url(assigns(:manifestation)))
|
564
595
|
end
|
565
596
|
|
566
|
-
it
|
567
|
-
post :create, :
|
597
|
+
it 'accepts an attachment file' do
|
598
|
+
post :create, manifestation: @attrs.merge(attachment: fixture_file_upload('/../../examples/resource_import_file_sample1.tsv', 'text/csv'))
|
568
599
|
expect(assigns(:manifestation)).to be_valid
|
569
600
|
end
|
570
601
|
end
|
571
602
|
|
572
|
-
describe
|
573
|
-
it
|
574
|
-
post :create, :
|
603
|
+
describe 'with invalid params' do
|
604
|
+
it 'assigns a newly created but unsaved manifestation as @manifestation' do
|
605
|
+
post :create, manifestation: @invalid_attrs
|
575
606
|
expect(assigns(:manifestation)).to_not be_valid
|
576
607
|
end
|
577
608
|
|
578
609
|
it "re-renders the 'new' template" do
|
579
|
-
post :create, :
|
580
|
-
expect(response).to render_template(
|
610
|
+
post :create, manifestation: @invalid_attrs
|
611
|
+
expect(response).to render_template('new')
|
581
612
|
end
|
582
613
|
end
|
583
614
|
end
|
584
615
|
|
585
|
-
describe
|
616
|
+
describe 'When logged in as User' do
|
586
617
|
login_fixture_user
|
587
618
|
|
588
|
-
describe
|
589
|
-
it
|
590
|
-
post :create, :
|
619
|
+
describe 'with valid params' do
|
620
|
+
it 'assigns a newly created manifestation as @manifestation' do
|
621
|
+
post :create, manifestation: @attrs
|
591
622
|
expect(assigns(:manifestation)).to be_nil
|
592
623
|
end
|
593
624
|
|
594
|
-
it
|
595
|
-
post :create, :
|
625
|
+
it 'should be forbidden' do
|
626
|
+
post :create, manifestation: @attrs
|
596
627
|
expect(response).to be_forbidden
|
597
628
|
end
|
598
629
|
end
|
599
630
|
|
600
|
-
describe
|
601
|
-
it
|
602
|
-
post :create, :
|
631
|
+
describe 'with invalid params' do
|
632
|
+
it 'assigns a newly created but unsaved manifestation as @manifestation' do
|
633
|
+
post :create, manifestation: @invalid_attrs
|
603
634
|
expect(assigns(:manifestation)).to be_nil
|
604
635
|
end
|
605
636
|
|
606
|
-
it
|
607
|
-
post :create, :
|
637
|
+
it 'should be forbidden' do
|
638
|
+
post :create, manifestation: @invalid_attrs
|
608
639
|
expect(response).to be_forbidden
|
609
640
|
end
|
610
641
|
end
|
611
642
|
end
|
612
643
|
|
613
|
-
describe
|
614
|
-
describe
|
615
|
-
it
|
616
|
-
post :create, :
|
644
|
+
describe 'When not logged in' do
|
645
|
+
describe 'with valid params' do
|
646
|
+
it 'assigns a newly created manifestation as @manifestation' do
|
647
|
+
post :create, manifestation: @attrs
|
617
648
|
expect(assigns(:manifestation)).to be_nil
|
618
649
|
end
|
619
650
|
|
620
|
-
it
|
621
|
-
post :create, :
|
651
|
+
it 'should be forbidden' do
|
652
|
+
post :create, manifestation: @attrs
|
622
653
|
expect(response).to redirect_to(new_user_session_url)
|
623
654
|
end
|
624
655
|
end
|
625
656
|
|
626
|
-
describe
|
627
|
-
it
|
628
|
-
post :create, :
|
657
|
+
describe 'with invalid params' do
|
658
|
+
it 'assigns a newly created but unsaved manifestation as @manifestation' do
|
659
|
+
post :create, manifestation: @invalid_attrs
|
629
660
|
expect(assigns(:manifestation)).to be_nil
|
630
661
|
end
|
631
662
|
|
632
|
-
it
|
633
|
-
post :create, :
|
663
|
+
it 'should be forbidden' do
|
664
|
+
post :create, manifestation: @invalid_attrs
|
634
665
|
expect(response).to redirect_to(new_user_session_url)
|
635
666
|
end
|
636
667
|
end
|
637
668
|
end
|
638
669
|
end
|
639
670
|
|
640
|
-
describe
|
671
|
+
describe 'PUT update' do
|
641
672
|
before(:each) do
|
642
673
|
@manifestation = FactoryGirl.create(:manifestation)
|
643
674
|
@manifestation.series_statements = [SeriesStatement.find(1)]
|
644
675
|
@attrs = valid_attributes
|
645
|
-
@invalid_attrs = {:
|
676
|
+
@invalid_attrs = { original_title: '' }
|
646
677
|
end
|
647
678
|
|
648
|
-
describe
|
679
|
+
describe 'When logged in as Administrator' do
|
649
680
|
login_fixture_admin
|
650
681
|
|
651
|
-
describe
|
652
|
-
it
|
653
|
-
put :update, :
|
682
|
+
describe 'with valid params' do
|
683
|
+
it 'updates the requested manifestation' do
|
684
|
+
put :update, id: @manifestation.id, manifestation: @attrs
|
654
685
|
end
|
655
686
|
|
656
|
-
it
|
657
|
-
put :update, :
|
687
|
+
it 'assigns a series_statement' do
|
688
|
+
put :update, id: @manifestation.id, manifestation: @attrs.merge(series_statements_attributes: { '0' => { :original_title => series_statements(:two).original_title, '_destroy' => 'false' } })
|
658
689
|
assigns(:manifestation).reload
|
659
690
|
assigns(:manifestation).series_statements.pluck(:original_title).include?(series_statements(:two).original_title).should be_truthy
|
660
691
|
end
|
661
692
|
|
662
|
-
it
|
663
|
-
put :update, :
|
693
|
+
it 'assigns the requested manifestation as @manifestation' do
|
694
|
+
put :update, id: @manifestation.id, manifestation: @attrs
|
664
695
|
expect(assigns(:manifestation)).to eq(@manifestation)
|
665
696
|
end
|
666
697
|
end
|
667
698
|
|
668
|
-
describe
|
669
|
-
it
|
670
|
-
put :update, :
|
671
|
-
expect(response).to render_template(
|
699
|
+
describe 'with invalid params' do
|
700
|
+
it 'assigns the requested manifestation as @manifestation' do
|
701
|
+
put :update, id: @manifestation.id, manifestation: @invalid_attrs
|
702
|
+
expect(response).to render_template('edit')
|
672
703
|
end
|
673
704
|
end
|
674
705
|
end
|
675
706
|
|
676
|
-
describe
|
707
|
+
describe 'When logged in as Librarian' do
|
677
708
|
login_fixture_librarian
|
678
709
|
|
679
|
-
describe
|
680
|
-
it
|
681
|
-
put :update, :
|
710
|
+
describe 'with valid params' do
|
711
|
+
it 'updates the requested manifestation' do
|
712
|
+
put :update, id: @manifestation.id, manifestation: @attrs
|
682
713
|
end
|
683
714
|
|
684
|
-
it
|
685
|
-
put :update, :
|
715
|
+
it 'assigns the requested manifestation as @manifestation' do
|
716
|
+
put :update, id: @manifestation.id, manifestation: @attrs
|
686
717
|
expect(assigns(:manifestation)).to eq(@manifestation)
|
687
718
|
expect(response).to redirect_to(@manifestation)
|
688
719
|
end
|
689
720
|
|
690
|
-
it
|
721
|
+
it 'assigns identifiers to @manifestation' do
|
691
722
|
identifiers_attrs = {
|
692
|
-
identifier_attributes: [
|
723
|
+
identifier_attributes: [FactoryGirl.create(:identifier)]
|
693
724
|
}
|
694
725
|
put :update, id: @manifestation.id, manifestation: @attrs.merge(identifiers_attrs)
|
695
726
|
expect(assigns(:manifestation)).to eq @manifestation
|
696
727
|
end
|
697
728
|
end
|
698
729
|
|
699
|
-
describe
|
700
|
-
it
|
701
|
-
put :update, :
|
730
|
+
describe 'with invalid params' do
|
731
|
+
it 'assigns the manifestation as @manifestation' do
|
732
|
+
put :update, id: @manifestation, manifestation: @invalid_attrs
|
702
733
|
expect(assigns(:manifestation)).to_not be_valid
|
703
734
|
end
|
704
735
|
|
705
736
|
it "re-renders the 'edit' template" do
|
706
|
-
put :update, :
|
707
|
-
expect(response).to render_template(
|
737
|
+
put :update, id: @manifestation, manifestation: @invalid_attrs
|
738
|
+
expect(response).to render_template('edit')
|
708
739
|
end
|
709
740
|
end
|
710
741
|
end
|
711
742
|
|
712
|
-
describe
|
743
|
+
describe 'When logged in as User' do
|
713
744
|
login_fixture_user
|
714
745
|
|
715
|
-
describe
|
716
|
-
it
|
717
|
-
put :update, :
|
746
|
+
describe 'with valid params' do
|
747
|
+
it 'updates the requested manifestation' do
|
748
|
+
put :update, id: @manifestation.id, manifestation: @attrs
|
718
749
|
end
|
719
750
|
|
720
|
-
it
|
721
|
-
put :update, :
|
751
|
+
it 'assigns the requested manifestation as @manifestation' do
|
752
|
+
put :update, id: @manifestation.id, manifestation: @attrs
|
722
753
|
expect(assigns(:manifestation)).to eq(@manifestation)
|
723
754
|
expect(response).to be_forbidden
|
724
755
|
end
|
725
756
|
end
|
726
757
|
|
727
|
-
describe
|
728
|
-
it
|
729
|
-
put :update, :
|
758
|
+
describe 'with invalid params' do
|
759
|
+
it 'assigns the requested manifestation as @manifestation' do
|
760
|
+
put :update, id: @manifestation.id, manifestation: @invalid_attrs
|
730
761
|
expect(response).to be_forbidden
|
731
762
|
end
|
732
763
|
end
|
733
764
|
end
|
734
765
|
|
735
|
-
describe
|
736
|
-
describe
|
737
|
-
it
|
738
|
-
put :update, :
|
766
|
+
describe 'When not logged in' do
|
767
|
+
describe 'with valid params' do
|
768
|
+
it 'updates the requested manifestation' do
|
769
|
+
put :update, id: @manifestation.id, manifestation: @attrs
|
739
770
|
end
|
740
771
|
|
741
|
-
it
|
742
|
-
put :update, :
|
772
|
+
it 'should be forbidden' do
|
773
|
+
put :update, id: @manifestation.id, manifestation: @attrs
|
743
774
|
expect(response).to redirect_to(new_user_session_url)
|
744
775
|
end
|
745
776
|
end
|
746
777
|
|
747
|
-
describe
|
748
|
-
it
|
749
|
-
put :update, :
|
778
|
+
describe 'with invalid params' do
|
779
|
+
it 'assigns the requested manifestation as @manifestation' do
|
780
|
+
put :update, id: @manifestation.id, manifestation: @invalid_attrs
|
750
781
|
expect(response).to redirect_to(new_user_session_url)
|
751
782
|
end
|
752
783
|
end
|
753
784
|
end
|
754
785
|
end
|
755
786
|
|
756
|
-
describe
|
787
|
+
describe 'DELETE destroy' do
|
757
788
|
before(:each) do
|
758
789
|
@manifestation = FactoryGirl.create(:manifestation)
|
759
790
|
end
|
760
791
|
|
761
|
-
describe
|
792
|
+
describe 'When logged in as Administrator' do
|
762
793
|
login_fixture_admin
|
763
794
|
|
764
|
-
it
|
765
|
-
delete :destroy, :
|
795
|
+
it 'destroys the requested manifestation' do
|
796
|
+
delete :destroy, id: @manifestation.id
|
766
797
|
end
|
767
798
|
|
768
|
-
it
|
769
|
-
delete :destroy, :
|
799
|
+
it 'redirects to the manifestations list' do
|
800
|
+
delete :destroy, id: @manifestation.id
|
770
801
|
expect(response).to redirect_to(manifestations_url)
|
771
802
|
end
|
772
803
|
|
773
|
-
it
|
774
|
-
delete :destroy, :
|
804
|
+
it 'should not destroy the reserved manifestation' do
|
805
|
+
delete :destroy, id: 2
|
775
806
|
expect(response).to be_forbidden
|
776
807
|
end
|
777
808
|
|
778
|
-
it
|
779
|
-
delete :destroy, :
|
809
|
+
it 'should not destroy manifestation contains items' do
|
810
|
+
delete :destroy, id: 1
|
780
811
|
expect(response).to be_forbidden
|
781
812
|
end
|
782
813
|
|
783
|
-
it
|
814
|
+
it 'should not destroy manifestation of series master with children' do
|
784
815
|
@manifestation = FactoryGirl.create(:manifestation_serial)
|
785
816
|
child = FactoryGirl.create(:manifestation)
|
786
817
|
@manifestation.derived_manifestations << child
|
787
|
-
delete :destroy, :
|
818
|
+
delete :destroy, id: @manifestation.id
|
788
819
|
expect(response).to be_forbidden
|
789
820
|
end
|
790
|
-
|
791
821
|
end
|
792
822
|
|
793
|
-
describe
|
823
|
+
describe 'When logged in as Librarian' do
|
794
824
|
login_fixture_librarian
|
795
825
|
|
796
|
-
it
|
797
|
-
delete :destroy, :
|
826
|
+
it 'destroys the requested manifestation' do
|
827
|
+
delete :destroy, id: @manifestation.id
|
798
828
|
end
|
799
829
|
|
800
|
-
it
|
801
|
-
delete :destroy, :
|
830
|
+
it 'should be forbidden' do
|
831
|
+
delete :destroy, id: @manifestation.id
|
802
832
|
expect(response).to redirect_to(manifestations_url)
|
803
833
|
end
|
804
834
|
end
|
805
835
|
|
806
|
-
describe
|
836
|
+
describe 'When logged in as User' do
|
807
837
|
login_fixture_user
|
808
838
|
|
809
|
-
it
|
810
|
-
delete :destroy, :
|
839
|
+
it 'destroys the requested manifestation' do
|
840
|
+
delete :destroy, id: @manifestation.id
|
811
841
|
end
|
812
842
|
|
813
|
-
it
|
814
|
-
delete :destroy, :
|
843
|
+
it 'should be forbidden' do
|
844
|
+
delete :destroy, id: @manifestation.id
|
815
845
|
expect(response).to be_forbidden
|
816
846
|
end
|
817
847
|
end
|
818
848
|
|
819
|
-
describe
|
820
|
-
it
|
821
|
-
delete :destroy, :
|
849
|
+
describe 'When not logged in' do
|
850
|
+
it 'destroys the requested manifestation' do
|
851
|
+
delete :destroy, id: @manifestation.id
|
822
852
|
end
|
823
853
|
|
824
|
-
it
|
825
|
-
delete :destroy, :
|
854
|
+
it 'should be forbidden' do
|
855
|
+
delete :destroy, id: @manifestation.id
|
826
856
|
expect(response).to redirect_to(new_user_session_url)
|
827
857
|
end
|
828
858
|
end
|