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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/icons/book.png +0 -0
  3. data/app/assets/images/icons/cd.png +0 -0
  4. data/app/assets/images/icons/dvd.png +0 -0
  5. data/app/assets/images/icons/monitor.png +0 -0
  6. data/app/controllers/carrier_types_controller.rb +8 -3
  7. data/app/controllers/manifestations_controller.rb +17 -4
  8. data/app/controllers/picture_files_controller.rb +1 -1
  9. data/app/controllers/series_statements_controller.rb +6 -0
  10. data/app/helpers/manifestations_helper.rb +1 -1
  11. data/app/models/agent_import_file_transition.rb +1 -0
  12. data/app/models/carrier_type.rb +11 -7
  13. data/app/models/import_request_transition.rb +1 -0
  14. data/app/models/manifestation.rb +5 -0
  15. data/app/models/resource_export_file_transition.rb +1 -0
  16. data/app/models/resource_import_file_transition.rb +1 -0
  17. data/app/views/carrier_types/index.html.erb +4 -1
  18. data/app/views/manifestations/_show_detail_librarian.html.erb +4 -0
  19. data/app/views/manifestations/index.html.erb +3 -0
  20. data/config/locales/translation_en.yml +2 -0
  21. data/config/locales/translation_ja.yml +2 -0
  22. data/lib/enju_biblio/biblio_helper.rb +1 -12
  23. data/lib/enju_biblio/version.rb +1 -1
  24. data/lib/generators/enju_biblio/setup/templates/config/schedule.rb +3 -3
  25. data/lib/tasks/carrier_type.rb +30 -18
  26. data/lib/tasks/enju_biblio_tasks.rake +2 -0
  27. data/spec/controllers/agent_import_files_controller_spec.rb +87 -87
  28. data/spec/controllers/agent_import_results_controller_spec.rb +22 -22
  29. data/spec/controllers/agent_merge_lists_controller_spec.rb +157 -157
  30. data/spec/controllers/agent_merges_controller_spec.rb +151 -151
  31. data/spec/controllers/agent_relationship_types_controller_spec.rb +152 -152
  32. data/spec/controllers/agent_relationships_controller_spec.rb +153 -153
  33. data/spec/controllers/agent_types_controller_spec.rb +49 -50
  34. data/spec/controllers/agents_controller_spec.rb +234 -234
  35. data/spec/controllers/carrier_types_controller_spec.rb +123 -103
  36. data/spec/controllers/content_types_controller_spec.rb +51 -52
  37. data/spec/controllers/countries_controller_spec.rb +156 -156
  38. data/spec/controllers/create_types_controller_spec.rb +48 -49
  39. data/spec/controllers/creates_controller_spec.rb +154 -154
  40. data/spec/controllers/donates_controller_spec.rb +153 -153
  41. data/spec/controllers/form_of_works_controller_spec.rb +48 -49
  42. data/spec/controllers/frequencies_controller_spec.rb +51 -52
  43. data/spec/controllers/identifier_types_controller_spec.rb +48 -49
  44. data/spec/controllers/import_requests_controller_spec.rb +165 -164
  45. data/spec/controllers/items_controller_spec.rb +214 -216
  46. data/spec/controllers/languages_controller_spec.rb +109 -109
  47. data/spec/controllers/licenses_controller_spec.rb +48 -49
  48. data/spec/controllers/manifestation_relationship_types_controller_spec.rb +152 -152
  49. data/spec/controllers/manifestation_relationships_controller_spec.rb +153 -153
  50. data/spec/controllers/manifestations_controller_spec.rb +319 -289
  51. data/spec/controllers/medium_of_performances_controller_spec.rb +48 -49
  52. data/spec/controllers/owns_controller_spec.rb +153 -153
  53. data/spec/controllers/picture_files_controller_spec.rb +156 -156
  54. data/spec/controllers/produce_types_controller_spec.rb +48 -49
  55. data/spec/controllers/produces_controller_spec.rb +154 -154
  56. data/spec/controllers/realize_types_controller_spec.rb +48 -49
  57. data/spec/controllers/realizes_controller_spec.rb +155 -155
  58. data/spec/controllers/resource_export_files_controller_spec.rb +72 -72
  59. data/spec/controllers/resource_import_files_controller_spec.rb +90 -90
  60. data/spec/controllers/resource_import_results_controller_spec.rb +43 -43
  61. data/spec/controllers/series_statement_merge_lists_controller_spec.rb +153 -153
  62. data/spec/controllers/series_statement_merges_controller_spec.rb +151 -151
  63. data/spec/controllers/series_statements_controller_spec.rb +154 -154
  64. data/spec/factories/checkout.rb +9 -0
  65. data/spec/factories/library.rb +13 -0
  66. data/spec/factories/shelf.rb +6 -0
  67. data/spec/fixtures/carrier_types.yml +11 -7
  68. data/spec/models/carrier_type_spec.rb +11 -7
  69. data/spec/models/resource_export_file_spec.rb +58 -16
  70. data/spec/support/resque.rb +0 -1
  71. data/spec/views/manifestations/show.html.erb_spec.rb +5 -0
  72. data/spec/views/resource_import_files/index.html.erb_spec.rb +1 -1
  73. data/spec/views/resource_import_files/show.html.erb_spec.rb +1 -1
  74. data/spec/views/resource_import_results/index.html.erb_spec.rb +1 -1
  75. data/spec/views/resource_import_results/show.html.erb_spec.rb +1 -1
  76. metadata +49 -39
