enju_subject 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/classification_types_controller.rb +2 -3
- data/app/controllers/subject_heading_types_controller.rb +2 -3
- data/app/controllers/subject_types_controller.rb +2 -3
- data/app/controllers/work_has_subjects_controller.rb +6 -4
- data/lib/enju_subject/version.rb +1 -1
- data/spec/controllers/classification_types_controller_spec.rb +7 -3
- data/spec/controllers/classifications_controller_spec.rb +6 -2
- data/spec/controllers/subject_has_classifications_controller_spec.rb +443 -0
- data/spec/controllers/subject_heading_type_has_subjects_controller_spec.rb +6 -2
- data/spec/controllers/subject_heading_types_controller_spec.rb +7 -3
- data/spec/controllers/subject_types_controller_spec.rb +7 -3
- data/spec/controllers/subjects_controller_spec.rb +7 -7
- data/spec/dummy/app/controllers/application_controller.rb +8 -0
- data/spec/dummy/config/locales/devise.en.yml +5 -6
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/sunspot-solr-test.log +153 -149
- data/spec/dummy/log/test.log +52941 -0
- data/spec/factories/subject_has_classification.rb +6 -0
- metadata +86 -27
@@ -4,9 +4,8 @@ class ClassificationTypesController < InheritedResources::Base
|
|
4
4
|
|
5
5
|
def update
|
6
6
|
@classification_type = ClassificationType.find(params[:id])
|
7
|
-
if
|
8
|
-
@classification_type
|
9
|
-
redirect_to classification_types_url
|
7
|
+
if params[:move]
|
8
|
+
move_position(@classification_type, params[:move])
|
10
9
|
return
|
11
10
|
end
|
12
11
|
update!
|
@@ -4,9 +4,8 @@ class SubjectHeadingTypesController < InheritedResources::Base
|
|
4
4
|
|
5
5
|
def update
|
6
6
|
@subject_heading_type = SubjectHeadingType.find(params[:id])
|
7
|
-
if params[:
|
8
|
-
@subject_heading_type
|
9
|
-
redirect_to subject_heading_types_url
|
7
|
+
if params[:move]
|
8
|
+
move_position(@subject_heading_type, params[:move])
|
10
9
|
return
|
11
10
|
end
|
12
11
|
update!
|
@@ -4,9 +4,8 @@ class SubjectTypesController < InheritedResources::Base
|
|
4
4
|
|
5
5
|
def update
|
6
6
|
@subject_type = SubjectType.find(params[:id])
|
7
|
-
if params[:
|
8
|
-
@subject_type
|
9
|
-
redirect_to subject_types_url
|
7
|
+
if params[:move]
|
8
|
+
move_position(@subject_type, params[:move])
|
10
9
|
return
|
11
10
|
end
|
12
11
|
update!
|
@@ -68,10 +68,12 @@ class WorkHasSubjectsController < ApplicationController
|
|
68
68
|
# PUT /work_has_subjects/1.json
|
69
69
|
def update
|
70
70
|
get_work
|
71
|
-
if @work and params[:
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
if @work and params[:move]
|
72
|
+
if ['higher', 'lower'].include?(params[:move])
|
73
|
+
@work_has_subject.send("move_#{params[:move]}")
|
74
|
+
redirect_to work_work_has_subjects_url(@work)
|
75
|
+
return
|
76
|
+
end
|
75
77
|
end
|
76
78
|
|
77
79
|
respond_to do |format|
|
data/lib/enju_subject/version.rb
CHANGED
@@ -5,6 +5,10 @@ describe ClassificationTypesController do
|
|
5
5
|
fixtures :all
|
6
6
|
disconnect_sunspot
|
7
7
|
|
8
|
+
def valid_attributes
|
9
|
+
FactoryGirl.attributes_for(:classification_type)
|
10
|
+
end
|
11
|
+
|
8
12
|
describe "GET index" do
|
9
13
|
before(:each) do
|
10
14
|
FactoryGirl.create(:classification_type)
|
@@ -167,7 +171,7 @@ describe ClassificationTypesController do
|
|
167
171
|
|
168
172
|
describe "POST create" do
|
169
173
|
before(:each) do
|
170
|
-
@attrs =
|
174
|
+
@attrs = valid_attributes
|
171
175
|
@invalid_attrs = {:name => ''}
|
172
176
|
end
|
173
177
|
|
@@ -285,7 +289,7 @@ describe ClassificationTypesController do
|
|
285
289
|
describe "PUT update" do
|
286
290
|
before(:each) do
|
287
291
|
@classification_type = FactoryGirl.create(:classification_type)
|
288
|
-
@attrs =
|
292
|
+
@attrs = valid_attributes
|
289
293
|
@invalid_attrs = {:name => ''}
|
290
294
|
end
|
291
295
|
|
@@ -303,7 +307,7 @@ describe ClassificationTypesController do
|
|
303
307
|
end
|
304
308
|
|
305
309
|
it "moves its position when specified" do
|
306
|
-
put :update, :id => @classification_type.id, :classification_type => @attrs, :
|
310
|
+
put :update, :id => @classification_type.id, :classification_type => @attrs, :move => 'lower'
|
307
311
|
response.should redirect_to(classification_types_url)
|
308
312
|
end
|
309
313
|
end
|
@@ -3,6 +3,10 @@ require 'spec_helper'
|
|
3
3
|
describe ClassificationsController do
|
4
4
|
fixtures :all
|
5
5
|
|
6
|
+
def valid_attributes
|
7
|
+
FactoryGirl.attributes_for(:classification)
|
8
|
+
end
|
9
|
+
|
6
10
|
describe "GET index", :solr => true do
|
7
11
|
describe "When logged in as Administrator" do
|
8
12
|
login_admin
|
@@ -164,7 +168,7 @@ describe ClassificationsController do
|
|
164
168
|
|
165
169
|
describe "POST create" do
|
166
170
|
before(:each) do
|
167
|
-
@attrs =
|
171
|
+
@attrs = valid_attributes
|
168
172
|
@invalid_attrs = {:category => ''}
|
169
173
|
end
|
170
174
|
|
@@ -282,7 +286,7 @@ describe ClassificationsController do
|
|
282
286
|
describe "PUT update" do
|
283
287
|
before(:each) do
|
284
288
|
@classification = FactoryGirl.create(:classification)
|
285
|
-
@attrs =
|
289
|
+
@attrs = valid_attributes
|
286
290
|
@invalid_attrs = {:category => ''}
|
287
291
|
end
|
288
292
|
|
@@ -0,0 +1,443 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'sunspot/rails/spec_helper'
|
3
|
+
|
4
|
+
describe SubjectHasClassificationsController do
|
5
|
+
fixtures :all
|
6
|
+
disconnect_sunspot
|
7
|
+
|
8
|
+
def valid_attributes
|
9
|
+
FactoryGirl.attributes_for(:subject_has_classification)
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "GET index" do
|
13
|
+
before(:each) do
|
14
|
+
FactoryGirl.create(:subject_has_classification)
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "When logged in as Administrator" do
|
18
|
+
login_admin
|
19
|
+
|
20
|
+
it "assigns all subject_has_classifications as @subject_has_classifications" do
|
21
|
+
get :index
|
22
|
+
assigns(:subject_has_classifications).should eq(SubjectHasClassification.page(1))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "When logged in as Librarian" do
|
27
|
+
login_librarian
|
28
|
+
|
29
|
+
it "assigns all subject_has_classifications as @subject_has_classifications" do
|
30
|
+
get :index
|
31
|
+
assigns(:subject_has_classifications).should eq(SubjectHasClassification.page(1))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "When logged in as User" do
|
36
|
+
login_user
|
37
|
+
|
38
|
+
it "assigns all subject_has_classifications as @subject_has_classifications" do
|
39
|
+
get :index
|
40
|
+
assigns(:subject_has_classifications).should eq(SubjectHasClassification.page(1))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "When not logged in" do
|
45
|
+
it "should not assign subject_has_classifications as @subject_has_classifications" do
|
46
|
+
get :index
|
47
|
+
assigns(:subject_has_classifications).should eq(SubjectHasClassification.page(1))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "GET show" do
|
53
|
+
describe "When logged in as Administrator" do
|
54
|
+
login_admin
|
55
|
+
|
56
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
57
|
+
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
58
|
+
get :show, :id => subject_has_classification.id
|
59
|
+
assigns(:subject_has_classification).should eq(subject_has_classification)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "When logged in as Librarian" do
|
64
|
+
login_librarian
|
65
|
+
|
66
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
67
|
+
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
68
|
+
get :show, :id => subject_has_classification.id
|
69
|
+
assigns(:subject_has_classification).should eq(subject_has_classification)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "When logged in as User" do
|
74
|
+
login_user
|
75
|
+
|
76
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
77
|
+
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
78
|
+
get :show, :id => subject_has_classification.id
|
79
|
+
assigns(:subject_has_classification).should eq(subject_has_classification)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe "When not logged in" do
|
84
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
85
|
+
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
86
|
+
get :show, :id => subject_has_classification.id
|
87
|
+
assigns(:subject_has_classification).should eq(subject_has_classification)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "GET new" do
|
93
|
+
describe "When logged in as Administrator" do
|
94
|
+
login_admin
|
95
|
+
|
96
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
97
|
+
get :new
|
98
|
+
assigns(:subject_has_classification).should_not be_valid
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe "When logged in as Librarian" do
|
103
|
+
login_librarian
|
104
|
+
|
105
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
106
|
+
get :new
|
107
|
+
assigns(:subject_has_classification).should_not be_valid
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe "When logged in as User" do
|
112
|
+
login_user
|
113
|
+
|
114
|
+
it "should not assign the requested subject_has_classification as @subject_has_classification" do
|
115
|
+
get :new
|
116
|
+
assigns(:subject_has_classification).should_not be_valid
|
117
|
+
response.should be_forbidden
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe "When not logged in" do
|
122
|
+
it "should not assign the requested subject_has_classification as @subject_has_classification" do
|
123
|
+
get :new
|
124
|
+
assigns(:subject_has_classification).should_not be_valid
|
125
|
+
response.should redirect_to(new_user_session_url)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe "GET edit" do
|
131
|
+
describe "When logged in as Administrator" do
|
132
|
+
login_admin
|
133
|
+
|
134
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
135
|
+
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
136
|
+
get :edit, :id => subject_has_classification.id
|
137
|
+
assigns(:subject_has_classification).should eq(subject_has_classification)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe "When logged in as Librarian" do
|
142
|
+
login_librarian
|
143
|
+
|
144
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
145
|
+
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
146
|
+
get :edit, :id => subject_has_classification.id
|
147
|
+
assigns(:subject_has_classification).should eq(subject_has_classification)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
describe "When logged in as User" do
|
152
|
+
login_user
|
153
|
+
|
154
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
155
|
+
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
156
|
+
get :edit, :id => subject_has_classification.id
|
157
|
+
response.should be_forbidden
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
describe "When not logged in" do
|
162
|
+
it "should not assign the requested subject_has_classification as @subject_has_classification" do
|
163
|
+
subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
164
|
+
get :edit, :id => subject_has_classification.id
|
165
|
+
response.should redirect_to(new_user_session_url)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
describe "POST create" do
|
171
|
+
before(:each) do
|
172
|
+
@attrs = valid_attributes
|
173
|
+
@invalid_attrs = {:subject_id => ''}
|
174
|
+
end
|
175
|
+
|
176
|
+
describe "When logged in as Administrator" do
|
177
|
+
login_admin
|
178
|
+
|
179
|
+
describe "with valid params" do
|
180
|
+
it "assigns a newly created subject_has_classification as @subject_has_classification" do
|
181
|
+
post :create, :subject_has_classification => @attrs
|
182
|
+
assigns(:subject_has_classification).should be_valid
|
183
|
+
end
|
184
|
+
|
185
|
+
it "redirects to the created subject_has_classification" do
|
186
|
+
post :create, :subject_has_classification => @attrs
|
187
|
+
response.should redirect_to(subject_has_classification_url(assigns(:subject_has_classification)))
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
describe "with invalid params" do
|
192
|
+
it "assigns a newly created but unsaved subject_has_classification as @subject_has_classification" do
|
193
|
+
post :create, :subject_has_classification => @invalid_attrs
|
194
|
+
assigns(:subject_has_classification).should_not be_valid
|
195
|
+
end
|
196
|
+
|
197
|
+
it "re-renders the 'new' template" do
|
198
|
+
post :create, :subject_has_classification => @invalid_attrs
|
199
|
+
response.should render_template("new")
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
describe "When logged in as Librarian" do
|
205
|
+
login_librarian
|
206
|
+
|
207
|
+
describe "with valid params" do
|
208
|
+
it "assigns a newly created subject_has_classification as @subject_has_classification" do
|
209
|
+
post :create, :subject_has_classification => @attrs
|
210
|
+
assigns(:subject_has_classification).should be_valid
|
211
|
+
end
|
212
|
+
|
213
|
+
it "redirects to the created subject_has_classification" do
|
214
|
+
post :create, :subject_has_classification => @attrs
|
215
|
+
response.should redirect_to(subject_has_classification_url(assigns(:subject_has_classification)))
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
describe "with invalid params" do
|
220
|
+
it "assigns a newly created but unsaved subject_has_classification as @subject_has_classification" do
|
221
|
+
post :create, :subject_has_classification => @invalid_attrs
|
222
|
+
assigns(:subject_has_classification).should_not be_valid
|
223
|
+
end
|
224
|
+
|
225
|
+
it "re-renders the 'new' template" do
|
226
|
+
post :create, :subject_has_classification => @invalid_attrs
|
227
|
+
response.should render_template("new")
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
describe "When logged in as User" do
|
233
|
+
login_user
|
234
|
+
|
235
|
+
describe "with valid params" do
|
236
|
+
it "assigns a newly created subject_has_classification as @subject_has_classification" do
|
237
|
+
post :create, :subject_has_classification => @attrs
|
238
|
+
assigns(:subject_has_classification).should be_valid
|
239
|
+
end
|
240
|
+
|
241
|
+
it "should be forbidden" do
|
242
|
+
post :create, :subject_has_classification => @attrs
|
243
|
+
response.should be_forbidden
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
describe "with invalid params" do
|
248
|
+
it "assigns a newly created but unsaved subject_has_classification as @subject_has_classification" do
|
249
|
+
post :create, :subject_has_classification => @invalid_attrs
|
250
|
+
assigns(:subject_has_classification).should_not be_valid
|
251
|
+
end
|
252
|
+
|
253
|
+
it "should be forbidden" do
|
254
|
+
post :create, :subject_has_classification => @invalid_attrs
|
255
|
+
response.should be_forbidden
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
describe "When not logged in" do
|
261
|
+
describe "with valid params" do
|
262
|
+
it "assigns a newly created subject_has_classification as @subject_has_classification" do
|
263
|
+
post :create, :subject_has_classification => @attrs
|
264
|
+
assigns(:subject_has_classification).should be_valid
|
265
|
+
end
|
266
|
+
|
267
|
+
it "should be forbidden" do
|
268
|
+
post :create, :subject_has_classification => @attrs
|
269
|
+
response.should redirect_to(new_user_session_url)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
describe "with invalid params" do
|
274
|
+
it "assigns a newly created but unsaved subject_has_classification as @subject_has_classification" do
|
275
|
+
post :create, :subject_has_classification => @invalid_attrs
|
276
|
+
assigns(:subject_has_classification).should_not be_valid
|
277
|
+
end
|
278
|
+
|
279
|
+
it "should be forbidden" do
|
280
|
+
post :create, :subject_has_classification => @invalid_attrs
|
281
|
+
response.should redirect_to(new_user_session_url)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
describe "PUT update" do
|
288
|
+
before(:each) do
|
289
|
+
@subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
290
|
+
@attrs = valid_attributes
|
291
|
+
@invalid_attrs = {:subject_id => ''}
|
292
|
+
end
|
293
|
+
|
294
|
+
describe "When logged in as Administrator" do
|
295
|
+
login_admin
|
296
|
+
|
297
|
+
describe "with valid params" do
|
298
|
+
it "updates the requested subject_has_classification" do
|
299
|
+
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
300
|
+
end
|
301
|
+
|
302
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
303
|
+
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
304
|
+
assigns(:subject_has_classification).should eq(@subject_has_classification)
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
describe "with invalid params" do
|
309
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
310
|
+
put :update, :id => @subject_has_classification.id, :subject_has_classification => @invalid_attrs
|
311
|
+
response.should render_template("edit")
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
describe "When logged in as Librarian" do
|
317
|
+
login_librarian
|
318
|
+
|
319
|
+
describe "with valid params" do
|
320
|
+
it "updates the requested subject_has_classification" do
|
321
|
+
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
322
|
+
end
|
323
|
+
|
324
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
325
|
+
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
326
|
+
assigns(:subject_has_classification).should eq(@subject_has_classification)
|
327
|
+
response.should redirect_to(@subject_has_classification)
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
describe "with invalid params" do
|
332
|
+
it "assigns the subject_has_classification as @subject_has_classification" do
|
333
|
+
put :update, :id => @subject_has_classification, :subject_has_classification => @invalid_attrs
|
334
|
+
assigns(:subject_has_classification).should_not be_valid
|
335
|
+
end
|
336
|
+
|
337
|
+
it "re-renders the 'edit' template" do
|
338
|
+
put :update, :id => @subject_has_classification, :subject_has_classification => @invalid_attrs
|
339
|
+
response.should render_template("edit")
|
340
|
+
end
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
describe "When logged in as User" do
|
345
|
+
login_user
|
346
|
+
|
347
|
+
describe "with valid params" do
|
348
|
+
it "updates the requested subject_has_classification" do
|
349
|
+
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
350
|
+
end
|
351
|
+
|
352
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
353
|
+
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
354
|
+
assigns(:subject_has_classification).should eq(@subject_has_classification)
|
355
|
+
response.should be_forbidden
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
describe "with invalid params" do
|
360
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
361
|
+
put :update, :id => @subject_has_classification.id, :subject_has_classification => @invalid_attrs
|
362
|
+
response.should be_forbidden
|
363
|
+
end
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
describe "When not logged in" do
|
368
|
+
describe "with valid params" do
|
369
|
+
it "updates the requested subject_has_classification" do
|
370
|
+
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
371
|
+
end
|
372
|
+
|
373
|
+
it "should be forbidden" do
|
374
|
+
put :update, :id => @subject_has_classification.id, :subject_has_classification => @attrs
|
375
|
+
response.should redirect_to(new_user_session_url)
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
describe "with invalid params" do
|
380
|
+
it "assigns the requested subject_has_classification as @subject_has_classification" do
|
381
|
+
put :update, :id => @subject_has_classification.id, :subject_has_classification => @invalid_attrs
|
382
|
+
response.should redirect_to(new_user_session_url)
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
describe "DELETE destroy" do
|
389
|
+
before(:each) do
|
390
|
+
@subject_has_classification = FactoryGirl.create(:subject_has_classification)
|
391
|
+
end
|
392
|
+
|
393
|
+
describe "When logged in as Administrator" do
|
394
|
+
login_admin
|
395
|
+
|
396
|
+
it "destroys the requested subject_has_classification" do
|
397
|
+
delete :destroy, :id => @subject_has_classification.id
|
398
|
+
end
|
399
|
+
|
400
|
+
it "redirects to the subject_has_classifications list" do
|
401
|
+
delete :destroy, :id => @subject_has_classification.id
|
402
|
+
response.should redirect_to(subject_has_classifications_url)
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
describe "When logged in as Librarian" do
|
407
|
+
login_librarian
|
408
|
+
|
409
|
+
it "destroys the requested subject_has_classification" do
|
410
|
+
delete :destroy, :id => @subject_has_classification.id
|
411
|
+
end
|
412
|
+
|
413
|
+
it "should be forbidden" do
|
414
|
+
delete :destroy, :id => @subject_has_classification.id
|
415
|
+
response.should redirect_to(subject_has_classifications_url)
|
416
|
+
end
|
417
|
+
end
|
418
|
+
|
419
|
+
describe "When logged in as User" do
|
420
|
+
login_user
|
421
|
+
|
422
|
+
it "destroys the requested subject_has_classification" do
|
423
|
+
delete :destroy, :id => @subject_has_classification.id
|
424
|
+
end
|
425
|
+
|
426
|
+
it "should be forbidden" do
|
427
|
+
delete :destroy, :id => @subject_has_classification.id
|
428
|
+
response.should be_forbidden
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
describe "When not logged in" do
|
433
|
+
it "destroys the requested subject_has_classification" do
|
434
|
+
delete :destroy, :id => @subject_has_classification.id
|
435
|
+
end
|
436
|
+
|
437
|
+
it "should be forbidden" do
|
438
|
+
delete :destroy, :id => @subject_has_classification.id
|
439
|
+
response.should redirect_to(new_user_session_url)
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
@@ -5,6 +5,10 @@ describe SubjectHeadingTypeHasSubjectsController do
|
|
5
5
|
fixtures :all
|
6
6
|
disconnect_sunspot
|
7
7
|
|
8
|
+
def valid_attributes
|
9
|
+
FactoryGirl.attributes_for(:subject_heading_type_has_subject)
|
10
|
+
end
|
11
|
+
|
8
12
|
describe "GET index" do
|
9
13
|
before(:each) do
|
10
14
|
FactoryGirl.create(:subject_heading_type_has_subject)
|
@@ -169,7 +173,7 @@ describe SubjectHeadingTypeHasSubjectsController do
|
|
169
173
|
|
170
174
|
describe "POST create" do
|
171
175
|
before(:each) do
|
172
|
-
@attrs =
|
176
|
+
@attrs = valid_attributes
|
173
177
|
@invalid_attrs = {:subject_heading_type_id => ''}
|
174
178
|
end
|
175
179
|
|
@@ -287,7 +291,7 @@ describe SubjectHeadingTypeHasSubjectsController do
|
|
287
291
|
describe "PUT update" do
|
288
292
|
before(:each) do
|
289
293
|
@subject_heading_type_has_subject = FactoryGirl.create(:subject_heading_type_has_subject)
|
290
|
-
@attrs =
|
294
|
+
@attrs = valid_attributes
|
291
295
|
@invalid_attrs = {:subject_heading_type_id => ''}
|
292
296
|
end
|
293
297
|
|
@@ -5,6 +5,10 @@ describe SubjectHeadingTypesController do
|
|
5
5
|
fixtures :all
|
6
6
|
disconnect_sunspot
|
7
7
|
|
8
|
+
def valid_attributes
|
9
|
+
FactoryGirl.attributes_for(:subject_heading_type)
|
10
|
+
end
|
11
|
+
|
8
12
|
describe "GET index" do
|
9
13
|
before(:each) do
|
10
14
|
FactoryGirl.create(:subject_heading_type)
|
@@ -167,7 +171,7 @@ describe SubjectHeadingTypesController do
|
|
167
171
|
|
168
172
|
describe "POST create" do
|
169
173
|
before(:each) do
|
170
|
-
@attrs =
|
174
|
+
@attrs = valid_attributes
|
171
175
|
@invalid_attrs = {:name => ''}
|
172
176
|
end
|
173
177
|
|
@@ -285,7 +289,7 @@ describe SubjectHeadingTypesController do
|
|
285
289
|
describe "PUT update" do
|
286
290
|
before(:each) do
|
287
291
|
@subject_heading_type = FactoryGirl.create(:subject_heading_type)
|
288
|
-
@attrs =
|
292
|
+
@attrs = valid_attributes
|
289
293
|
@invalid_attrs = {:name => ''}
|
290
294
|
end
|
291
295
|
|
@@ -303,7 +307,7 @@ describe SubjectHeadingTypesController do
|
|
303
307
|
end
|
304
308
|
|
305
309
|
it "moves its position when specified" do
|
306
|
-
put :update, :id => @subject_heading_type.id, :subject_heading_type => @attrs, :
|
310
|
+
put :update, :id => @subject_heading_type.id, :subject_heading_type => @attrs, :move => 'lower'
|
307
311
|
response.should redirect_to(subject_heading_types_url)
|
308
312
|
end
|
309
313
|
end
|
@@ -5,6 +5,10 @@ describe SubjectTypesController do
|
|
5
5
|
fixtures :all
|
6
6
|
disconnect_sunspot
|
7
7
|
|
8
|
+
def valid_attributes
|
9
|
+
FactoryGirl.attributes_for(:subject_type)
|
10
|
+
end
|
11
|
+
|
8
12
|
describe "GET index" do
|
9
13
|
before(:each) do
|
10
14
|
FactoryGirl.create(:subject_type)
|
@@ -169,7 +173,7 @@ describe SubjectTypesController do
|
|
169
173
|
|
170
174
|
describe "POST create" do
|
171
175
|
before(:each) do
|
172
|
-
@attrs =
|
176
|
+
@attrs = valid_attributes
|
173
177
|
@invalid_attrs = {:name => ''}
|
174
178
|
end
|
175
179
|
|
@@ -287,7 +291,7 @@ describe SubjectTypesController do
|
|
287
291
|
describe "PUT update" do
|
288
292
|
before(:each) do
|
289
293
|
@subject_type = FactoryGirl.create(:subject_type)
|
290
|
-
@attrs =
|
294
|
+
@attrs = valid_attributes
|
291
295
|
@invalid_attrs = {:name => ''}
|
292
296
|
end
|
293
297
|
|
@@ -305,7 +309,7 @@ describe SubjectTypesController do
|
|
305
309
|
end
|
306
310
|
|
307
311
|
it "moves its position when specified" do
|
308
|
-
put :update, :id => @subject_type.id, :subject_type => @attrs, :
|
312
|
+
put :update, :id => @subject_type.id, :subject_type => @attrs, :move => 'lower'
|
309
313
|
response.should redirect_to(subject_types_url)
|
310
314
|
end
|
311
315
|
end
|