enju_library 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/enju_library/controller.rb +12 -3
  3. data/app/controllers/libraries_controller.rb +1 -0
  4. data/app/controllers/shelves_controller.rb +2 -1
  5. data/app/models/library.rb +1 -1
  6. data/app/models/library_group.rb +22 -17
  7. data/app/models/shelf.rb +1 -1
  8. data/app/views/libraries/_form.html.erb +1 -0
  9. data/app/views/library_groups/_color_fields.html.erb +0 -1
  10. data/app/views/library_groups/_form.html.erb +1 -4
  11. data/config/locales/translation_en.yml +1 -0
  12. data/config/locales/translation_ja.yml +1 -0
  13. data/config/routes.rb +1 -0
  14. data/lib/enju_library/version.rb +1 -1
  15. data/lib/tasks/enju_library_tasks.rake +2 -2
  16. data/spec/controllers/accepts_controller_spec.rb +96 -96
  17. data/spec/controllers/baskets_controller_spec.rb +126 -126
  18. data/spec/controllers/bookstores_controller_spec.rb +152 -152
  19. data/spec/controllers/budget_types_controller_spec.rb +48 -49
  20. data/spec/controllers/libraries_controller_spec.rb +183 -183
  21. data/spec/controllers/library_groups_controller_spec.rb +47 -47
  22. data/spec/controllers/request_status_types_controller_spec.rb +152 -152
  23. data/spec/controllers/request_types_controller_spec.rb +152 -152
  24. data/spec/controllers/search_engines_controller_spec.rb +152 -152
  25. data/spec/controllers/shelves_controller_spec.rb +152 -152
  26. data/spec/controllers/subscribes_controller_spec.rb +151 -151
  27. data/spec/controllers/subscriptions_controller_spec.rb +152 -152
  28. data/spec/controllers/user_export_files_controller_spec.rb +75 -75
  29. data/spec/controllers/user_groups_controller_spec.rb +108 -108
  30. data/spec/controllers/user_import_files_controller_spec.rb +73 -73
  31. data/spec/controllers/user_import_results_controller_spec.rb +33 -34
  32. data/spec/controllers/withdraws_controller_spec.rb +42 -45
  33. data/spec/fixtures/libraries.yml +1 -1
  34. data/spec/fixtures/library_groups.yml +22 -17
  35. data/spec/fixtures/shelves.yml +1 -1
  36. data/spec/models/library_group_spec.rb +22 -17
  37. data/spec/models/library_spec.rb +1 -1
  38. data/spec/models/shelf_spec.rb +1 -1
  39. data/spec/views/library_groups/edit.html.erb_spec.rb +8 -0
  40. metadata +11 -25
@@ -29,114 +29,114 @@ describe BudgetTypesController do
29
29
  FactoryGirl.attributes_for(:budget_type)
30
30
  end
31
31
 
32
- describe "GET index" do
33
- it "assigns all budget_types as @budget_types" do
32
+ describe 'GET index' do
33
+ it 'assigns all budget_types as @budget_types' do
34
34
  budget_type = BudgetType.create! valid_attributes
35
35
  get :index
36
36
  assigns(:budget_types).should eq(BudgetType.order(:position))
37
37
  end
38
38
  end
39
39
 
40
- describe "GET show" do
41
- it "assigns the requested budget_type as @budget_type" do
40
+ describe 'GET show' do
41
+ it 'assigns the requested budget_type as @budget_type' do
42
42
  budget_type = BudgetType.create! valid_attributes
43
- get :show, :id => budget_type.id
43
+ get :show, id: budget_type.id
44
44
  assigns(:budget_type).should eq(budget_type)
45
45
  end
46
46
  end
47
47
 
48
- describe "GET new" do
49
- it "assigns a new budget_type as @budget_type" do
48
+ describe 'GET new' do
49
+ it 'assigns a new budget_type as @budget_type' do
50
50
  get :new
51
51
  assigns(:budget_type).should be_a_new(BudgetType)
52
52
  end
53
53
  end
54
54
 
55
- describe "GET edit" do
56
- it "assigns the requested budget_type as @budget_type" do
55
+ describe 'GET edit' do
56
+ it 'assigns the requested budget_type as @budget_type' do
57
57
  budget_type = BudgetType.create! valid_attributes
58
- get :edit, :id => budget_type.id
58
+ get :edit, id: budget_type.id
59
59
  assigns(:budget_type).should eq(budget_type)
