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 ProduceTypesController do
|
|
29
29
|
FactoryGirl.attributes_for(:produce_type)
|
30
30
|
end
|
31
31
|
|
32
|
-
describe
|
33
|
-
it
|
32
|
+
describe 'GET index' do
|
33
|
+
it 'assigns all produce_types as @produce_types' do
|
34
34
|
produce_type = ProduceType.create! valid_attributes
|
35
35
|
get :index
|
36
36
|
expect(assigns(:produce_types)).to eq(ProduceType.order(:position))
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
41
|
-
it
|
40
|
+
describe 'GET show' do
|
41
|
+
it 'assigns the requested produce_type as @produce_type' do
|
42
42
|
produce_type = ProduceType.create! valid_attributes
|
43
|
-
get :show, :
|
43
|
+
get :show, id: produce_type.id
|
44
44
|
expect(assigns(:produce_type)).to eq(produce_type)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe
|
49
|
-
it
|
48
|
+
describe 'GET new' do
|
49
|
+
it 'assigns a new produce_type as @produce_type' do
|
50
50
|
get :new
|
51
51
|
expect(assigns(:produce_type)).to be_a_new(ProduceType)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
describe
|
56
|
-
it
|
55
|
+
describe 'GET edit' do
|
56
|
+
it 'assigns the requested produce_type as @produce_type' do
|
57
57
|
produce_type = ProduceType.create! valid_attributes
|
58
|
-
get :edit, :
|
58
|
+
get :edit, id: produce_type.id
|
59
59
|
expect(assigns(:produce_type)).to eq(produce_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 ProduceType' do
|
66
|
+
expect do
|
67
|
+
post :create, produce_type: valid_attributes
|
68
|
+
end.to change(ProduceType, :count).by(1)
|
69
69
|
end
|
70
70
|
|
71
|
-
it
|
72
|
-
post :create, :
|
71
|
+
it 'assigns a newly created produce_type as @produce_type' do
|
72
|
+
post :create, produce_type: valid_attributes
|
73
73
|
expect(assigns(:produce_type)).to be_a(ProduceType)
|
74
74
|
expect(assigns(:produce_type)).to be_persisted
|
75
75
|
end
|
76
76
|
|
77
|
-
it
|
78
|
-
post :create, :
|
77
|
+
it 'redirects to the created produce_type' do
|
78
|
+
post :create, produce_type: valid_attributes
|
79
79
|
expect(response).to redirect_to(ProduceType.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 produce_type as @produce_type' do
|
85
85
|
# Trigger the behavior that occurs when invalid params are submitted
|
86
86
|
ProduceType.any_instance.stub(:save).and_return(false)
|
87
|
-
post :create, :
|
87
|
+
post :create, produce_type: { name: 'test' }
|
88
88
|
expect(assigns(:produce_type)).to be_a_new(ProduceType)
|
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
|
ProduceType.any_instance.stub(:save).and_return(false)
|
94
|
-
post :create, :
|
95
|
-
#expect(response).to render_template("new")
|
94
|
+
post :create, produce_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 produce_type' do
|
103
103
|
produce_type = ProduceType.create! valid_attributes
|
104
104
|
# Assuming there are no other produce_types in the database, this
|
105
105
|
# specifies that the ProduceType created on the previous line
|
106
106
|
# receives the :update_attributes message with whatever params are
|
107
107
|
# submitted in the request.
|
108
|
-
ProduceType.any_instance.should_receive(:update_attributes).with(
|
109
|
-
put :update, :
|
108
|
+
ProduceType.any_instance.should_receive(:update_attributes).with('name' => 'test')
|
109
|
+
put :update, id: produce_type.id, produce_type: { 'name' => 'test' }
|
110
110
|
end
|
111
111
|
|
112
|
-
it
|
112
|
+
it 'assigns the requested produce_type as @produce_type' do
|
113
113
|
produce_type = ProduceType.create! valid_attributes
|
114
|
-
put :update, :
|
114
|
+
put :update, id: produce_type.id, produce_type: valid_attributes
|
115
115
|
expect(assigns(:produce_type)).to eq(produce_type)
|
116
116
|
end
|
117
117
|
|
118
|
-
it
|
118
|
+
it 'redirects to the produce_type' do
|
119
119
|
produce_type = ProduceType.create! valid_attributes
|
120
|
-
put :update, :
|
120
|
+
put :update, id: produce_type.id, produce_type: valid_attributes
|
121
121
|
expect(response).to redirect_to(produce_type)
|
122
122
|
end
|
123
123
|
|
124
|
-
it
|
124
|
+
it 'moves its position when specified' do
|
125
125
|
produce_type = ProduceType.create! valid_attributes
|
126
126
|
position = produce_type.position
|
127
|
-
put :update, :
|
127
|
+
put :update, id: produce_type.id, move: 'higher'
|
128
128
|
expect(response).to redirect_to produce_types_url
|
129
129
|
assigns(:produce_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 produce_type as @produce_type' do
|
135
135
|
produce_type = ProduceType.create! valid_attributes
|
136
136
|
# Trigger the behavior that occurs when invalid params are submitted
|
137
137
|
ProduceType.any_instance.stub(:save).and_return(false)
|
138
|
-
put :update, :
|
138
|
+
put :update, id: produce_type.id, produce_type: { name: 'test' }
|
139
139
|
expect(assigns(:produce_type)).to eq(produce_type)
|
140
140
|
end
|
141
141
|
|
@@ -143,25 +143,24 @@ describe ProduceTypesController do
|
|
143
143
|
produce_type = ProduceType.create! valid_attributes
|
144
144
|
# Trigger the behavior that occurs when invalid params are submitted
|
145
145
|
ProduceType.any_instance.stub(:save).and_return(false)
|
146
|
-
put :update, :
|
147
|
-
#expect(response).to render_template("edit")
|
146
|
+
put :update, id: produce_type.id, produce_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 produce_type' do
|
154
154
|
produce_type = ProduceType.create! valid_attributes
|
155
|
-
expect
|
156
|
-
delete :destroy, :
|
157
|
-
|
155
|
+
expect do
|
156
|
+
delete :destroy, id: produce_type.id
|
157
|
+
end.to change(ProduceType, :count).by(-1)
|
158
158
|
end
|
159
159
|
|
160
|
-
it
|
160
|
+
it 'redirects to the produce_types list' do
|
161
161
|
produce_type = ProduceType.create! valid_attributes
|
162
|
-
delete :destroy, :
|
162
|
+
delete :destroy, id: produce_type.id
|
163
163
|
expect(response).to redirect_to(produce_types_url)
|
164
164
|
end
|
165
165
|
end
|
166
|
-
|
167
166
|
end
|
@@ -9,113 +9,113 @@ describe ProducesController do
|
|
9
9
|
FactoryGirl.attributes_for(:produce)
|
10
10
|
end
|
11
11
|
|
12
|
-
describe
|
13
|
-
describe
|
12
|
+
describe 'GET index' do
|
13
|
+
describe 'When logged in as Administrator' do
|
14
14
|
login_fixture_admin
|
15
15
|
|
16
|
-
it
|
16
|
+
it 'assigns all produces as @produces' do
|
17
17
|
get :index
|
18
18
|
expect(assigns(:produces)).to eq(Produce.page(1))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
describe
|
22
|
+
describe 'When logged in as Librarian' do
|
23
23
|
login_fixture_librarian
|
24
24
|
|
25
|
-
it
|
25
|
+
it 'assigns all produces as @produces' do
|
26
26
|
get :index
|
27
27
|
expect(assigns(:produces)).to eq(Produce.page(1))
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
describe
|
31
|
+
describe 'When logged in as User' do
|
32
32
|
login_fixture_user
|
33
33
|
|
34
|
-
it
|
34
|
+
it 'assigns all produces as @produces' do
|
35
35
|
get :index
|
36
36
|
expect(assigns(:produces)).to eq(Produce.page(1))
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
41
|
-
it
|
40
|
+
describe 'When not logged in' do
|
41
|
+
it 'assigns all produces as @produces' do
|
42
42
|
get :index
|
43
43
|
expect(assigns(:produces)).to eq(Produce.page(1))
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe
|
49
|
-
describe
|
48
|
+
describe 'GET show' do
|
49
|
+
describe 'When logged in as Administrator' do
|
50
50
|
login_fixture_admin
|
51
51
|
|
52
|
-
it
|
52
|
+
it 'assigns the requested produce as @produce' do
|
53
53
|
produce = FactoryGirl.create(:produce)
|
54
|
-
get :show, :
|
54
|
+
get :show, id: produce.id
|
55
55
|
expect(assigns(:produce)).to eq(produce)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
describe
|
59
|
+
describe 'When logged in as Librarian' do
|
60
60
|
login_fixture_librarian
|
61
61
|
|
62
|
-
it
|
62
|
+
it 'assigns the requested produce as @produce' do
|
63
63
|
produce = FactoryGirl.create(:produce)
|
64
|
-
get :show, :
|
64
|
+
get :show, id: produce.id
|
65
65
|
expect(assigns(:produce)).to eq(produce)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
describe
|
69
|
+
describe 'When logged in as User' do
|
70
70
|
login_fixture_user
|
71
71
|
|
72
|
-
it
|
72
|
+
it 'assigns the requested produce as @produce' do
|
73
73
|
produce = FactoryGirl.create(:produce)
|
74
|
-
get :show, :
|
74
|
+
get :show, id: produce.id
|
75
75
|
expect(assigns(:produce)).to eq(produce)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
describe
|
80
|
-
it
|
79
|
+
describe 'When not logged in' do
|
80
|
+
it 'assigns the requested produce as @produce' do
|
81
81
|
produce = FactoryGirl.create(:produce)
|
82
|
-
get :show, :
|
82
|
+
get :show, id: produce.id
|
83
83
|
expect(assigns(:produce)).to eq(produce)
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
describe
|
89
|
-
describe
|
88
|
+
describe 'GET new' do
|
89
|
+
describe 'When logged in as Administrator' do
|
90
90
|
login_fixture_admin
|
91
91
|
|
92
|
-
it
|
92
|
+
it 'assigns the requested produce as @produce' do
|
93
93
|
get :new
|
94
94
|
expect(assigns(:produce)).not_to be_valid
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
describe
|
98
|
+
describe 'When logged in as Librarian' do
|
99
99
|
login_fixture_librarian
|
100
100
|
|
101
|
-
it
|
101
|
+
it 'assigns the requested produce as @produce' do
|
102
102
|
get :new
|
103
103
|
expect(assigns(:produce)).not_to be_valid
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
describe
|
107
|
+
describe 'When logged in as User' do
|
108
108
|
login_fixture_user
|
109
109
|
|
110
|
-
it
|
110
|
+
it 'should not assign the requested produce as @produce' do
|
111
111
|
get :new
|
112
112
|
expect(assigns(:produce)).to be_nil
|
113
113
|
expect(response).to be_forbidden
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
-
describe
|
118
|
-
it
|
117
|
+
describe 'When not logged in' do
|
118
|
+
it 'should not assign the requested produce as @produce' do
|
119
119
|
get :new
|
120
120
|
expect(assigns(:produce)).to be_nil
|
121
121
|
expect(response).to redirect_to(new_user_session_url)
|
@@ -123,322 +123,322 @@ describe ProducesController do
|
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
-
describe
|
127
|
-
describe
|
126
|
+
describe 'GET edit' do
|
127
|
+
describe 'When logged in as Administrator' do
|
128
128
|
login_fixture_admin
|
129
129
|
|
130
|
-
it
|
130
|
+
it 'assigns the requested produce as @produce' do
|
131
131
|
produce = FactoryGirl.create(:produce)
|
132
|
-
get :edit, :
|
132
|
+
get :edit, id: produce.id
|
133
133
|
expect(assigns(:produce)).to eq(produce)
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
-
describe
|
137
|
+
describe 'When logged in as Librarian' do
|
138
138
|
login_fixture_librarian
|
139
139
|
|
140
|
-
it
|
140
|
+
it 'assigns the requested produce as @produce' do
|
141
141
|
produce = FactoryGirl.create(:produce)
|
142
|
-
get :edit, :
|
142
|
+
get :edit, id: produce.id
|
143
143
|
expect(assigns(:produce)).to eq(produce)
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
-
describe
|
147
|
+
describe 'When logged in as User' do
|
148
148
|
login_fixture_user
|
149
149
|
|
150
|
-
it
|
150
|
+
it 'assigns the requested produce as @produce' do
|
151
151
|
produce = FactoryGirl.create(:produce)
|
152
|
-
get :edit, :
|
152
|
+
get :edit, id: produce.id
|
153
153
|
expect(response).to be_forbidden
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
-
describe
|
158
|
-
it
|
157
|
+
describe 'When not logged in' do
|
158
|
+
it 'should not assign the requested produce as @produce' do
|
159
159
|
produce = FactoryGirl.create(:produce)
|
160
|
-
get :edit, :
|
160
|
+
get :edit, id: produce.id
|
161
161
|
expect(response).to redirect_to(new_user_session_url)
|
162
162
|
end
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
-
describe
|
166
|
+
describe 'POST create' do
|
167
167
|
before(:each) do
|
168
168
|
@attrs = valid_attributes
|
169
|
-
@invalid_attrs = {:
|
169
|
+
@invalid_attrs = { manifestation_id: '' }
|
170
170
|
end
|
171
171
|
|
172
|
-
describe
|
172
|
+
describe 'When logged in as Administrator' do
|
173
173
|
login_fixture_admin
|
174
174
|
|
175
|
-
describe
|
176
|
-
it
|
177
|
-
post :create, :
|
175
|
+
describe 'with valid params' do
|
176
|
+
it 'assigns a newly created produce as @produce' do
|
177
|
+
post :create, produce: @attrs
|
178
178
|
expect(assigns(:produce)).to be_valid
|
179
179
|
end
|
180
180
|
|
181
|
-
it
|
182
|
-
post :create, :
|
181
|
+
it 'redirects to the created produce' do
|
182
|
+
post :create, produce: @attrs
|
183
183
|
expect(response).to redirect_to(produce_url(assigns(:produce)))
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
187
|
-
describe
|
188
|
-
it
|
189
|
-
post :create, :
|
187
|
+
describe 'with invalid params' do
|
188
|
+
it 'assigns a newly created but unsaved produce as @produce' do
|
189
|
+
post :create, produce: @invalid_attrs
|
190
190
|
expect(assigns(:produce)).not_to be_valid
|
191
191
|
end
|
192
192
|
|
193
193
|
it "re-renders the 'new' template" do
|
194
|
-
post :create, :
|
195
|
-
expect(response).to render_template(
|
194
|
+
post :create, produce: @invalid_attrs
|
195
|
+
expect(response).to render_template('new')
|
196
196
|
end
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
-
describe
|
200
|
+
describe 'When logged in as Librarian' do
|
201
201
|
login_fixture_librarian
|
202
202
|
|
203
|
-
describe
|
204
|
-
it
|
205
|
-
post :create, :
|
203
|
+
describe 'with valid params' do
|
204
|
+
it 'assigns a newly created produce as @produce' do
|
205
|
+
post :create, produce: @attrs
|
206
206
|
expect(assigns(:produce)).to be_valid
|
207
207
|
end
|
208
208
|
|
209
|
-
it
|
210
|
-
post :create, :
|
209
|
+
it 'redirects to the created produce' do
|
210
|
+
post :create, produce: @attrs
|
211
211
|
expect(response).to redirect_to(produce_url(assigns(:produce)))
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
215
|
-
describe
|
216
|
-
it
|
217
|
-
post :create, :
|
215
|
+
describe 'with invalid params' do
|
216
|
+
it 'assigns a newly created but unsaved produce as @produce' do
|
217
|
+
post :create, produce: @invalid_attrs
|
218
218
|
expect(assigns(:produce)).not_to be_valid
|
219
219
|
end
|
220
220
|
|
221
221
|
it "re-renders the 'new' template" do
|
222
|
-
post :create, :
|
223
|
-
expect(response).to render_template(
|
222
|
+
post :create, produce: @invalid_attrs
|
223
|
+
expect(response).to render_template('new')
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
227
227
|
|
228
|
-
describe
|
228
|
+
describe 'When logged in as User' do
|
229
229
|
login_fixture_user
|
230
230
|
|
231
|
-
describe
|
232
|
-
it
|
233
|
-
post :create, :
|
231
|
+
describe 'with valid params' do
|
232
|
+
it 'assigns a newly created produce as @produce' do
|
233
|
+
post :create, produce: @attrs
|
234
234
|
expect(assigns(:produce)).to be_nil
|
235
235
|
end
|
236
236
|
|
237
|
-
it
|
238
|
-
post :create, :
|
237
|
+
it 'should be forbidden' do
|
238
|
+
post :create, produce: @attrs
|
239
239
|
expect(response).to be_forbidden
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
243
|
-
describe
|
244
|
-
it
|
245
|
-
post :create, :
|
243
|
+
describe 'with invalid params' do
|
244
|
+
it 'assigns a newly created but unsaved produce as @produce' do
|
245
|
+
post :create, produce: @invalid_attrs
|
246
246
|
expect(assigns(:produce)).to be_nil
|
247
247
|
end
|
248
248
|
|
249
|
-
it
|
250
|
-
post :create, :
|
249
|
+
it 'should be forbidden' do
|
250
|
+
post :create, produce: @invalid_attrs
|
251
251
|
expect(response).to be_forbidden
|
252
252
|
end
|
253
253
|
end
|
254
254
|
end
|
255
255
|
|
256
|
-
describe
|
257
|
-
describe
|
258
|
-
it
|
259
|
-
post :create, :
|
256
|
+
describe 'When not logged in' do
|
257
|
+
describe 'with valid params' do
|
258
|
+
it 'assigns a newly created produce as @produce' do
|
259
|
+
post :create, produce: @attrs
|
260
260
|
expect(assigns(:produce)).to be_nil
|
261
261
|
end
|
262
262
|
|
263
|
-
it
|
264
|
-
post :create, :
|
263
|
+
it 'should be forbidden' do
|
264
|
+
post :create, produce: @attrs
|
265
265
|
expect(response).to redirect_to(new_user_session_url)
|
266
266
|
end
|
267
267
|
end
|
268
268
|
|
269
|
-
describe
|
270
|
-
it
|
271
|
-
post :create, :
|
269
|
+
describe 'with invalid params' do
|
270
|
+
it 'assigns a newly created but unsaved produce as @produce' do
|
271
|
+
post :create, produce: @invalid_attrs
|
272
272
|
expect(assigns(:produce)).to be_nil
|
273
273
|
end
|
274
274
|
|
275
|
-
it
|
276
|
-
post :create, :
|
275
|
+
it 'should be forbidden' do
|
276
|
+
post :create, produce: @invalid_attrs
|
277
277
|
expect(response).to redirect_to(new_user_session_url)
|
278
278
|
end
|
279
279
|
end
|
280
280
|
end
|
281
281
|
end
|
282
282
|
|
283
|
-
describe
|
283
|
+
describe 'PUT update' do
|
284
284
|
before(:each) do
|
285
285
|
@produce = produces(:produce_00001)
|
286
286
|
@attrs = valid_attributes
|
287
|
-
@invalid_attrs = {:
|
287
|
+
@invalid_attrs = { manifestation_id: '' }
|
288
288
|
end
|
289
289
|
|
290
|
-
describe
|
290
|
+
describe 'When logged in as Administrator' do
|
291
291
|
login_fixture_admin
|
292
292
|
|
293
|
-
describe
|
294
|
-
it
|
295
|
-
put :update, :
|
293
|
+
describe 'with valid params' do
|
294
|
+
it 'updates the requested produce' do
|
295
|
+
put :update, id: @produce.id, produce: @attrs
|
296
296
|
end
|
297
297
|
|
298
|
-
it
|
299
|
-
put :update, :
|
298
|
+
it 'assigns the requested produce as @produce' do
|
299
|
+
put :update, id: @produce.id, produce: @attrs
|
300
300
|
expect(assigns(:produce)).to eq(@produce)
|
301
301
|
end
|
302
302
|
end
|
303
303
|
|
304
|
-
describe
|
305
|
-
it
|
306
|
-
put :update, :
|
307
|
-
expect(response).to render_template(
|
304
|
+
describe 'with invalid params' do
|
305
|
+
it 'assigns the requested produce as @produce' do
|
306
|
+
put :update, id: @produce.id, produce: @invalid_attrs
|
307
|
+
expect(response).to render_template('edit')
|
308
308
|
end
|
309
309
|
end
|
310
310
|
end
|
311
311
|
|
312
|
-
describe
|
312
|
+
describe 'When logged in as Librarian' do
|
313
313
|
login_fixture_librarian
|
314
314
|
|
315
|
-
describe
|
316
|
-
it
|
317
|
-
put :update, :
|
315
|
+
describe 'with valid params' do
|
316
|
+
it 'updates the requested produce' do
|
317
|
+
put :update, id: @produce.id, produce: @attrs
|
318
318
|
end
|
319
319
|
|
320
|
-
it
|
321
|
-
put :update, :
|
320
|
+
it 'assigns the requested produce as @produce' do
|
321
|
+
put :update, id: @produce.id, produce: @attrs
|
322
322
|
expect(assigns(:produce)).to eq(@produce)
|
323
323
|
expect(response).to redirect_to(@produce)
|
324
324
|
end
|
325
325
|
|
326
|
-
it
|
326
|
+
it 'moves its position when specified' do
|
327
327
|
position = @produce.position
|
328
|
-
put :update, :
|
328
|
+
put :update, id: @produce.id, manifestation_id: @produce.manifestation.id, move: 'lower'
|
329
329
|
expect(response).to redirect_to produces_url(manifestation_id: @produce.manifestation_id)
|
330
330
|
assigns(:produce).reload.position.should eq position + 1
|
331
331
|
end
|
332
332
|
end
|
333
333
|
|
334
|
-
describe
|
335
|
-
it
|
336
|
-
put :update, :
|
334
|
+
describe 'with invalid params' do
|
335
|
+
it 'assigns the produce as @produce' do
|
336
|
+
put :update, id: @produce, produce: @invalid_attrs
|
337
337
|
expect(assigns(:produce)).not_to be_valid
|
338
338
|
end
|
339
339
|
|
340
340
|
it "re-renders the 'edit' template" do
|
341
|
-
put :update, :
|
342
|
-
expect(response).to render_template(
|
341
|
+
put :update, id: @produce, produce: @invalid_attrs
|
342
|
+
expect(response).to render_template('edit')
|
343
343
|
end
|
344
344
|
end
|
345
345
|
end
|
346
346
|
|
347
|
-
describe
|
347
|
+
describe 'When logged in as User' do
|
348
348
|
login_fixture_user
|
349
349
|
|
350
|
-
describe
|
351
|
-
it
|
352
|
-
put :update, :
|
350
|
+
describe 'with valid params' do
|
351
|
+
it 'updates the requested produce' do
|
352
|
+
put :update, id: @produce.id, produce: @attrs
|
353
353
|
end
|
354
354
|
|
355
|
-
it
|
356
|
-
put :update, :
|
355
|
+
it 'assigns the requested produce as @produce' do
|
356
|
+
put :update, id: @produce.id, produce: @attrs
|
357
357
|
expect(assigns(:produce)).to eq(@produce)
|
358
358
|
expect(response).to be_forbidden
|
359
359
|
end
|
360
360
|
end
|
361
361
|
|
362
|
-
describe
|
363
|
-
it
|
364
|
-
put :update, :
|
362
|
+
describe 'with invalid params' do
|
363
|
+
it 'assigns the requested produce as @produce' do
|
364
|
+
put :update, id: @produce.id, produce: @invalid_attrs
|
365
365
|
expect(response).to be_forbidden
|
366
366
|
end
|
367
367
|
end
|
368
368
|
end
|
369
369
|
|
370
|
-
describe
|
371
|
-
describe
|
372
|
-
it
|
373
|
-
put :update, :
|
370
|
+
describe 'When not logged in' do
|
371
|
+
describe 'with valid params' do
|
372
|
+
it 'updates the requested produce' do
|
373
|
+
put :update, id: @produce.id, produce: @attrs
|
374
374
|
end
|
375
375
|
|
376
|
-
it
|
377
|
-
put :update, :
|
376
|
+
it 'should be forbidden' do
|
377
|
+
put :update, id: @produce.id, produce: @attrs
|
378
378
|
expect(response).to redirect_to(new_user_session_url)
|
379
379
|
end
|
380
380
|
end
|
381
381
|
|
382
|
-
describe
|
383
|
-
it
|
384
|
-
put :update, :
|
382
|
+
describe 'with invalid params' do
|
383
|
+
it 'assigns the requested produce as @produce' do
|
384
|
+
put :update, id: @produce.id, produce: @invalid_attrs
|
385
385
|
expect(response).to redirect_to(new_user_session_url)
|
386
386
|
end
|
387
387
|
end
|
388
388
|
end
|
389
389
|
end
|
390
390
|
|
391
|
-
describe
|
391
|
+
describe 'DELETE destroy' do
|
392
392
|
before(:each) do
|
393
393
|
@produce = FactoryGirl.create(:produce)
|
394
394
|
end
|
395
395
|
|
396
|
-
describe
|
396
|
+
describe 'When logged in as Administrator' do
|
397
397
|
login_fixture_admin
|
398
398
|
|
399
|
-
it
|
400
|
-
delete :destroy, :
|
399
|
+
it 'destroys the requested produce' do
|
400
|
+
delete :destroy, id: @produce.id
|
401
401
|
end
|
402
402
|
|
403
|
-
it
|
404
|
-
delete :destroy, :
|
403
|
+
it 'redirects to the produces list' do
|
404
|
+
delete :destroy, id: @produce.id
|
405
405
|
expect(response).to redirect_to(produces_url)
|
406
406
|
end
|
407
407
|
end
|
408
408
|
|
409
|
-
describe
|
409
|
+
describe 'When logged in as Librarian' do
|
410
410
|
login_fixture_librarian
|
411
411
|
|
412
|
-
it
|
413
|
-
delete :destroy, :
|
412
|
+
it 'destroys the requested produce' do
|
413
|
+
delete :destroy, id: @produce.id
|
414
414
|
end
|
415
415
|
|
416
|
-
it
|
417
|
-
delete :destroy, :
|
416
|
+
it 'should be forbidden' do
|
417
|
+
delete :destroy, id: @produce.id
|
418
418
|
expect(response).to redirect_to(produces_url)
|
419
419
|
end
|
420
420
|
end
|
421
421
|
|
422
|
-
describe
|
422
|
+
describe 'When logged in as User' do
|
423
423
|
login_fixture_user
|
424
424
|
|
425
|
-
it
|
426
|
-
delete :destroy, :
|
425
|
+
it 'destroys the requested produce' do
|
426
|
+
delete :destroy, id: @produce.id
|
427
427
|
end
|
428
428
|
|
429
|
-
it
|
430
|
-
delete :destroy, :
|
429
|
+
it 'should be forbidden' do
|
430
|
+
delete :destroy, id: @produce.id
|
431
431
|
expect(response).to be_forbidden
|
432
432
|
end
|
433
433
|
end
|
434
434
|
|
435
|
-
describe
|
436
|
-
it
|
437
|
-
delete :destroy, :
|
435
|
+
describe 'When not logged in' do
|
436
|
+
it 'destroys the requested produce' do
|
437
|
+
delete :destroy, id: @produce.id
|
438
438
|
end
|
439
439
|
|
440
|
-
it
|
441
|
-
delete :destroy, :
|
440
|
+
it 'should be forbidden' do
|
441
|
+
delete :destroy, id: @produce.id
|
442
442
|
expect(response).to redirect_to(new_user_session_url)
|
443
443
|
end
|
444
444
|
end
|