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
@@ -29,113 +29,113 @@ describe CreateTypesController do
|
|
29
29
|
FactoryGirl.attributes_for(:create_type)
|
30
30
|
end
|
31
31
|
|
32
|
-
describe
|
33
|
-
it
|
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
|
41
|
-
it
|
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, :
|
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
|
49
|
-
it
|
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
|
56
|
-
it
|
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, :
|
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
|
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 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
|
72
|
-
post :create, :
|
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
|
78
|
-
post :create, :
|
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
|
84
|
-
it
|
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, :
|
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, :
|
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
|
101
|
-
describe
|
102
|
-
it
|
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(
|
109
|
-
put :update, :
|
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
|
112
|
+
it 'assigns the requested create_type as @create_type' do
|
113
113
|
create_type = CreateType.create! valid_attributes
|
114
|
-
put :update, :
|
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
|
118
|
+
it 'redirects to the create_type' do
|
119
119
|
create_type = CreateType.create! valid_attributes
|
120
|
-
put :update, :
|
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
|
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, :
|
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
|
134
|
-
it
|
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, :
|
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, :
|
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
|
153
|
-
it
|
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, :
|
157
|
-
|
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
|
160
|
+
it 'redirects to the create_types list' do
|
161
161
|
create_type = CreateType.create! valid_attributes
|
162
|
-
delete :destroy, :
|
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
|
12
|
+
describe 'GET index' do
|
13
13
|
before(:each) do
|
14
14
|
FactoryGirl.create(:create)
|
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 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
|
26
|
+
describe 'When logged in as Librarian' do
|
27
27
|
login_fixture_librarian
|
28
28
|
|
29
|
-
it
|
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
|
35
|
+
describe 'When logged in as User' do
|
36
36
|
login_fixture_user
|
37
37
|
|
38
|
-
it
|
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
|
45
|
-
it
|
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
|
53
|
-
describe
|
52
|
+
describe 'GET show' do
|
53
|
+
describe 'When logged in as Administrator' do
|
54
54
|
login_fixture_admin
|
55
55
|
|
56
|
-
it
|
56
|
+
it 'assigns the requested create as @create' do
|
57
57
|
create = FactoryGirl.create(:create)
|
58
|
-
get :show, :
|
58
|
+
get :show, id: create.id
|
59
59
|
expect(assigns(:create)).to eq(create)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
describe
|
63
|
+
describe 'When logged in as Librarian' do
|
64
64
|
login_fixture_librarian
|
65
65
|
|
66
|
-
it
|
66
|
+
it 'assigns the requested create as @create' do
|
67
67
|
create = FactoryGirl.create(:create)
|
68
|
-
get :show, :
|
68
|
+
get :show, id: create.id
|
69
69
|
expect(assigns(:create)).to eq(create)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
describe
|
73
|
+
describe 'When logged in as User' do
|
74
74
|
login_fixture_user
|
75
75
|
|
76
|
-
it
|
76
|
+
it 'assigns the requested create as @create' do
|
77
77
|
create = FactoryGirl.create(:create)
|
78
|
-
get :show, :
|
78
|
+
get :show, id: create.id
|
79
79
|
expect(assigns(:create)).to eq(create)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
describe
|
84
|
-
it
|
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, :
|
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
|
93
|
-
describe
|
92
|
+
describe 'GET new' do
|
93
|
+
describe 'When logged in as Administrator' do
|
94
94
|
login_fixture_admin
|
95
95
|
|
96
|
-
it
|
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
|
102
|
+
describe 'When logged in as Librarian' do
|
103
103
|
login_fixture_librarian
|
104
104
|
|
105
|
-
it
|
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
|
111
|
+
describe 'When logged in as User' do
|
112
112
|
login_fixture_user
|
113
113
|
|
114
|
-
it
|
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
|
122
|
-
it
|
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
|
131
|
-
describe
|
130
|
+
describe 'GET edit' do
|
131
|
+
describe 'When logged in as Administrator' do
|
132
132
|
login_fixture_admin
|
133
133
|
|
134
|
-
it
|
134
|
+
it 'assigns the requested create as @create' do
|
135
135
|
create = FactoryGirl.create(:create)
|
136
|
-
get :edit, :
|
136
|
+
get :edit, id: create.id
|
137
137
|
expect(assigns(:create)).to eq(create)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
-
describe
|
141
|
+
describe 'When logged in as Librarian' do
|
142
142
|
login_fixture_librarian
|
143
143
|
|
144
|
-
it
|
144
|
+
it 'assigns the requested create as @create' do
|
145
145
|
create = FactoryGirl.create(:create)
|
146
|
-
get :edit, :
|
146
|
+
get :edit, id: create.id
|
147
147
|
expect(assigns(:create)).to eq(create)
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
-
describe
|
151
|
+
describe 'When logged in as User' do
|
152
152
|
login_fixture_user
|
153
153
|
|
154
|
-
it
|
154
|
+
it 'assigns the requested create as @create' do
|
155
155
|
create = FactoryGirl.create(:create)
|
156
|
-
get :edit, :
|
156
|
+
get :edit, id: create.id
|
157
157
|
expect(response).to be_forbidden
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
-
describe
|
162
|
-
it
|
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, :
|
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
|
170
|
+
describe 'POST create' do
|
171
171
|
before(:each) do
|
172
172
|
@attrs = valid_attributes
|
173
|
-
@invalid_attrs = {:
|
173
|
+
@invalid_attrs = { work_id: '' }
|
174
174
|
end
|
175
175
|
|
176
|
-
describe
|
176
|
+
describe 'When logged in as Administrator' do
|
177
177
|
login_fixture_admin
|
178
178
|
|
179
|
-
describe
|
180
|
-
it
|
181
|
-
post :create, :
|
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
|
186
|
-
post :create, :
|
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
|
192
|
-
it
|
193
|
-
post :create, :
|
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, :
|
199
|
-
expect(response).to render_template(
|
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
|
204
|
+
describe 'When logged in as Librarian' do
|
205
205
|
login_fixture_librarian
|
206
206
|
|
207
|
-
describe
|
208
|
-
it
|
209
|
-
post :create, :
|
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
|
214
|
-
post :create, :
|
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
|
220
|
-
it
|
221
|
-
post :create, :
|
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, :
|
227
|
-
expect(response).to render_template(
|
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
|
232
|
+
describe 'When logged in as User' do
|
233
233
|
login_fixture_user
|
234
234
|
|
235
|
-
describe
|
236
|
-
it
|
237
|
-
post :create, :
|
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
|
242
|
-
post :create, :
|
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
|
248
|
-
it
|
249
|
-
post :create, :
|
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
|
254
|
-
post :create, :
|
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
|
261
|
-
describe
|
262
|
-
it
|
263
|
-
post :create, :
|
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
|
268
|
-
post :create, :
|
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
|
274
|
-
it
|
275
|
-
post :create, :
|
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
|
280
|
-
post :create, :
|
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
|
287
|
+
describe 'PUT update' do
|
288
288
|
before(:each) do
|
289
289
|
@create = creates(:create_00001)
|
290
290
|
@attrs = valid_attributes
|
291
|
-
@invalid_attrs = {:
|
291
|
+
@invalid_attrs = { work_id: '' }
|
292
292
|
end
|
293
293
|
|
294
|
-
describe
|
294
|
+
describe 'When logged in as Administrator' do
|
295
295
|
login_fixture_admin
|
296
296
|
|
297
|
-
describe
|
298
|
-
it
|
299
|
-
put :update, :
|
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
|
303
|
-
put :update, :
|
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
|
309
|
-
it
|
310
|
-
put :update, :
|
311
|
-
expect(response).to render_template(
|
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
|
316
|
+
describe 'When logged in as Librarian' do
|
317
317
|
login_fixture_librarian
|
318
318
|
|
319
|
-
describe
|
320
|
-
it
|
321
|
-
put :update, :
|
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
|
325
|
-
put :update, :
|
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
|
330
|
+
it 'moves its position when specified' do
|
331
331
|
position = @create.position
|
332
|
-
put :update, :
|
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
|
339
|
-
it
|
340
|
-
put :update, :
|
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, :
|
346
|
-
expect(response).to render_template(
|
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
|
351
|
+
describe 'When logged in as User' do
|
352
352
|
login_fixture_user
|
353
353
|
|
354
|
-
describe
|
355
|
-
it
|
356
|
-
put :update, :
|
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
|
360
|
-
put :update, :
|
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
|
367
|
-
it
|
368
|
-
put :update, :
|
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
|
375
|
-
describe
|
376
|
-
it
|
377
|
-
put :update, :
|
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
|
381
|
-
put :update, :
|
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
|
387
|
-
it
|
388
|
-
put :update, :
|
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
|
395
|
+
describe 'DELETE destroy' do
|
396
396
|
before(:each) do
|
397
397
|
@create = FactoryGirl.create(:create)
|
398
398
|
end
|
399
399
|
|
400
|
-
describe
|
400
|
+
describe 'When logged in as Administrator' do
|
401
401
|
login_fixture_admin
|
402
402
|
|
403
|
-
it
|
404
|
-
delete :destroy, :
|
403
|
+
it 'destroys the requested create' do
|
404
|
+
delete :destroy, id: @create.id
|
405
405
|
end
|
406
406
|
|
407
|
-
it
|
408
|
-
delete :destroy, :
|
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
|
413
|
+
describe 'When logged in as Librarian' do
|
414
414
|
login_fixture_librarian
|
415
415
|
|
416
|
-
it
|
417
|
-
delete :destroy, :
|
416
|
+
it 'destroys the requested create' do
|
417
|
+
delete :destroy, id: @create.id
|
418
418
|
end
|
419
419
|
|
420
|
-
it
|
421
|
-
delete :destroy, :
|
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
|
426
|
+
describe 'When logged in as User' do
|
427
427
|
login_fixture_user
|
428
428
|
|
429
|
-
it
|
430
|
-
delete :destroy, :
|
429
|
+
it 'destroys the requested create' do
|
430
|
+
delete :destroy, id: @create.id
|
431
431
|
end
|
432
432
|
|
433
|
-
it
|
434
|
-
delete :destroy, :
|
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
|
440
|
-
it
|
441
|
-
delete :destroy, :
|
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
|
445
|
-
delete :destroy, :
|
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
|