60
60
  end
61
61
  end
62
62
 
63
- describe "POST create" do
64
- describe "with valid params" do
65
- it "creates a new BudgetType" do
66
- expect {
67
- post :create, :budget_type => valid_attributes
68
- }.to change(BudgetType, :count).by(1)
63
+ describe 'POST create' do
64
+ describe 'with valid params' do
65
+ it 'creates a new BudgetType' do
66
+ expect do
67
+ post :create, budget_type: valid_attributes
68
+ end.to change(BudgetType, :count).by(1)
69
69
  end
70
70
 
71
- it "assigns a newly created budget_type as @budget_type" do
72
- post :create, :budget_type => valid_attributes
71
+ it 'assigns a newly created budget_type as @budget_type' do
72
+ post :create, budget_type: valid_attributes
73
73
  assigns(:budget_type).should be_a(BudgetType)
74
74
  assigns(:budget_type).should be_persisted
75
75
  end
76
76
 
77
- it "redirects to the created budget_type" do
78
- post :create, :budget_type => valid_attributes
77
+ it 'redirects to the created budget_type' do
78
+ post :create, budget_type: valid_attributes
79
79
  response.should redirect_to(BudgetType.last)
80
80
  end
81
81
  end
82
82
 
83
- describe "with invalid params" do
84
- it "assigns a newly created but unsaved budget_type as @budget_type" do
83
+ describe 'with invalid params' do
84
+ it 'assigns a newly created but unsaved budget_type as @budget_type' do
85
85
  # Trigger the behavior that occurs when invalid params are submitted
86
86
  BudgetType.any_instance.stub(:save).and_return(false)
87
- post :create, :budget_type => { note: 'test' }
87
+ post :create, budget_type: { note: 'test' }
88
88
  assigns(:budget_type).should be_a_new(BudgetType)
89
89
  end
90
90
 
91
91
  it "re-renders the 'new' template" do
92
92
  # Trigger the behavior that occurs when invalid params are submitted
93
93
  BudgetType.any_instance.stub(:save).and_return(false)
94
- post :create, :budget_type => { note: 'test' }
95
- #response.should render_template("new")
94
+ post :create, budget_type: { note: 'test' }
95
+ # response.should render_template("new")
96
96
  end
97
97
  end
98
98
  end
99
99
 
100
- describe "PUT update" do
101
- describe "with valid params" do
102
- it "updates the requested budget_type" do
100
+ describe 'PUT update' do
101
+ describe 'with valid params' do
102
+ it 'updates the requested budget_type' do
103
103
  budget_type = BudgetType.create! valid_attributes
104
104
  # Assuming there are no other budget_types in the database, this
105
105
  # specifies that the BudgetType created on the previous line
106
106
  # receives the :update_attributes message with whatever params are
107
107
  # submitted in the request.
108
- BudgetType.any_instance.should_receive(:update_attributes).with({'note' => 'test'})
109
- put :update, :id => budget_type.id, :budget_type => { note: 'test'}
108
+ BudgetType.any_instance.should_receive(:update_attributes).with('note' => 'test')
109
+ put :update, id: budget_type.id, budget_type: { note: 'test' }
110
110
  end
111
111
 
112
- it "assigns the requested budget_type as @budget_type" do
112
+ it 'assigns the requested budget_type as @budget_type' do
113
113
  budget_type = BudgetType.create! valid_attributes
114
- put :update, :id => budget_type.id, :budget_type => valid_attributes
114
+ put :update, id: budget_type.id, budget_type: valid_attributes
115
115
  assigns(:budget_type).should eq(budget_type)
116
116
  end
117
117
 
118
- it "redirects to the budget_type" do
118
+ it 'redirects to the budget_type' do
119
119
  budget_type = BudgetType.create! valid_attributes
120
- put :update, :id => budget_type.id, :budget_type => valid_attributes
120
+ put :update, id: budget_type.id, budget_type: valid_attributes
121
121
  response.should redirect_to(budget_type)
122
122
  end
123
123
 
124
- it "moves its position when specified" do
124
+ it 'moves its position when specified' do
125
125
  budget_type = BudgetType.create! valid_attributes
126
126
  position = budget_type.position
127
- put :update, :id => budget_type.id, :move => 'higher'
127
+ put :update, id: budget_type.id, move: 'higher'
128
128
  response.should redirect_to budget_types_url
129
129
  budget_type.reload
130
130
  budget_type.position.should eq position - 1