@@ -29,113 +29,113 @@ describe CreateTypesController do
29
29
  FactoryGirl.attributes_for(:create_type)
30
30
  end
31
31
 
32
- describe "GET index" do
33
- it "assigns all create_types as @create_types" do
32
+ describe 'GET index' do
33
+ it 'assigns all create_types as @create_types' do
34
34
  create_type = CreateType.create! valid_attributes
35
35
  get :index
36
36
  expect(assigns(:create_types)).to eq(CreateType.order(:position))
37
37
  end
38
38
  end
39
39
 
40
- describe "GET show" do
41
- it "assigns the requested create_type as @create_type" do
40
+ describe 'GET show' do
41
+ it 'assigns the requested create_type as @create_type' do
42
42
  create_type = CreateType.create! valid_attributes
43
- get :show, :id => create_type.id
43
+ get :show, id: create_type.id
44
44
  expect(assigns(:create_type)).to eq(create_type)
45
45
  end
46
46
  end
47
47
 
48
- describe "GET new" do
49
- it "assigns a new create_type as @create_type" do
48
+ describe 'GET new' do
49
+ it 'assigns a new create_type as @create_type' do
50
50
  get :new
51
51
  expect(assigns(:create_type)).to be_a_new(CreateType)
52
52
  end
53
53
  end
54
54
 
55
- describe "GET edit" do
56
- it "assigns the requested create_type as @create_type" do
55
+ describe 'GET edit' do
56
+ it 'assigns the requested create_type as @create_type' do
57
57
  create_type = CreateType.create! valid_attributes
