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
@@ -6,83 +6,83 @@ describe LanguagesController do
|
|
6
6
|
fixtures :all
|
7
7
|
|
8
8
|
def valid_attributes
|
9
|
-
|
9
|
+
FactoryGirl.attributes_for(:language)
|
10
10
|
end
|
11
11
|
|
12
|
-
describe
|
12
|
+
describe 'GET index' do
|
13
13
|
before(:each) do
|
14
14
|
FactoryGirl.create(:language)
|
15
15
|
end
|
16
16
|
|
17
|
-
describe
|
17
|
+
describe 'When logged in as Administrator' do
|
18
18
|
login_fixture_admin
|
19
19
|
|
20
|
-
it
|
20
|
+
it 'assigns all languages as @languages' do
|
21
21
|
get :index
|
22
22
|
expect(assigns(:languages)).to eq(Language.page(1))
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
describe
|
26
|
+
describe 'When logged in as Librarian' do
|
27
27
|
login_fixture_librarian
|
28
28
|
|
29
|
-
it
|
29
|
+
it 'assigns all languages as @languages' do
|
30
30
|
get :index
|
31
31
|
expect(assigns(:languages)).to eq(Language.page(1))
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
describe
|
35
|
+
describe 'When logged in as User' do
|
36
36
|
login_fixture_user
|
37
37
|
|
38
|
-
it
|
38
|
+
it 'assigns all languages as @languages' do
|
39
39
|
get :index
|
40
40
|
expect(assigns(:languages)).to eq(Language.page(1))
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
describe
|
45
|
-
it
|
44
|
+
describe 'When not logged in' do
|
45
|
+
it 'assigns all languages as @languages' do
|
46
46
|
get :index
|
47
47
|
expect(assigns(:languages)).to eq(Language.page(1))
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
describe
|
52
|
+
describe 'GET show' do
|
53
53
|
before(:each) do
|
54
54
|
@language = FactoryGirl.create(:language)
|
55
55
|
end
|
56
56
|
|
57
|
-
describe
|
57
|
+
describe 'When logged in as Administrator' do
|
58
58
|
login_fixture_admin
|
59
59
|
|
60
|
-
it
|
61
|
-
get :show, :
|
60
|
+
it 'assigns the requested language as @language' do
|
61
|
+
get :show, id: @language.id
|
62
62
|
expect(assigns(:language)).to eq(@language)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
describe
|
67
|
-
it
|
68
|
-
get :show, :
|
66
|
+
describe 'When not logged in' do
|
67
|
+
it 'assigns the requested language as @language' do
|
68
|
+
get :show, id: @language.id
|
69
69
|
expect(assigns(:language)).to eq(@language)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
describe
|
75
|
-
describe
|
74
|
+
describe 'GET new' do
|
75
|
+
describe 'When logged in as Administrator' do
|
76
76
|
login_fixture_admin
|
77
77
|
|
78
|
-
it
|
78
|
+
it 'assigns the requested language as @language' do
|
79
79
|
get :new
|
80
80
|
expect(assigns(:language)).to_not be_valid
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
describe
|
85
|
-
it
|
84
|
+
describe 'When not logged in' do
|
85
|
+
it 'should not assign the requested language as @language' do
|
86
86
|
get :new
|
87
87
|
expect(assigns(:language)).to be_nil
|
88
88
|
response.should redirect_to(new_user_session_url)
|
@@ -90,225 +90,225 @@ describe LanguagesController do
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
describe
|
93
|
+
describe 'GET edit' do
|
94
94
|
before(:each) do
|
95
95
|
@language = FactoryGirl.create(:language)
|
96
96
|
end
|
97
97
|
|
98
|
-
describe
|
98
|
+
describe 'When logged in as Administrator' do
|
99
99
|
login_fixture_admin
|
100
100
|
|
101
|
-
it
|
102
|
-
get :edit, :
|
101
|
+
it 'assigns the requested language as @language' do
|
102
|
+
get :edit, id: @language.id
|
103
103
|
expect(assigns(:language)).to eq(@language)
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
describe
|
108
|
-
it
|
109
|
-
get :edit, :
|
107
|
+
describe 'When not logged in' do
|
108
|
+
it 'should not assign the requested language as @language' do
|
109
|
+
get :edit, id: @language.id
|
110
110
|
response.should redirect_to(new_user_session_url)
|
111
111
|
end
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
-
describe
|
115
|
+
describe 'POST create' do
|
116
116
|
before(:each) do
|
117
117
|
@attrs = valid_attributes
|
118
|
-
@invalid_attrs = {:
|
118
|
+
@invalid_attrs = { name: '' }
|
119
119
|
end
|
120
120
|
|
121
|
-
describe
|
121
|
+
describe 'When logged in as Administrator' do
|
122
122
|
login_fixture_admin
|
123
123
|
|
124
|
-
describe
|
125
|
-
it
|
126
|
-
post :create, :
|
124
|
+
describe 'with valid params' do
|
125
|
+
it 'assigns a newly created language as @language' do
|
126
|
+
post :create, language: @attrs
|
127
127
|
expect(assigns(:language)).to be_valid
|
128
128
|
end
|
129
129
|
|
130
|
-
it
|
131
|
-
post :create, :
|
130
|
+
it 'redirects to the created language' do
|
131
|
+
post :create, language: @attrs
|
132
132
|
response.should redirect_to(assigns(:language))
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
|
-
describe
|
137
|
-
it
|
138
|
-
post :create, :
|
136
|
+
describe 'with invalid params' do
|
137
|
+
it 'assigns a newly created but unsaved language as @language' do
|
138
|
+
post :create, language: @invalid_attrs
|
139
139
|
expect(assigns(:language)).to_not be_valid
|
140
140
|
end
|
141
141
|
|
142
142
|
it "re-renders the 'new' template" do
|
143
|
-
post :create, :
|
144
|
-
response.should render_template(
|
143
|
+
post :create, language: @invalid_attrs
|
144
|
+
response.should render_template('new')
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
-
describe
|
149
|
+
describe 'When logged in as Librarian' do
|
150
150
|
login_fixture_librarian
|
151
151
|
|
152
|
-
describe
|
153
|
-
it
|
154
|
-
post :create, :
|
152
|
+
describe 'with valid params' do
|
153
|
+
it 'assigns a newly created language as @language' do
|
154
|
+
post :create, language: @attrs
|
155
155
|
expect(assigns(:language)).to be_nil
|
156
156
|
end
|
157
157
|
|
158
|
-
it
|
159
|
-
post :create, :
|
158
|
+
it 'should be forbidden' do
|
159
|
+
post :create, language: @attrs
|
160
160
|
response.should be_forbidden
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
-
describe
|
165
|
-
it
|
166
|
-
post :create, :
|
164
|
+
describe 'with invalid params' do
|
165
|
+
it 'assigns a newly created but unsaved language as @language' do
|
166
|
+
post :create, language: @invalid_attrs
|
167
167
|
expect(assigns(:language)).to be_nil
|
168
168
|
end
|
169
169
|
|
170
|
-
it
|
171
|
-
post :create, :
|
170
|
+
it 'should be forbidden' do
|
171
|
+
post :create, language: @invalid_attrs
|
172
172
|
response.should be_forbidden
|
173
173
|
end
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
177
|
-
describe
|
177
|
+
describe 'When logged in as User' do
|
178
178
|
login_fixture_user
|
179
179
|
|
180
|
-
describe
|
181
|
-
it
|
182
|
-
post :create, :
|
180
|
+
describe 'with valid params' do
|
181
|
+
it 'assigns a newly created language as @language' do
|
182
|
+
post :create, language: @attrs
|
183
183
|
expect(assigns(:language)).to be_nil
|
184
184
|
end
|
185
185
|
|
186
|
-
it
|
187
|
-
post :create, :
|
186
|
+
it 'should be forbidden' do
|
187
|
+
post :create, language: @attrs
|
188
188
|
response.should be_forbidden
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
192
|
-
describe
|
193
|
-
it
|
194
|
-
post :create, :
|
192
|
+
describe 'with invalid params' do
|
193
|
+
it 'assigns a newly created but unsaved language as @language' do
|
194
|
+
post :create, language: @invalid_attrs
|
195
195
|
expect(assigns(:language)).to be_nil
|
196
196
|
end
|
197
197
|
|
198
|
-
it
|
199
|
-
post :create, :
|
198
|
+
it 'should be forbidden' do
|
199
|
+
post :create, language: @invalid_attrs
|
200
200
|
response.should be_forbidden
|
201
201
|
end
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
205
|
-
describe
|
206
|
-
describe
|
207
|
-
it
|
208
|
-
post :create, :
|
205
|
+
describe 'When not logged in' do
|
206
|
+
describe 'with valid params' do
|
207
|
+
it 'assigns a newly created language as @language' do
|
208
|
+
post :create, language: @attrs
|
209
209
|
expect(assigns(:language)).to be_nil
|
210
210
|
end
|
211
211
|
|
212
|
-
it
|
213
|
-
post :create, :
|
212
|
+
it 'should be forbidden' do
|
213
|
+
post :create, language: @attrs
|
214
214
|
response.should redirect_to(new_user_session_url)
|
215
215
|
end
|
216
216
|
end
|
217
217
|
|
218
|
-
describe
|
219
|
-
it
|
220
|
-
post :create, :
|
218
|
+
describe 'with invalid params' do
|
219
|
+
it 'assigns a newly created but unsaved language as @language' do
|
220
|
+
post :create, language: @invalid_attrs
|
221
221
|
expect(assigns(:language)).to be_nil
|
222
222
|
end
|
223
223
|
|
224
|
-
it
|
225
|
-
post :create, :
|
224
|
+
it 'should be forbidden' do
|
225
|
+
post :create, language: @invalid_attrs
|
226
226
|
response.should redirect_to(new_user_session_url)
|
227
227
|
end
|
228
228
|
end
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
232
|
-
describe
|
232
|
+
describe 'PUT update' do
|
233
233
|
before(:each) do
|
234
234
|
@language = FactoryGirl.create(:language)
|
235
235
|
@attrs = valid_attributes
|
236
|
-
@invalid_attrs = {:
|
236
|
+
@invalid_attrs = { name: '' }
|
237
237
|
end
|
238
238
|
|
239
|
-
describe
|
239
|
+
describe 'When logged in as Administrator' do
|
240
240
|
login_fixture_admin
|
241
241
|
|
242
|
-
describe
|
243
|
-
it
|
244
|
-
put :update, :
|
242
|
+
describe 'with valid params' do
|
243
|
+
it 'updates the requested language' do
|
244
|
+
put :update, id: @language.id, language: @attrs
|
245
245
|
end
|
246
246
|
|
247
|
-
it
|
248
|
-
put :update, :
|
247
|
+
it 'assigns the requested language as @language' do
|
248
|
+
put :update, id: @language.id, language: @attrs
|
249
249
|
expect(assigns(:language)).to eq(@language)
|
250
250
|
end
|
251
251
|
|
252
|
-
it
|
253
|
-
put :update, :
|
252
|
+
it 'moves its position when specified' do
|
253
|
+
put :update, id: @language.id, language: @attrs, move: 'lower'
|
254
254
|
response.should redirect_to(languages_url)
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
258
|
-
describe
|
259
|
-
it
|
260
|
-
put :update, :
|
261
|
-
response.should render_template(
|
258
|
+
describe 'with invalid params' do
|
259
|
+
it 'assigns the requested language as @language' do
|
260
|
+
put :update, id: @language.id, language: @invalid_attrs
|
261
|
+
response.should render_template('edit')
|
262
262
|
end
|
263
263
|
end
|
264
264
|
end
|
265
265
|
|
266
|
-
describe
|
267
|
-
describe
|
268
|
-
it
|
269
|
-
put :update, :
|
266
|
+
describe 'When not logged in' do
|
267
|
+
describe 'with valid params' do
|
268
|
+
it 'updates the requested language' do
|
269
|
+
put :update, id: @language.id, language: @attrs
|
270
270
|
end
|
271
271
|
|
272
|
-
it
|
273
|
-
put :update, :
|
272
|
+
it 'should be forbidden' do
|
273
|
+
put :update, id: @language.id, language: @attrs
|
274
274
|
response.should redirect_to(new_user_session_url)
|
275
275
|
end
|
276
276
|
end
|
277
277
|
|
278
|
-
describe
|
279
|
-
it
|
280
|
-
put :update, :
|
278
|
+
describe 'with invalid params' do
|
279
|
+
it 'assigns the requested language as @language' do
|
280
|
+
put :update, id: @language.id, language: @invalid_attrs
|
281
281
|
response.should redirect_to(new_user_session_url)
|
282
282
|
end
|
283
283
|
end
|
284
284
|
end
|
285
285
|
end
|
286
286
|
|
287
|
-
describe
|
287
|
+
describe 'DELETE destroy' do
|
288
288
|
before(:each) do
|
289
289
|
@language = FactoryGirl.create(:language)
|
290
290
|
end
|
291
291
|
|
292
|
-
describe
|
292
|
+
describe 'When logged in as Administrator' do
|
293
293
|
login_fixture_admin
|
294
294
|
|
295
|
-
it
|
296
|
-
delete :destroy, :
|
295
|
+
it 'destroys the requested language' do
|
296
|
+
delete :destroy, id: @language.id
|
297
297
|
end
|
298
298
|
|
299
|
-
it
|
300
|
-
delete :destroy, :
|
299
|
+
it 'redirects to the languagees list' do
|
300
|
+
delete :destroy, id: @language.id
|
301
301
|
response.should redirect_to(languages_url)
|
302
302
|
end
|
303
303
|
end
|
304
304
|
|
305
|
-
describe
|
306
|
-
it
|
307
|
-
delete :destroy, :
|
305
|
+
describe 'When not logged in' do
|
306
|
+
it 'destroys the requested language' do
|
307
|
+
delete :destroy, id: @language.id
|
308
308
|
end
|
309
309
|
|
310
|
-
it
|
311
|
-
delete :destroy, :
|
310
|
+
it 'should be forbidden' do
|
311
|
+
delete :destroy, id: @language.id
|
312
312
|
response.should redirect_to(new_user_session_url)
|
313
313
|
end
|
314
314
|
end
|
@@ -29,113 +29,113 @@ describe LicensesController do
|
|
29
29
|
FactoryGirl.attributes_for(:license)
|
30
30
|
end
|
31
31
|
|
32
|
-
describe
|
33
|
-
it
|
32
|
+
describe 'GET index' do
|
33
|
+
it 'assigns all licenses as @licenses' do
|
34
34
|
license = License.create! valid_attributes
|
35
35
|
get :index
|
36
36
|
expect(assigns(:licenses)).to eq(License.order(:position))
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
41
|
-
it
|
40
|
+
describe 'GET show' do
|
41
|
+
it 'assigns the requested license as @license' do
|
42
42
|
license = License.create! valid_attributes
|
43
|
-
get :show, :
|
43
|
+
get :show, id: license.id
|
44
44
|
expect(assigns(:license)).to eq(license)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe
|
49
|
-
it
|
48
|
+
describe 'GET new' do
|
49
|
+
it 'assigns a new license as @license' do
|
50
50
|
get :new
|
51
51
|
expect(assigns(:license)).to be_a_new(License)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
describe
|
56
|
-
it
|
55
|
+
describe 'GET edit' do
|
56
|
+
it 'assigns the requested license as @license' do
|
57
57
|
license = License.create! valid_attributes
|
58
|
-
get :edit, :
|
58
|
+
get :edit, id: license.id
|
59
59
|
expect(assigns(:license)).to eq(license)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
describe
|
64
|
-
describe
|
65
|
-
it
|
66
|
-
expect
|
67
|
-
post :create, :
|
68
|
-
|
63
|
+
describe 'POST create' do
|
64
|
+
describe 'with valid params' do
|
65
|
+
it 'creates a new License' do
|
66
|
+
expect do
|
67
|
+
post :create, license: valid_attributes
|
68
|
+
end.to change(License, :count).by(1)
|
69
69
|
end
|
70
70
|
|
71
|
-
it
|
72
|
-
post :create, :
|
71
|
+
it 'assigns a newly created license as @license' do
|
72
|
+
post :create, license: valid_attributes
|
73
73
|
expect(assigns(:license)).to be_a(License)
|
74
74
|
expect(assigns(:license)).to be_persisted
|
75
75
|
end
|
76
76
|
|
77
|
-
it
|
78
|
-
post :create, :
|
77
|
+
it 'redirects to the created license' do
|
78
|
+
post :create, license: valid_attributes
|
79
79
|
expect(response).to redirect_to(License.last)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
describe
|
84
|
-
it
|
83
|
+
describe 'with invalid params' do
|
84
|
+
it 'assigns a newly created but unsaved license as @license' do
|
85
85
|
# Trigger the behavior that occurs when invalid params are submitted
|
86
86
|
License.any_instance.stub(:save).and_return(false)
|
87
|
-
post :create, :
|
87
|
+
post :create, license: { name: 'test' }
|
88
88
|
expect(assigns(:license)).to be_a_new(License)
|
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
|
License.any_instance.stub(:save).and_return(false)
|
94
|
-
post :create, :
|
95
|
-
#expect(response).to render_template("new")
|
94
|
+
post :create, license: { name: 'test' }
|
95
|
+
# expect(response).to render_template("new")
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
describe
|
101
|
-
describe
|
102
|
-
it
|
100
|
+
describe 'PUT update' do
|
101
|
+
describe 'with valid params' do
|
102
|
+
it 'updates the requested license' do
|
103
103
|
license = License.create! valid_attributes
|
104
104
|
# Assuming there are no other licenses in the database, this
|
105
105
|
# specifies that the License created on the previous line
|
106
106
|
# receives the :update_attributes message with whatever params are
|
107
107
|
# submitted in the request.
|
108
|
-
License.any_instance.should_receive(:update_attributes).with(
|
109
|
-
put :update, :
|
108
|
+
License.any_instance.should_receive(:update_attributes).with('name' => 'test')
|
109
|
+
put :update, id: license.id, license: { 'name' => 'test' }
|
110
110
|
end
|
111
111
|
|
112
|
-
it
|
112
|
+
it 'assigns the requested license as @license' do
|
113
113
|
license = License.create! valid_attributes
|
114
|
-
put :update, :
|
114
|
+
put :update, id: license.id, license: valid_attributes
|
115
115
|
expect(assigns(:license)).to eq(license)
|
116
116
|
end
|
117
117
|
|
118
|
-
it
|
118
|
+
it 'redirects to the license' do
|
119
119
|
license = License.create! valid_attributes
|
120
|
-
put :update, :
|
120
|
+
put :update, id: license.id, license: valid_attributes
|
121
121
|
expect(response).to redirect_to(license)
|
122
122
|
end
|
123
123
|
|
124
|
-
it
|
124
|
+
it 'moves its position when specified' do
|
125
125
|
license = License.create! valid_attributes
|
126
126
|
position = license.position
|
127
|
-
put :update, :
|
127
|
+
put :update, id: license.id, move: 'higher'
|
128
128
|
expect(response).to redirect_to licenses_url
|
129
129
|
assigns(:license).reload.position.should eq position - 1
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
-
describe
|
134
|
-
it
|
133
|
+
describe 'with invalid params' do
|
134
|
+
it 'assigns the license as @license' do
|
135
135
|
license = License.create! valid_attributes
|
136
136
|
# Trigger the behavior that occurs when invalid params are submitted
|
137
137
|
License.any_instance.stub(:save).and_return(false)
|
138
|
-
put :update, :
|
138
|
+
put :update, id: license.id, license: { name: 'test' }
|
139
139
|
expect(assigns(:license)).to eq(license)
|
140
140
|
end
|
141
141
|
|
@@ -143,25 +143,24 @@ describe LicensesController do
|
|
143
143
|
license = License.create! valid_attributes
|
144
144
|
# Trigger the behavior that occurs when invalid params are submitted
|
145
145
|
License.any_instance.stub(:save).and_return(false)
|
146
|
-
put :update, :
|
147
|
-
#expect(response).to render_template("edit")
|
146
|
+
put :update, id: license.id, license: { name: 'test' }
|
147
|
+
# expect(response).to render_template("edit")
|
148
148
|
end
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
152
|
-
describe
|
153
|
-
it
|
152
|
+
describe 'DELETE destroy' do
|
153
|
+
it 'destroys the requested license' do
|
154
154
|
license = License.create! valid_attributes
|
155
|
-
expect
|
156
|
-
delete :destroy, :
|
157
|
-
|
155
|
+
expect do
|
156
|
+
delete :destroy, id: license.id
|
157
|
+
end.to change(License, :count).by(-1)
|
158
158
|
end
|
159
159
|
|
160
|
-
it
|
160
|
+
it 'redirects to the licenses list' do
|
161
161
|
license = License.create! valid_attributes
|
162
|
-
delete :destroy, :
|
162
|
+
delete :destroy, id: license.id
|
163
163
|
expect(response).to redirect_to(licenses_url)
|
164
164
|
end
|
165
165
|
end
|
166
|
-
|
167
166
|
end
|