131
131
  end
132
132
  end
133
133
 
134
- describe "with invalid params" do
135
- it "assigns the budget_type as @budget_type" do
134
+ describe 'with invalid params' do
135
+ it 'assigns the budget_type as @budget_type' do
136
136
  budget_type = BudgetType.create! valid_attributes
137
137
  # Trigger the behavior that occurs when invalid params are submitted
138
138
  BudgetType.any_instance.stub(:save).and_return(false)
139
- put :update, :id => budget_type.id, :budget_type => { note: 'test' }
139
+ put :update, id: budget_type.id, budget_type: { note: 'test' }
140
140
  assigns(:budget_type).should eq(budget_type)
141
141
  end
142
142
 
@@ -144,25 +144,24 @@ describe BudgetTypesController do
144
144
  budget_type = BudgetType.create! valid_attributes
145
145
  # Trigger the behavior that occurs when invalid params are submitted
146
146
  BudgetType.any_instance.stub(:save).and_return(false)
147
- put :update, :id => budget_type.id, :budget_type => { note: 'test' }
148
- #response.should render_template("edit")
147
+ put :update, id: budget_type.id, budget_type: { note: 'test' }
148
+ # response.should render_template("edit")
149
149
  end
150
150
  end
151
151
  end
152
152
 
153
- describe "DELETE destroy" do
154
- it "destroys the requested budget_type" do
153
+ describe 'DELETE destroy' do
154
+ it 'destroys the requested budget_type' do
155
155
  budget_type = BudgetType.create! valid_attributes
156
- expect {
157
- delete :destroy, :id => budget_type.id
158
- }.to change(BudgetType, :count).by(-1)
156
+ expect do
157
+ delete :destroy, id: budget_type.id
158
+ end.to change(BudgetType, :count).by(-1)
159
159
  end
160
160
 
161
- it "redirects to the budget_types list" do
161
+ it 'redirects to the budget_types list' do
162
162
  budget_type = BudgetType.create! valid_attributes
163
- delete :destroy, :id => budget_type.id
163
+ delete :destroy, id: budget_type.id
164
164
  response.should redirect_to(budget_types_url)
165
165
  end
166
166
  end
167
-
168
167
  end
@@ -3,119 +3,119 @@ require 'rails_helper'
3
3
  describe LibrariesController do
4
4
  fixtures :all
5
5
 
6
- describe "GET index", :solr => true do
6
+ describe 'GET index', solr: true do
7
7
  before do
8
8
  Library.reindex
9
9
  end
10
10
 
11
- describe "When logged in as Administrator" do
11
+ describe 'When logged in as Administrator' do
12
12
  login_fixture_admin
13
13
 
14
- it "assigns all libraries as @libraries" do
14
+ it 'assigns all libraries as @libraries' do
15
15
  get :index
16
16
  assigns(:libraries).should_not be_empty
17
17
  end
18
18
  end
19
19
 
20
- describe "When logged in as Librarian" do
20
+ describe 'When logged in as Librarian' do
21
21
  login_fixture_librarian
22
22
 
23
- it "assigns all libraries as @libraries" do
23
+ it 'assigns all libraries as @libraries' do
24
24
  get :index
25
25
  assigns(:libraries).should_not be_empty
26
26
  end
27
27
  end
28
28
 
29
- describe "When logged in as User" do
29
+ describe 'When logged in as User' do
30
30
  login_fixture_user
31
31
 
32
- it "assigns all libraries as @libraries" do
32
+ it 'assigns all libraries as @libraries' do
33
33
  get :index
34
34
  assigns(:libraries).should_not be_empty
35
35
  end
36
36
  end
37
37
 
38
- describe "When not logged in" do
39
- it "assigns all libraries as @libraries" do
38
+ describe 'When not logged in' do
39
+ it 'assigns all libraries as @libraries' do
40
40
  get :index
41
41
  assigns(:libraries).should_not be_empty
42
42
  end
43
43
 
44
- it "should get index with query" do
45
- get :index, :query => 'kamata'
44
+ it 'should get index with query' do
45
+ get :index, query: 'kamata'
46
46
  response.should be_success
47
47
  assigns(:libraries).include?(Library.friendly.find('kamata')).should be_truthy
48
48
  end
49
49
  end
50
50
  end
51
51
 
52
- describe "GET show", :solr => true do
53
- describe "When logged in as Administrator" do
52
+ describe 'GET show', solr: true do
53
+ describe 'When logged in as Administrator' do
54
54
  login_fixture_admin