58
- get :edit, :id => create_type.id
58
+ get :edit, id: create_type.id
59
59
  expect(assigns(:create_type)).to eq(create_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 CreateType" do
66
- expect {
67
- post :create, :create_type => valid_attributes
68
- }.to change(CreateType, :count).by(1)
63
+ describe 'POST create' do
64
+ describe 'with valid params' do
65
+ it 'creates a new CreateType' do
66
+ expect do
67
+ post :create, create_type: valid_attributes
68
+ end.to change(CreateType, :count).by(1)
69
69
  end
70
70
 
71
- it "assigns a newly created create_type as @create_type" do
72
- post :create, :create_type => valid_attributes
71
+ it 'assigns a newly created create_type as @create_type' do
72
+ post :create, create_type: valid_attributes
73
73
  expect(assigns(:create_type)).to be_a(CreateType)
74
74
  expect(assigns(:create_type)).to be_persisted
75
75
  end
76
76
 
77
- it "redirects to the created create_type" do
78
- post :create, :create_type => valid_attributes
77
+ it 'redirects to the created create_type' do
78
+ post :create, create_type: valid_attributes
79
79
  expect(response).to redirect_to(CreateType.last)
80
80
  end
81
81
  end
82
82
 
83
- describe "with invalid params" do
84
- it "assigns a newly created but unsaved create_type as @create_type" do
83
+ describe 'with invalid params' do
84
+ it 'assigns a newly created but unsaved create_type as @create_type' do
85
85
  # Trigger the behavior that occurs when invalid params are submitted
86
86
  CreateType.any_instance.stub(:save).and_return(false)
87
- post :create, :create_type => {name: "test"}
87
+ post :create, create_type: { name: 'test' }
88
88
  expect(assigns(:create_type)).to be_a_new(CreateType)
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
  CreateType.any_instance.stub(:save).and_return(false)
94
- post :create, :create_type => {name: "test"}
95
- #expect(response).to render_template("new")
94
+ post :create, create_type: { name: 'test' }
95
+ # expect(response).to 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 create_type" do
100
+ describe 'PUT update' do
101
+ describe 'with valid params' do
102
+ it 'updates the requested create_type' do
103
103
  create_type = CreateType.create! valid_attributes
104
104
  # Assuming there are no other create_types in the database, this
105
105
  # specifies that the CreateType created on the previous line
106
106
  # receives the :update_attributes message with whatever params are
107
107
  # submitted in the request.
108
- CreateType.any_instance.should_receive(:update_attributes).with({'name' => 'test'})
109
- put :update, :id => create_type.id, :create_type => {'name' => 'test'}
108
+ CreateType.any_instance.should_receive(:update_attributes).with('name' => 'test')
109
+ put :update, id: create_type.id, create_type: { 'name' => 'test' }
110
110
  end
111
111
 
112
- it "assigns the requested create_type as @create_type" do
112
+ it 'assigns the requested create_type as @create_type' do
113
113
  create_type = CreateType.create! valid_attributes
114
- put :update, :id => create_type.id, :create_type => valid_attributes
114
+ put :update, id: create_type.id, create_type: valid_attributes
115
115
  expect(assigns(:create_type)).to eq(create_type)
116
116
  end
117
117
 
118
- it "redirects to the create_type" do
118
+ it 'redirects to the create_type' do
119
119
  create_type = CreateType.create! valid_attributes
120
- put :update, :id => create_type.id, :create_type => valid_attributes
120
+ put :update, id: create_type.id, create_type: valid_attributes
121
121
  expect(response).to redirect_to(create_type)
122
122
  end
123
123
 
124
- it "moves its position when specified" do
124
+ it 'moves its position when specified' do
125
125
  create_type = CreateType.create! valid_attributes
126
126
  position = create_type.position
127
- put :update, :id => create_type.id, :move => 'higher'
127
+ put :update, id: create_type.id, move: 'higher'
128
128
  expect(response).to redirect_to create_types_url
129
129
  assigns(:create_type).reload.position.should eq position - 1
130
130
  end
131
131
  end
132
132
 
133
- describe "with invalid params" do
134
- it "assigns the create_type as @create_type" do
133
+ describe 'with invalid params' do
134
+ it 'assigns the create_type as @create_type' do
135
135
  create_type = CreateType.create! valid_attributes
136
136
  # Trigger the behavior that occurs when invalid params are submitted
137
137
  CreateType.any_instance.stub(:save).and_return(false)
138
- put :update, :id => create_type.id, :create_type => {name: "test"}
138
+ put :update, id: create_type.id, create_type: { name: 'test' }
139
139
  expect(assigns(:create_type)).to eq(create_type)
140
140
  end
141
141
 
@@ -143,25 +143,24 @@ describe CreateTypesController do
143
143
  create_type = CreateType.create! valid_attributes
144
144
  # Trigger the behavior that occurs when invalid params are submitted
145
145
  CreateType.any_instance.stub(:save).and_return(false)
146
- put :update, :id => create_type.id, :create_type => {name: "test"}
147
- #expect(response).to render_template("edit")
146
+ put :update, id: create_type.id, create_type: { name: 'test' }
147
+ # expect(response).to render_template("edit")
148
148
  end
149
149
  end
150
150
  end
151
151
 
152
- describe "DELETE destroy" do
153
- it "destroys the requested create_type" do
152
+ describe 'DELETE destroy' do
153
+ it 'destroys the requested create_type' do
154
154
  create_type = CreateType.create! valid_attributes
155
- expect {
156
- delete :destroy, :id => create_type.id
157
- }.to change(CreateType, :count).by(-1)
155
+ expect do
156
+ delete :destroy, id: create_type.id
157
+ end.to change(CreateType, :count).by(-1)
158
158
  end
159
159
 
160
- it "redirects to the create_types list" do
160
+ it 'redirects to the create_types list' do
161
161
  create_type = CreateType.create! valid_attributes
162
- delete :destroy, :id => create_type.id
162
+ delete :destroy, id: create_type.id
163
163
  expect(response).to redirect_to(create_types_url)
164
164
  end
165
165
  end
166
-
167
166
  end
@@ -9,117 +9,117 @@ describe CreatesController do
9
9
  FactoryGirl.attributes_for(:create)
10
10
  end
11
11
 
12
- describe "GET index" do
12
+ describe 'GET index' do
13
13
  before(:each) do
14
14
  FactoryGirl.create(:create)
15
15
  end
16
16
 
17
- describe "When logged in as Administrator" do
17
+ describe 'When logged in as Administrator' do
18
18
  login_fixture_admin
19
19
 
20
- it "assigns all creates as @creates" do
20
+ it 'assigns all creates as @creates' do
21
21
  get :index
22
22
  expect(assigns(:creates)).to eq(Create.page(1))
23
23
  end
24
24
  end
25
25
 
26
- describe "When logged in as Librarian" do
26
+ describe 'When logged in as Librarian' do
27
27
  login_fixture_librarian
28
28
 
29
- it "assigns all creates as @creates" do
29
+ it 'assigns all creates as @creates' do
30
30
  get :index
31
31
  expect(assigns(:creates)).to eq(Create.page(1))
32
32
  end
33
33
  end
34
34
 
35
- describe "When logged in as User" do
35
+ describe 'When logged in as User' do
36
36
  login_fixture_user
37
37
 
38
- it "assigns all creates as @creates" do
38
+ it 'assigns all creates as @creates' do
39
39
  get :index
40
40
  expect(assigns(:creates)).to eq(Create.page(1))
41
41
  end
42
42
  end
43
43
 
44
- describe "When not logged in" do
45
- it "assigns all creates as @creates" do
44
+ describe 'When not logged in' do
45
+ it 'assigns all creates as @creates' do
46
46
  get :index
47
47
  expect(assigns(:creates)).to eq(Create.page(1))
48
48
  end
49
49
  end
50
50
  end
51
51
 
52
- describe "GET show" do
53
- describe "When logged in as Administrator" do
52
+ describe 'GET show' do
53
+ describe 'When logged in as Administrator' do
54
54
  login_fixture_admin
55
55
 
56
- it "assigns the requested create as @create" do
56
+ it 'assigns the requested create as @create' do
57
57
  create = FactoryGirl.create(:create)
58
- get :show, :id => create.id
58
+ get :show, id: create.id
59
59
  expect(assigns(:create)).to eq(create)
60
60
  end
61
61
  end
62
62
 
63
- describe "When logged in as Librarian" do
63
+ describe 'When logged in as Librarian' do
64
64
  login_fixture_librarian
65
65
 
66
- it "assigns the requested create as @create" do
66
+ it 'assigns the requested create as @create' do
67
67
  create = FactoryGirl.create(:create)
68
- get :show, :id => create.id
68
+ get :show, id: create.id
69
69
  expect(assigns(:create)).to eq(create)
70
70
  end
71
71
  end
72
72
 
73
- describe "When logged in as User" do
73
+ describe 'When logged in as User' do
74
74
  login_fixture_user
75
75
 
76
- it "assigns the requested create as @create" do
76
+ it 'assigns the requested create as @create' do
77
77
  create = FactoryGirl.create(:create)
78
- get :show, :id => create.id
78
+ get :show, id: create.id
79
79
  expect(assigns(:create)).to eq(create)
80
80
  end
81
81
  end
82
82
 
83
- describe "When not logged in" do
84
- it "assigns the requested create as @create" do
83
+ describe 'When not logged in' do
84
+ it 'assigns the requested create as @create' do
85
85
  create = FactoryGirl.create(:create)
86
- get :show, :id => create.id
86
+ get :show, id: create.id
87
87
  expect(assigns(:create)).to eq(create)
88
88
  end
89
89
  end
90
90
  end
91
91
 
92
- describe "GET new" do
93
- describe "When logged in as Administrator" do
92
+ describe 'GET new' do
93
+ describe 'When logged in as Administrator' do
94
94
  login_fixture_admin
95
95
 
96
- it "assigns the requested create as @create" do
96
+ it 'assigns the requested create as @create' do
97
97
  get :new
98
98
  expect(assigns(:create)).not_to be_valid
99
99
  end
100
100
  end
101
101
 
102
- describe "When logged in as Librarian" do
102
+ describe 'When logged in as Librarian' do
103
103
  login_fixture_librarian
104
104
 
105
- it "assigns the requested create as @create" do
105
+ it 'assigns the requested create as @create' do
106
106
  get :new
107
107
  expect(assigns(:create)).not_to be_valid
108
108
  end
109
109
  end
110
110
 
111
- describe "When logged in as User" do
111
+ describe 'When logged in as User' do
112
112
  login_fixture_user
113
113
 
114
- it "should not assign the requested create as @create" do
114
+ it 'should not assign the requested create as @create' do
115
115
  get :new
116
116
  expect(assigns(:create)).to be_nil
117
117
  expect(response).to be_forbidden
118
118
  end
119
119
  end
120
120
 
121
- describe "When not logged in" do
122
- it "should not assign the requested create as @create" do
121
+ describe 'When not logged in' do
122
+ it 'should not assign the requested create as @create' do
123
123
  get :new
124
124
  expect(assigns(:create)).to be_nil
125
125
  expect(response).to redirect_to(new_user_session_url)
@@ -127,322 +127,322 @@ describe CreatesController do
127
127
  end
128
128
  end
129
129
 
130
- describe "GET edit" do
131
- describe "When logged in as Administrator" do
130
+ describe 'GET edit' do
131
+ describe 'When logged in as Administrator' do
132
132
  login_fixture_admin
133
133
 
134
- it "assigns the requested create as @create" do
134
+ it 'assigns the requested create as @create' do
135
135
  create = FactoryGirl.create(:create)
136
- get :edit, :id => create.id
136
+ get :edit, id: create.id
137
137
  expect(assigns(:create)).to eq(create)
138
138
  end
139
139
  end
140
140
 
141
- describe "When logged in as Librarian" do
141
+ describe 'When logged in as Librarian' do
142
142
  login_fixture_librarian
143
143
 
144
- it "assigns the requested create as @create" do
144
+ it 'assigns the requested create as @create' do
145
145
  create = FactoryGirl.create(:create)
146
- get :edit, :id => create.id
146
+ get :edit, id: create.id
147
147
  expect(assigns(:create)).to eq(create)
148
148
  end
149
149
  end
150
150
 
151
- describe "When logged in as User" do
151
+ describe 'When logged in as User' do
152
152
  login_fixture_user
153
153
 
154
- it "assigns the requested create as @create" do
154
+ it 'assigns the requested create as @create' do
155
155
  create = FactoryGirl.create(:create)
156
- get :edit, :id => create.id
156
+ get :edit, id: create.id
157
157
  expect(response).to be_forbidden
158
158
  end
159
159
  end
160
160
 
161
- describe "When not logged in" do
162
- it "should not assign the requested create as @create" do
161
+ describe 'When not logged in' do
162
+ it 'should not assign the requested create as @create' do
163
163
  create = FactoryGirl.create(:create)
164
- get :edit, :id => create.id
164
+ get :edit, id: create.id
165
165
  expect(response).to redirect_to(new_user_session_url)
166
166
  end
167
167
  end
168
168
  end
169
169
 
170
- describe "POST create" do
170
+ describe 'POST create' do
171
171
  before(:each) do
172
172
  @attrs = valid_attributes
173
- @invalid_attrs = {:work_id => ''}
173
+ @invalid_attrs = { work_id: '' }
174
174
  end
175
175
 
176
- describe "When logged in as Administrator" do
176
+ describe 'When logged in as Administrator' do
177
177
  login_fixture_admin
178
178
 
179
- describe "with valid params" do
180
- it "assigns a newly created create as @create" do
181
- post :create, :create => @attrs
179
+ describe 'with valid params' do
180
+ it 'assigns a newly created create as @create' do
181
+ post :create, create: @attrs
182
182
  expect(assigns(:create)).to be_valid
183
183
  end
184
184
 
185
- it "redirects to the created create" do
186
- post :create, :create => @attrs
185
+ it 'redirects to the created create' do
186
+ post :create, create: @attrs
187
187
  expect(response).to redirect_to(create_url(assigns(:create)))
188
188
  end
189
189
  end
190
190
 
191
- describe "with invalid params" do
192
- it "assigns a newly created but unsaved create as @create" do
193
- post :create, :create => @invalid_attrs
191
+ describe 'with invalid params' do
192
+ it 'assigns a newly created but unsaved create as @create' do
193
+ post :create, create: @invalid_attrs
194
194
  expect(assigns(:create)).not_to be_valid
195
195
  end
196
196
 
197
197
  it "re-renders the 'new' template" do
198
- post :create, :create => @invalid_attrs
199
- expect(response).to render_template("new")
198
+ post :create, create: @invalid_attrs
199
+ expect(response).to render_template('new')
200
200
  end
201
201
  end
202
202
  end
203
203
 
204
- describe "When logged in as Librarian" do
204
+ describe 'When logged in as Librarian' do
205
205
  login_fixture_librarian
206
206
 
207
- describe "with valid params" do
208
- it "assigns a newly created create as @create" do
209
- post :create, :create => @attrs
207
+ describe 'with valid params' do
208
+ it 'assigns a newly created create as @create' do
209
+ post :create, create: @attrs
210
210
  expect(assigns(:create)).to be_valid
211
211
  end
212
212
 
213
- it "redirects to the created create" do
214
- post :create, :create => @attrs
213
+ it 'redirects to the created create' do
214
+ post :create, create: @attrs
215
215
  expect(response).to redirect_to(create_url(assigns(:create)))
216
216
  end
217
217
  end
218
218
 
219
- describe "with invalid params" do
220
- it "assigns a newly created but unsaved create as @create" do
221
- post :create, :create => @invalid_attrs
219
+ describe 'with invalid params' do
220
+ it 'assigns a newly created but unsaved create as @create' do
221
+ post :create, create: @invalid_attrs
222
222
  expect(assigns(:create)).not_to be_valid
223
223
  end
224
224
 
225
225
  it "re-renders the 'new' template" do
226
- post :create, :create => @invalid_attrs
227
- expect(response).to render_template("new")
226
+ post :create, create: @invalid_attrs
227
+ expect(response).to render_template('new')
228
228
  end
229
229
  end
230
230
  end
231
231
 
232
- describe "When logged in as User" do
232
+ describe 'When logged in as User' do
233
233
  login_fixture_user
234
234
 
235
- describe "with valid params" do
236
- it "assigns a newly created create as @create" do
237
- post :create, :create => @attrs
235
+ describe 'with valid params' do
236
+ it 'assigns a newly created create as @create' do
237
+ post :create, create: @attrs
238
238
  expect(assigns(:create)).to be_nil
239
239
  end
240
240
 
241
- it "should be forbidden" do
242
- post :create, :create => @attrs
241
+ it 'should be forbidden' do
242
+ post :create, create: @attrs
243
243
  expect(response).to be_forbidden
244
244
  end
245
245
  end
246
246
 
247
- describe "with invalid params" do
248
- it "assigns a newly created but unsaved create as @create" do
249
- post :create, :create => @invalid_attrs
247
+ describe 'with invalid params' do
248
+ it 'assigns a newly created but unsaved create as @create' do
249
+ post :create, create: @invalid_attrs
250
250
  expect(assigns(:create)).to be_nil
251
251
  end
252
252
 
253
- it "should be forbidden" do
254
- post :create, :create => @invalid_attrs
253
+ it 'should be forbidden' do
254
+ post :create, create: @invalid_attrs
255
255
  expect(response).to be_forbidden
256
256
  end
257
257
  end
258
258
  end
259
259
 
260
- describe "When not logged in" do
261
- describe "with valid params" do
262
- it "assigns a newly created create as @create" do
263
- post :create, :create => @attrs
260
+ describe 'When not logged in' do
261
+ describe 'with valid params' do
262
+ it 'assigns a newly created create as @create' do
263
+ post :create, create: @attrs
264
264
  expect(assigns(:create)).to be_nil
265
265
  end
266
266
 
267
- it "should be forbidden" do
268
- post :create, :create => @attrs
267
+ it 'should be forbidden' do
268
+ post :create, create: @attrs
269
269
  expect(response).to redirect_to(new_user_session_url)
270
270
  end
271
271
  end
272
272
 
273
- describe "with invalid params" do
274
- it "assigns a newly created but unsaved create as @create" do
275
- post :create, :create => @invalid_attrs
273
+ describe 'with invalid params' do
274
+ it 'assigns a newly created but unsaved create as @create' do
275
+ post :create, create: @invalid_attrs
276
276
  expect(assigns(:create)).to be_nil
277
277
  end
278
278
 
279
- it "should be redirected to new session url" do
280
- post :create, :create => @invalid_attrs
279
+ it 'should be redirected to new session url' do
280
+ post :create, create: @invalid_attrs
281
281
  expect(response).to redirect_to(new_user_session_url)
282
282
  end
283
283
  end
284
284
  end
285
285
  end
286
286
 
287
- describe "PUT update" do
287
+ describe 'PUT update' do
288
288
  before(:each) do
289
289
  @create = creates(:create_00001)
290
290
  @attrs = valid_attributes
291
- @invalid_attrs = {:work_id => ''}
291
+ @invalid_attrs = { work_id: '' }
292
292
  end
293
293
 
294
- describe "When logged in as Administrator" do
294
+ describe 'When logged in as Administrator' do
295
295
  login_fixture_admin
296
296
 
297
- describe "with valid params" do
298
- it "updates the requested create" do
299
- put :update, :id => @create.id, :create => @attrs
297
+ describe 'with valid params' do
298
+ it 'updates the requested create' do
299
+ put :update, id: @create.id, create: @attrs
300
300
  end
301
301
 
302
- it "assigns the requested create as @create" do
303
- put :update, :id => @create.id, :create => @attrs
302
+ it 'assigns the requested create as @create' do
303
+ put :update, id: @create.id, create: @attrs
304
304
  expect(assigns(:create)).to eq(@create)
305
305
  end
306
306
  end
307
307
 
308
- describe "with invalid params" do
309
- it "assigns the requested create as @create" do
310
- put :update, :id => @create.id, :create => @invalid_attrs
311
- expect(response).to render_template("edit")
308
+ describe 'with invalid params' do
309
+ it 'assigns the requested create as @create' do
310
+ put :update, id: @create.id, create: @invalid_attrs
311
+ expect(response).to render_template('edit')
312
312
  end
313
313
  end
314
314
  end
315
315
 
316
- describe "When logged in as Librarian" do
316
+ describe 'When logged in as Librarian' do
317
317
  login_fixture_librarian
318
318
 
319
- describe "with valid params" do
320
- it "updates the requested create" do
321
- put :update, :id => @create.id, :create => @attrs
319
+ describe 'with valid params' do
320
+ it 'updates the requested create' do
321
+ put :update, id: @create.id, create: @attrs
322
322
  end
323
323
 
324
- it "assigns the requested create as @create" do
325
- put :update, :id => @create.id, :create => @attrs
324
+ it 'assigns the requested create as @create' do
325
+ put :update, id: @create.id, create: @attrs
326
326
  expect(assigns(:create)).to eq(@create)
327
327
  expect(response).to redirect_to(@create)
328
328
  end
329
329
 
330
- it "moves its position when specified" do
330
+ it 'moves its position when specified' do
331
331
  position = @create.position
332
- put :update, :id => @create.id, :work_id => @create.work.id, :move => 'lower'
332
+ put :update, id: @create.id, work_id: @create.work.id, move: 'lower'
333
333
  expect(response).to redirect_to creates_url(work_id: @create.work_id)
334
334
  assigns(:create).reload.position.should eq position + 1
335
335
  end
336
336
  end
337
337
 
338
- describe "with invalid params" do
339
- it "assigns the create as @create" do
340
- put :update, :id => @create, :create => @invalid_attrs
338
+ describe 'with invalid params' do
339
+ it 'assigns the create as @create' do
340
+ put :update, id: @create, create: @invalid_attrs
341
341
  expect(assigns(:create)).not_to be_valid
342
342
  end
343
343
 
344
344
  it "re-renders the 'edit' template" do
345
- put :update, :id => @create, :create => @invalid_attrs
346
- expect(response).to render_template("edit")
345
+ put :update, id: @create, create: @invalid_attrs
346
+ expect(response).to render_template('edit')
347
347
  end
348
348
  end
349
349
  end
350
350
 
351
- describe "When logged in as User" do
351
+ describe 'When logged in as User' do
352
352
  login_fixture_user
353
353
 
354
- describe "with valid params" do
355
- it "updates the requested create" do
356
- put :update, :id => @create.id, :create => @attrs
354
+ describe 'with valid params' do
355
+ it 'updates the requested create' do
356
+ put :update, id: @create.id, create: @attrs
357
357
  end
358
358
 
359
- it "assigns the requested create as @create" do
360
- put :update, :id => @create.id, :create => @attrs
359
+ it 'assigns the requested create as @create' do
360
+ put :update, id: @create.id, create: @attrs
361
361
  expect(assigns(:create)).to eq(@create)
362
362
  expect(response).to be_forbidden
363
363
  end
364
364
  end
365
365
 
366
- describe "with invalid params" do
367
- it "assigns the requested create as @create" do
368
- put :update, :id => @create.id, :create => @invalid_attrs
366
+ describe 'with invalid params' do
367
+ it 'assigns the requested create as @create' do
368
+ put :update, id: @create.id, create: @invalid_attrs
369
369
  expect(response).to be_forbidden
370
370
  end
371
371
  end
372
372
  end
373
373
 
374
- describe "When not logged in" do
375
- describe "with valid params" do
376
- it "updates the requested create" do
377
- put :update, :id => @create.id, :create => @attrs
374
+ describe 'When not logged in' do
375
+ describe 'with valid params' do
376
+ it 'updates the requested create' do
377
+ put :update, id: @create.id, create: @attrs
378
378
  end
379
379
 
380
- it "should be forbidden" do
381
- put :update, :id => @create.id, :create => @attrs
380
+ it 'should be forbidden' do
381
+ put :update, id: @create.id, create: @attrs
382
382
  expect(response).to redirect_to(new_user_session_url)
383
383
  end
384
384
  end
385
385
 
386
- describe "with invalid params" do
387
- it "assigns the requested create as @create" do
388
- put :update, :id => @create.id, :create => @invalid_attrs
386
+ describe 'with invalid params' do
387
+ it 'assigns the requested create as @create' do
388
+ put :update, id: @create.id, create: @invalid_attrs
389
389
  expect(response).to redirect_to(new_user_session_url)
390
390
  end
391
391
  end
392
392
  end
393
393
  end
394
394
 
395
- describe "DELETE destroy" do
395
+ describe 'DELETE destroy' do
396
396
  before(:each) do
397
397
  @create = FactoryGirl.create(:create)
398
398
  end
399
399
 
400
- describe "When logged in as Administrator" do
400
+ describe 'When logged in as Administrator' do
401
401
  login_fixture_admin
402
402
 
403
- it "destroys the requested create" do
404
- delete :destroy, :id => @create.id
403
+ it 'destroys the requested create' do
404
+ delete :destroy, id: @create.id
405
405
  end
406
406
 
407
- it "redirects to the creates list" do
408
- delete :destroy, :id => @create.id
407
+ it 'redirects to the creates list' do
408
+ delete :destroy, id: @create.id
409
409
  expect(response).to redirect_to(creates_url)
410
410
  end
411
411
  end
412
412
 
413
- describe "When logged in as Librarian" do
413
+ describe 'When logged in as Librarian' do
414
414
  login_fixture_librarian
415
415
 
416
- it "destroys the requested create" do
417
- delete :destroy, :id => @create.id
416
+ it 'destroys the requested create' do
417
+ delete :destroy, id: @create.id
418
418
  end
419
419
 
420
- it "should be forbidden" do
421
- delete :destroy, :id => @create.id
420
+ it 'should be forbidden' do
421
+ delete :destroy, id: @create.id
422
422
  expect(response).to redirect_to(creates_url)
423
423
  end
424
424
  end
425
425
 
426
- describe "When logged in as User" do
426
+ describe 'When logged in as User' do
427
427
  login_fixture_user
428
428
 
429
- it "destroys the requested create" do
430
- delete :destroy, :id => @create.id
429
+ it 'destroys the requested create' do
430
+ delete :destroy, id: @create.id
431
431
  end
432
432
 
433
- it "should be forbidden" do
434
- delete :destroy, :id => @create.id
433
+ it 'should be forbidden' do
434
+ delete :destroy, id: @create.id
435
435
  expect(response).to be_forbidden
436
436
  end
437
437
  end
438
438
 
439
- describe "When not logged in" do
440
- it "destroys the requested create" do
441
- delete :destroy, :id => @create.id
439
+ describe 'When not logged in' do
440
+ it 'destroys the requested create' do
441
+ delete :destroy, id: @create.id
442
442
  end
443
443
 
444
- it "should be forbidden" do
445
- delete :destroy, :id => @create.id
444
+ it 'should be forbidden' do
445
+ delete :destroy, id: @create.id
446
446
  expect(response).to redirect_to(new_user_session_url)
447
447
  end
448
448
  end