55
55
 
56
- it "assigns the requested library as @library" do
57
- get :show, :id => 1
56
+ it 'assigns the requested library as @library' do
57
+ get :show, id: 1
58
58
  assigns(:library).should eq(libraries(:library_00001))
59
59
  end
60
60
  end
61
61
 
62
- describe "When logged in as Librarian" do
62
+ describe 'When logged in as Librarian' do
63
63
  login_fixture_librarian
64
64
 
65
- it "assigns the requested library as @library" do
66
- get :show, :id => 1
65
+ it 'assigns the requested library as @library' do
66
+ get :show, id: 1
67
67
  assigns(:library).should eq(libraries(:library_00001))
68
68
  end
69
69
  end
70
70
 
71
- describe "When logged in as User" do
71
+ describe 'When logged in as User' do
72
72
  login_fixture_user
73
73
 
74
- it "assigns the requested library as @library" do
75
- get :show, :id => 1
74
+ it 'assigns the requested library as @library' do
75
+ get :show, id: 1
76
76
  assigns(:library).should eq(libraries(:library_00001))
77
77
  end
78
78
  end
79
79
 
80
- describe "When not logged in" do
81
- it "assigns the requested library as @library" do
82
- get :show, :id => 1
80
+ describe 'When not logged in' do
81
+ it 'assigns the requested library as @library' do
82
+ get :show, id: 1
83
83
  assigns(:library).should eq(libraries(:library_00001))
84
84
  end
85
85
  end
86
86
  end
87
87
 
88
- describe "GET new" do
89
- describe "When logged in as Administrator" do
88
+ describe 'GET new' do
89
+ describe 'When logged in as Administrator' do
90
90
  login_fixture_admin
91
91
 
92
- it "assigns the requested library as @library" do
92
+ it 'assigns the requested library as @library' do
93
93
  get :new
94
94
  assigns(:library).should_not be_valid
95
95
  end
96
96
  end
97
97
 
98
- describe "When logged in as Librarian" do
98
+ describe 'When logged in as Librarian' do
99
99
  login_fixture_librarian
100
100
 
101
- it "assigns the requested library as @library" do
101
+ it 'assigns the requested library as @library' do
102
102
  get :new
103
103
  assigns(:library).should be_nil
104
104
  end
105
105
  end
106
106
 
107
- describe "When logged in as User" do
107
+ describe 'When logged in as User' do
108
108
  login_fixture_user
109
109
 
110
- it "should not assign the requested library as @library" do
110
+ it 'should not assign the requested library as @library' do
111
111
  get :new
112
112
  assigns(:library).should be_nil
113
113
  response.should be_forbidden
114
114
  end
115
115
  end
116
116
 
117
- describe "When not logged in" do
118
- it "should not assign the requested library as @library" do
117
+ describe 'When not logged in' do
118
+ it 'should not assign the requested library as @library' do
119
119
  get :new
120
120
  assigns(:library).should be_nil
121
121
  response.should redirect_to(new_user_session_url)
@@ -123,386 +123,386 @@ describe LibrariesController do
123
123
  end
124
124
  end
125
125
 
126
- describe "GET edit" do
127
- describe "When logged in as Administrator" do
126
+ describe 'GET edit' do
127
+ describe 'When logged in as Administrator' do
128
128
  login_fixture_admin
129
129
 
130
- it "assigns the requested library as @library" do
130
+ it 'assigns the requested library as @library' do
131
131
  library = FactoryGirl.create(:library)
132
- get :edit, :id => library.id
132
+ get :edit, id: library.id
133
133
  assigns(:library).should eq(library)
134
134
  end
135
135
  end
136
136
 
137
- describe "When logged in as Librarian" do
137
+ describe 'When logged in as Librarian' do
138
138
  login_fixture_librarian
139
139
 
140
- it "assigns the requested library as @library" do
140
+ it 'assigns the requested library as @library' do
141
141
  library = FactoryGirl.create(:library)
142
- get :edit, :id => library.id
142
+ get :edit, id: library.id
143
143
  response.should be_forbidden
144
144
  end
145
145
  end
146
146
 
147
- describe "When logged in as User" do
147
+ describe 'When logged in as User' do
148
148
  login_fixture_user
149
149
 
150
- it "assigns the requested library as @library" do
150
+ it 'assigns the requested library as @library' do
151
151
  library = FactoryGirl.create(:library)
152
- get :edit, :id => library.id
152
+ get :edit, id: library.id
153
153
  response.should be_forbidden
154
154
  end
155
155
  end
156
156
 
157
- describe "When not logged in" do
158
- it "should not assign the requested library as @library" do
157
+ describe 'When not logged in' do
158
+ it 'should not assign the requested library as @library' do
159
159
  library = FactoryGirl.create(:library)
160
- get :edit, :id => library.id
160
+ get :edit, id: library.id
161
161
  response.should redirect_to(new_user_session_url)
162
162
  end
163
163
  end
164
164
  end
165
165
 
166
- describe "POST create" do
166
+ describe 'POST create' do
167
167
  before(:each) do
168
168
  @attrs = FactoryGirl.attributes_for(:library)
169
- @invalid_attrs = {:name => ''}
169
+ @invalid_attrs = { name: '' }
170
170
  end
171
171
 
172
- describe "When logged in as Administrator" do
172
+ describe 'When logged in as Administrator' do
173
173
  login_fixture_admin
174
174
 
175
- describe "with valid params" do
176
- it "assigns a newly created library as @library" do
177
- post :create, :library => @attrs
175
+ describe 'with valid params' do
176
+ it 'assigns a newly created library as @library' do
177
+ post :create, library: @attrs
178
178
  assigns(:library).should be_valid
179
179
  end
180
180
 
181
- it "redirects to the created patron" do
182
- post :create, :library => @attrs
181
+ it 'redirects to the created patron' do
182
+ post :create, library: @attrs
183
183
  response.should redirect_to(assigns(:library))
184
184
  end
185
185
  end
186
186
 
187
- describe "with invalid params" do
188
- it "assigns a newly created but unsaved library as @library" do
189
- post :create, :library => @invalid_attrs
187
+ describe 'with invalid params' do
188
+ it 'assigns a newly created but unsaved library as @library' do
189
+ post :create, library: @invalid_attrs
190
190
  assigns(:library).should_not be_valid
191
191
  end
192
192
 
193
- it "should be successful" do
194
- post :create, :library => @invalid_attrs
193
+ it 'should be successful' do
194
+ post :create, library: @invalid_attrs
195
195
  response.should be_success
196
196
  end
197
197
 
198
- it "should not create library without short_display_name" do
199
- post :create, :library => { :name => 'fujisawa', :short_display_name => '' }
198
+ it 'should not create library without short_display_name' do
199
+ post :create, library: { name: 'fujisawa', short_display_name: '' }
200
200
  response.should be_success
201
201
  end
202
202
  end
203
203
  end
204
204
 
205
- describe "When logged in as Librarian" do
205
+ describe 'When logged in as Librarian' do
206
206
  login_fixture_librarian
207
207
 
208
- describe "with valid params" do
209
- it "assigns a newly created library as @library" do
210
- post :create, :library => @attrs
208
+ describe 'with valid params' do
209
+ it 'assigns a newly created library as @library' do
210
+ post :create, library: @attrs
211
211
  assigns(:library).should be_nil
212
212
  end
213
213
 
214
- it "should be forbidden" do
215
- post :create, :library => @attrs
214
+ it 'should be forbidden' do
215
+ post :create, library: @attrs
216
216
  response.should be_forbidden
217
217
  end
218
218
  end
219
219
 
220
- describe "with invalid params" do
221
- it "assigns a newly created but unsaved library as @library" do
222
- post :create, :library => @invalid_attrs
220
+ describe 'with invalid params' do
221
+ it 'assigns a newly created but unsaved library as @library' do
222
+ post :create, library: @invalid_attrs
223
223
  assigns(:library).should be_nil
224
224
  end
225
225
 
226
- it "should be forbidden" do
227
- post :create, :library => @invalid_attrs
226
+ it 'should be forbidden' do
227
+ post :create, library: @invalid_attrs
228
228
  response.should be_forbidden
229
229
  end
230
230
  end
231
231
  end
232
232
 
233
- describe "When logged in as User" do
233
+ describe 'When logged in as User' do
234
234
  login_fixture_user
235
235
 
236
- describe "with valid params" do
237
- it "assigns a newly created library as @library" do
238
- post :create, :library => @attrs
236
+ describe 'with valid params' do
237
+ it 'assigns a newly created library as @library' do
238
+ post :create, library: @attrs
239
239
  assigns(:library).should be_nil
240
240
  end
241
241
 
242
- it "should be forbidden" do
243
- post :create, :library => @attrs
242
+ it 'should be forbidden' do
243
+ post :create, library: @attrs
244
244
  response.should be_forbidden
245
245
  end
246
246
  end
247
247
 
248
- describe "with invalid params" do
249
- it "assigns a newly created but unsaved library as @library" do
250
- post :create, :library => @invalid_attrs
248
+ describe 'with invalid params' do
249
+ it 'assigns a newly created but unsaved library as @library' do
250
+ post :create, library: @invalid_attrs
251
251
  assigns(:library).should be_nil
252
252
  end
253
253
 
254
- it "should be forbidden" do
255
- post :create, :library => @invalid_attrs
254
+ it 'should be forbidden' do
255
+ post :create, library: @invalid_attrs
256
256
  response.should be_forbidden
257
257
  end
258
258
  end
259
259
  end
260
260
 
261
- describe "When not logged in" do
262
- describe "with valid params" do
263
- it "assigns a newly created library as @library" do
264
- post :create, :library => @attrs
261
+ describe 'When not logged in' do
262
+ describe 'with valid params' do
263
+ it 'assigns a newly created library as @library' do
264
+ post :create, library: @attrs
265
265
  assigns(:library).should be_nil
266
266
  end
267
267
 
268
- it "should be redirected to new session url" do
269
- post :create, :library => @attrs
268
+ it 'should be redirected to new session url' do
269
+ post :create, library: @attrs
270
270
  response.should redirect_to(new_user_session_url)
271
271
  end
272
272
  end
273
273
 
274
- describe "with invalid params" do
275
- it "assigns a newly created but unsaved library as @library" do
276
- post :create, :library => @invalid_attrs
274
+ describe 'with invalid params' do
275
+ it 'assigns a newly created but unsaved library as @library' do
276
+ post :create, library: @invalid_attrs
277
277
  assigns(:library).should be_nil
278
278
  end
279
279
 
280
- it "should be redirected to new session url" do
281
- post :create, :library => @invalid_attrs
280
+ it 'should be redirected to new session url' do
281
+ post :create, library: @invalid_attrs
282
282
  response.should redirect_to(new_user_session_url)
283
283
  end
284
284
  end
285
285
  end
286
286
  end
287
287
 
288
- describe "PUT update" do
288
+ describe 'PUT update' do
289
289
  before(:each) do
290
290
  @library = libraries(:library_00001)
291
- @attrs = {:name => 'example'}
292
- @invalid_attrs = {:name => ''}
291
+ @attrs = { name: 'example' }
292
+ @invalid_attrs = { name: '' }
293
293
  end
294
294
 
295
- describe "When logged in as Administrator" do
295
+ describe 'When logged in as Administrator' do
296
296
  login_fixture_admin
297
297
 
298
- describe "with valid params" do
299
- it "updates the requested library" do
300
- put :update, :id => @library.id, :library => @attrs
298
+ describe 'with valid params' do
299
+ it 'updates the requested library' do
300
+ put :update, id: @library.id, library: @attrs
301
301
  end
302
302
 
303
- it "assigns the requested library as @library" do
304
- put :update, :id => @library.id, :library => @attrs
303
+ it 'assigns the requested library as @library' do
304
+ put :update, id: @library.id, library: @attrs
305
305
  assigns(:library).should eq(@library)
306
306
  end
307
307
 
308
- it "moves its position when specified" do
309
- put :update, :id => @library.id, :library => @attrs, :move => 'lower'
308
+ it 'moves its position when specified' do
309
+ put :update, id: @library.id, library: @attrs, move: 'lower'
310
310
  response.should redirect_to(libraries_url)
311
311
  end
312
312
  end
313
313
 
314
- describe "with invalid params" do
315
- it "assigns the requested library as @library" do
316
- put :update, :id => @library.id, :library => @invalid_attrs
317
- response.should render_template("edit")
314
+ describe 'with invalid params' do
315
+ it 'assigns the requested library as @library' do
316
+ put :update, id: @library.id, library: @invalid_attrs
317
+ response.should render_template('edit')
318
318
  end
319
319
  end
320
320
  end
321
321
 
322
- describe "When logged in as Librarian" do
322
+ describe 'When logged in as Librarian' do
323
323
  login_fixture_librarian
324
324
 
325
- describe "with valid params" do
326
- it "updates the requested library" do
327
- put :update, :id => @library.id, :library => @attrs
325
+ describe 'with valid params' do
326
+ it 'updates the requested library' do
327
+ put :update, id: @library.id, library: @attrs
328
328
  end
329
329
 
330
- it "should be forbidden" do
331
- put :update, :id => @library.id, :library => @attrs
330
+ it 'should be forbidden' do
331
+ put :update, id: @library.id, library: @attrs
332
332
  response.should be_forbidden
333
333
  end
334
334
  end
335
335
 
336
- describe "with invalid params" do
337
- it "should be forbidden" do
338
- put :update, :id => @library.id, :library => @invalid_attrs
336
+ describe 'with invalid params' do
337
+ it 'should be forbidden' do
338
+ put :update, id: @library.id, library: @invalid_attrs
339
339
  response.should be_forbidden
340
340
  end
341
341
  end
342
342
  end
343
343
 
344
- describe "When logged in as User" do
344
+ describe 'When logged in as User' do
345
345
  login_fixture_user
346
346
 
347
- describe "with valid params" do
348
- it "updates the requested library" do
349
- put :update, :id => @library.id, :library => @attrs
347
+ describe 'with valid params' do
348
+ it 'updates the requested library' do
349
+ put :update, id: @library.id, library: @attrs
350
350
  end
351
351
 
352
- it "should be forbidden" do
353
- put :update, :id => @library.id, :library => @attrs
352
+ it 'should be forbidden' do
353
+ put :update, id: @library.id, library: @attrs
354
354
  response.should be_forbidden
355
355
  end
356
356
  end
357
357
 
358
- describe "with invalid params" do
359
- it "should be forbidden" do
360
- put :update, :id => @library.id, :library => @invalid_attrs
358
+ describe 'with invalid params' do
359
+ it 'should be forbidden' do
360
+ put :update, id: @library.id, library: @invalid_attrs
361
361
  response.should be_forbidden
362
362
  end
363
363
  end
364
364
  end
365
365
 
366
- describe "When not logged in" do
367
- describe "with valid params" do
368
- it "updates the requested library" do
369
- put :update, :id => @library.id, :library => @attrs
366
+ describe 'When not logged in' do
367
+ describe 'with valid params' do
368
+ it 'updates the requested library' do
369
+ put :update, id: @library.id, library: @attrs
370
370
  end
371
371
 
372
- it "should be forbidden" do
373
- put :update, :id => @library.id, :library => @attrs
372
+ it 'should be forbidden' do
373
+ put :update, id: @library.id, library: @attrs
374
374
  response.should redirect_to(new_user_session_url)
375
375
  end
376
376
  end
377
377
 
378
- describe "with invalid params" do
379
- it "assigns the requested library as @library" do
380
- put :update, :id => @library.id, :library => @invalid_attrs
378
+ describe 'with invalid params' do
379
+ it 'assigns the requested library as @library' do
380
+ put :update, id: @library.id, library: @invalid_attrs
381
381
  response.should redirect_to(new_user_session_url)
382
382
  end
383
383
  end
384
384
  end
385
385
  end
386
386
 
387
- describe "DELETE destroy" do
388
- describe "Web" do
387
+ describe 'DELETE destroy' do
388
+ describe 'Web' do
389
389
  before(:each) do
390
390
  @library = libraries(:library_00001)
391
391
  end
392
392
 
393
- describe "When logged in as Administrator" do
393
+ describe 'When logged in as Administrator' do
394
394
  login_fixture_admin
395
395
 
396
- it "destroys the requested library" do
397
- delete :destroy, :id => @library.id
396
+ it 'destroys the requested library' do
397
+ delete :destroy, id: @library.id
398
398
  end
399
399
 
400
- it "should be forbidden" do
401
- delete :destroy, :id => @library.id
400
+ it 'should be forbidden' do
401
+ delete :destroy, id: @library.id
402
402
  response.should be_forbidden
403
403
  end
404
404
 
405
- it "should not destroy library_id 1" do
406
- delete :destroy, :id => 'web'
405
+ it 'should not destroy library_id 1' do
406
+ delete :destroy, id: 'web'
407
407
  response.should be_forbidden
408
408
  end
409
409
 
410
- it "should not destroy library that contains shelves" do
411
- delete :destroy, :id => 'kamata'
410
+ it 'should not destroy library that contains shelves' do
411
+ delete :destroy, id: 'kamata'
412
412
  response.should be_forbidden
413
413
  end
414
414
  end
415
415
 
416
- describe "When logged in as Librarian" do
416
+ describe 'When logged in as Librarian' do
417
417
  login_fixture_librarian
418
418
 
419
- it "destroys the requested library" do
420
- delete :destroy, :id => @library.id
419
+ it 'destroys the requested library' do
420
+ delete :destroy, id: @library.id
421
421
  end
422
422
 
423
- it "should be forbidden" do
424
- delete :destroy, :id => @library.id
423
+ it 'should be forbidden' do
424
+ delete :destroy, id: @library.id
425
425
  response.should be_forbidden
426
426
  end
427
427
  end
428
428
 
429
- describe "When logged in as User" do
429
+ describe 'When logged in as User' do
430
430
  login_fixture_user
431
431
 
432
- it "destroys the requested library" do
433
- delete :destroy, :id => @library.id
432
+ it 'destroys the requested library' do
433
+ delete :destroy, id: @library.id
434
434
  end
435
435
 
436
- it "should be forbidden" do
437
- delete :destroy, :id => @library.id
436
+ it 'should be forbidden' do
437
+ delete :destroy, id: @library.id
438
438
  response.should be_forbidden
439
439
  end
440
440
  end
441
441
 
442
- describe "When not logged in" do
443
- it "destroys the requested library" do
444
- delete :destroy, :id => @library.id
442
+ describe 'When not logged in' do
443
+ it 'destroys the requested library' do
444
+ delete :destroy, id: @library.id
445
445
  end
446
446
 
447
- it "should be forbidden" do
448
- delete :destroy, :id => @library.id
447
+ it 'should be forbidden' do
448
+ delete :destroy, id: @library.id
449
449
  response.should redirect_to(new_user_session_url)
450
450
  end
451
451
  end
452
452
  end
453
453
 
454
- describe "Library" do
454
+ describe 'Library' do
455
455
  before(:each) do
456
456
  @library = FactoryGirl.create(:library)
457
457
  @library.shelves.first.destroy
458
458
  end
459
459
 
460
- describe "When logged in as Administrator" do
460
+ describe 'When logged in as Administrator' do
461
461
  login_fixture_admin
462
462
 
463
- it "destroys the requested library" do
464
- delete :destroy, :id => @library.id
463
+ it 'destroys the requested library' do
464
+ delete :destroy, id: @library.id
465
465
  end
466
466
 
467
- it "redirects to the libraries list" do
468
- delete :destroy, :id => @library.id
467
+ it 'redirects to the libraries list' do
468
+ delete :destroy, id: @library.id
469
469
  response.should redirect_to(libraries_url)
470
470
  end
471
471
  end
472
472
 
473
- describe "When logged in as Librarian" do
473
+ describe 'When logged in as Librarian' do
474
474
  login_fixture_librarian
475
475
 
476
- it "destroys the requested library" do
477
- delete :destroy, :id => @library.id
476
+ it 'destroys the requested library' do
477
+ delete :destroy, id: @library.id
478
478
  end
479
479
 
480
- it "should be forbidden" do
481
- delete :destroy, :id => @library.id
480
+ it 'should be forbidden' do
481
+ delete :destroy, id: @library.id
482
482
  response.should be_forbidden
483
483
  end
484
484
  end
485
485
 
486
- describe "When logged in as User" do
486
+ describe 'When logged in as User' do
487
487
  login_fixture_user
488
488
 
489
- it "destroys the requested library" do
490
- delete :destroy, :id => @library.id
489
+ it 'destroys the requested library' do
490
+ delete :destroy, id: @library.id
491
491
  end
492
492
 
493
- it "should be forbidden" do
494
- delete :destroy, :id => @library.id
493
+ it 'should be forbidden' do
494
+ delete :destroy, id: @library.id
495
495
  response.should be_forbidden
496
496
  end
497
497
  end
498
498
 
499
- describe "When not logged in" do
500
- it "destroys the requested library" do
501
- delete :destroy, :id => @library.id
499
+ describe 'When not logged in' do
500
+ it 'destroys the requested library' do
501
+ delete :destroy, id: @library.id
502
502
  end
503
503
 
504
- it "should be forbidden" do
505
- delete :destroy, :id => @library.id
504
+ it 'should be forbidden' do
505
+ delete :destroy, id: @library.id
506
506
  response.should redirect_to(new_user_session_url)
507
507
  end
508
508
  end