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,114 +29,114 @@ describe FormOfWorksController do
|
|
29
29
|
FactoryGirl.attributes_for(:form_of_work)
|
30
30
|
end
|
31
31
|
|
32
|
-
describe
|
33
|
-
it
|
32
|
+
describe 'GET index' do
|
33
|
+
it 'assigns all form_of_works as @form_of_works' do
|
34
34
|
form_of_work = FormOfWork.create! valid_attributes
|
35
35
|
get :index
|
36
36
|
expect(assigns(:form_of_works)).to eq(FormOfWork.order(:position))
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
41
|
-
it
|
40
|
+
describe 'GET show' do
|
41
|
+
it 'assigns the requested form_of_work as @form_of_work' do
|
42
42
|
form_of_work = FormOfWork.create! valid_attributes
|
43
|
-
get :show, :
|
43
|
+
get :show, id: form_of_work.id
|
44
44
|
expect(assigns(:form_of_work)).to eq(form_of_work)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe
|
49
|
-
it
|
48
|
+
describe 'GET new' do
|
49
|
+
it 'assigns a new form_of_work as @form_of_work' do
|
50
50
|
get :new
|
51
51
|
expect(assigns(:form_of_work)).to be_a_new(FormOfWork)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
describe
|
56
|
-
it
|
55
|
+
describe 'GET edit' do
|
56
|
+
it 'assigns the requested form_of_work as @form_of_work' do
|
57
57
|
form_of_work = FormOfWork.create! valid_attributes
|
58
|
-
get :edit, :
|
58
|
+
get :edit, id: form_of_work.id
|
59
59
|
expect(assigns(:form_of_work)).to eq(form_of_work)
|
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 FormOfWork' do
|
66
|
+
expect do
|
67
|
+
post :create, form_of_work: valid_attributes
|
68
|
+
end.to change(FormOfWork, :count).by(1)
|
69
69
|
end
|
70
70
|
|
71
|
-
it
|
72
|
-
post :create, :
|
71
|
+
it 'assigns a newly created form_of_work as @form_of_work' do
|
72
|
+
post :create, form_of_work: valid_attributes
|
73
73
|
expect(assigns(:form_of_work)).to be_a(FormOfWork)
|
74
74
|
expect(assigns(:form_of_work)).to be_persisted
|
75
75
|
end
|
76
76
|
|
77
|
-
it
|
78
|
-
post :create, :
|
77
|
+
it 'redirects to the created form_of_work' do
|
78
|
+
post :create, form_of_work: valid_attributes
|
79
79
|
expect(response).to redirect_to(FormOfWork.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 form_of_work as @form_of_work' do
|
85
85
|
# Trigger the behavior that occurs when invalid params are submitted
|
86
86
|
FormOfWork.any_instance.stub(:save).and_return(false)
|
87
|
-
post :create, :
|
87
|
+
post :create, form_of_work: { name: 'test' }
|
88
88
|
expect(assigns(:form_of_work)).to be_a_new(FormOfWork)
|
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
|
FormOfWork.any_instance.stub(:save).and_return(false)
|
94
|
-
post :create, :
|
95
|
-
#expect(response).to render_template("new")
|
94
|
+
post :create, form_of_work: { 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 form_of_work' do
|
103
103
|
form_of_work = FormOfWork.create! valid_attributes
|
104
104
|
# Assuming there are no other form_of_works in the database, this
|
105
105
|
# specifies that the FormOfWork created on the previous line
|
106
106
|
# receives the :update_attributes message with whatever params are
|
107
107
|
# submitted in the request.
|
108
|
-
FormOfWork.any_instance.should_receive(:update_attributes).with(
|
109
|
-
put :update, :
|
108
|
+
FormOfWork.any_instance.should_receive(:update_attributes).with('name' => 'test')
|
109
|
+
put :update, id: form_of_work.id, form_of_work: { 'name' => 'test' }
|
110
110
|
end
|
111
111
|
|
112
|
-
it
|
112
|
+
it 'assigns the requested form_of_work as @form_of_work' do
|
113
113
|
form_of_work = FormOfWork.create! valid_attributes
|
114
|
-
put :update, :
|
114
|
+
put :update, id: form_of_work.id, form_of_work: valid_attributes
|
115
115
|
expect(assigns(:form_of_work)).to eq(form_of_work)
|
116
116
|
end
|
117
117
|
|
118
|
-
it
|
118
|
+
it 'redirects to the form_of_work' do
|
119
119
|
form_of_work = FormOfWork.create! valid_attributes
|
120
|
-
put :update, :
|
120
|
+
put :update, id: form_of_work.id, form_of_work: valid_attributes
|
121
121
|
expect(response).to redirect_to(form_of_work)
|
122
122
|
end
|
123
123
|
|
124
|
-
it
|
124
|
+
it 'moves its position when specified' do
|
125
125
|
form_of_work = FormOfWork.create! valid_attributes
|
126
126
|
position = form_of_work.position
|
127
|
-
put :update, :
|
127
|
+
put :update, id: form_of_work.id, move: 'higher'
|
128
128
|
expect(response).to redirect_to form_of_works_url
|
129
129
|
form_of_work.reload
|
130
130
|
form_of_work.position.should eq position - 1
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
-
describe
|
135
|
-
it
|
134
|
+
describe 'with invalid params' do
|
135
|
+
it 'assigns the form_of_work as @form_of_work' do
|
136
136
|
form_of_work = FormOfWork.create! valid_attributes
|
137
137
|
# Trigger the behavior that occurs when invalid params are submitted
|
138
138
|
FormOfWork.any_instance.stub(:save).and_return(false)
|
139
|
-
put :update, :
|
139
|
+
put :update, id: form_of_work.id, form_of_work: { name: 'test' }
|
140
140
|
expect(assigns(:form_of_work)).to eq(form_of_work)
|
141
141
|
end
|
142
142
|
|
@@ -144,25 +144,24 @@ describe FormOfWorksController do
|
|
144
144
|
form_of_work = FormOfWork.create! valid_attributes
|
145
145
|
# Trigger the behavior that occurs when invalid params are submitted
|
146
146
|
FormOfWork.any_instance.stub(:save).and_return(false)
|
147
|
-
put :update, :
|
148
|
-
#expect(response).to render_template("edit")
|
147
|
+
put :update, id: form_of_work.id, form_of_work: { name: 'test' }
|
148
|
+
# expect(response).to render_template("edit")
|
149
149
|
end
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
|
-
describe
|
154
|
-
it
|
153
|
+
describe 'DELETE destroy' do
|
154
|
+
it 'destroys the requested form_of_work' do
|
155
155
|
form_of_work = FormOfWork.create! valid_attributes
|
156
|
-
expect
|
157
|
-
delete :destroy, :
|
158
|
-
|
156
|
+
expect do
|
157
|
+
delete :destroy, id: form_of_work.id
|
158
|
+
end.to change(FormOfWork, :count).by(-1)
|
159
159
|
end
|
160
160
|
|
161
|
-
it
|
161
|
+
it 'redirects to the form_of_works list' do
|
162
162
|
form_of_work = FormOfWork.create! valid_attributes
|
163
|
-
delete :destroy, :
|
163
|
+
delete :destroy, id: form_of_work.id
|
164
164
|
expect(response).to redirect_to(form_of_works_url)
|
165
165
|
end
|
166
166
|
end
|
167
|
-
|
168
167
|
end
|
@@ -29,120 +29,120 @@ describe FrequenciesController do
|
|
29
29
|
FactoryGirl.attributes_for(:frequency)
|
30
30
|
end
|
31
31
|
|
32
|
-
describe
|
33
|
-
it
|
32
|
+
describe 'GET index' do
|
33
|
+
it 'assigns all frequencies as @frequencies' do
|
34
34
|
frequency = Frequency.create! valid_attributes
|
35
35
|
get :index
|
36
36
|
assigns(:frequencies).should eq(Frequency.order(:position))
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
41
|
-
it
|
40
|
+
describe 'GET show' do
|
41
|
+
it 'assigns the requested frequency as @frequency' do
|
42
42
|
frequency = Frequency.create! valid_attributes
|
43
|
-
get :show, :
|
43
|
+
get :show, id: frequency.id
|
44
44
|
assigns(:frequency).should eq(frequency)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe
|
49
|
-
it
|
48
|
+
describe 'GET new' do
|
49
|
+
it 'assigns a new frequency as @frequency' do
|
50
50
|
get :new
|
51
51
|
assigns(:frequency).should be_a_new(Frequency)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
describe
|
56
|
-
it
|
55
|
+
describe 'GET edit' do
|
56
|
+
it 'assigns the requested frequency as @frequency' do
|
57
57
|
frequency = Frequency.create! valid_attributes
|
58
|
-
get :edit, :
|
58
|
+
get :edit, id: frequency.id
|
59
59
|
assigns(:frequency).should eq(frequency)
|
60
60
|
end
|
61
|
-
it
|
61
|
+
it 'assigns the frequency even if it associates manifestation(s)' do
|
62
62
|
frequency = FactoryGirl.create(:frequency)
|
63
|
-
manifestation = FactoryGirl.create(:manifestation, :
|
64
|
-
get :edit, :
|
63
|
+
manifestation = FactoryGirl.create(:manifestation, frequency_id: frequency.id)
|
64
|
+
get :edit, id: frequency.id
|
65
65
|
expect(assigns(:frequency)).to eq frequency
|
66
66
|
expect(response).to be_success
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
describe
|
71
|
-
describe
|
72
|
-
it
|
73
|
-
expect
|
74
|
-
post :create, :
|
75
|
-
|
70
|
+
describe 'POST create' do
|
71
|
+
describe 'with valid params' do
|
72
|
+
it 'creates a new Frequency' do
|
73
|
+
expect do
|
74
|
+
post :create, frequency: valid_attributes
|
75
|
+
end.to change(Frequency, :count).by(1)
|
76
76
|
end
|
77
77
|
|
78
|
-
it
|
79
|
-
post :create, :
|
78
|
+
it 'assigns a newly created frequency as @frequency' do
|
79
|
+
post :create, frequency: valid_attributes
|
80
80
|
assigns(:frequency).should be_a(Frequency)
|
81
81
|
assigns(:frequency).should be_persisted
|
82
82
|
end
|
83
83
|
|
84
|
-
it
|
85
|
-
post :create, :
|
84
|
+
it 'redirects to the created frequency' do
|
85
|
+
post :create, frequency: valid_attributes
|
86
86
|
expect(response).to redirect_to(Frequency.last)
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
describe
|
91
|
-
it
|
90
|
+
describe 'with invalid params' do
|
91
|
+
it 'assigns a newly created but unsaved frequency as @frequency' do
|
92
92
|
# Trigger the behavior that occurs when invalid params are submitted
|
93
93
|
Frequency.any_instance.stub(:save).and_return(false)
|
94
|
-
post :create, :
|
94
|
+
post :create, frequency: { name: 'test' }
|
95
95
|
assigns(:frequency).should be_a_new(Frequency)
|
96
96
|
end
|
97
97
|
|
98
98
|
it "re-renders the 'new' template" do
|
99
99
|
# Trigger the behavior that occurs when invalid params are submitted
|
100
100
|
Frequency.any_instance.stub(:save).and_return(false)
|
101
|
-
post :create, :
|
102
|
-
expect(response).to render_template(
|
101
|
+
post :create, frequency: { name: 'test' }
|
102
|
+
expect(response).to render_template('new')
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
describe
|
108
|
-
describe
|
109
|
-
it
|
107
|
+
describe 'PUT update' do
|
108
|
+
describe 'with valid params' do
|
109
|
+
it 'updates the requested frequency' do
|
110
110
|
frequency = Frequency.create! valid_attributes
|
111
111
|
# Assuming there are no other frequencies in the database, this
|
112
112
|
# specifies that the Frequency created on the previous line
|
113
113
|
# receives the :update_attributes message with whatever params are
|
114
114
|
# submitted in the request.
|
115
|
-
Frequency.any_instance.should_receive(:update_attributes).with(
|
116
|
-
put :update, :
|
115
|
+
Frequency.any_instance.should_receive(:update_attributes).with('name' => 'test')
|
116
|
+
put :update, id: frequency.id, frequency: { 'name' => 'test' }
|
117
117
|
end
|
118
118
|
|
119
|
-
it
|
119
|
+
it 'assigns the requested frequency as @frequency' do
|
120
120
|
frequency = Frequency.create! valid_attributes
|
121
|
-
put :update, :
|
121
|
+
put :update, id: frequency.id, frequency: valid_attributes
|
122
122
|
assigns(:frequency).should eq(frequency)
|
123
123
|
end
|
124
124
|
|
125
|
-
it
|
125
|
+
it 'redirects to the frequency' do
|
126
126
|
frequency = Frequency.create! valid_attributes
|
127
|
-
put :update, :
|
127
|
+
put :update, id: frequency.id, frequency: valid_attributes
|
128
128
|
expect(response).to redirect_to(frequency)
|
129
129
|
end
|
130
130
|
|
131
|
-
it
|
131
|
+
it 'moves its position when specified' do
|
132
132
|
frequency = Frequency.create! valid_attributes
|
133
133
|
position = frequency.position
|
134
|
-
put :update, :
|
134
|
+
put :update, id: frequency.id, move: 'higher'
|
135
135
|
expect(response).to redirect_to frequencies_url
|
136
136
|
assigns(:frequency).reload.position.should eq position - 1
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
describe
|
141
|
-
it
|
140
|
+
describe 'with invalid params' do
|
141
|
+
it 'assigns the frequency as @frequency' do
|
142
142
|
frequency = Frequency.create! valid_attributes
|
143
143
|
# Trigger the behavior that occurs when invalid params are submitted
|
144
144
|
Frequency.any_instance.stub(:save).and_return(false)
|
145
|
-
put :update, :
|
145
|
+
put :update, id: frequency.id, frequency: { name: 'test' }
|
146
146
|
assigns(:frequency).should eq(frequency)
|
147
147
|
end
|
148
148
|
|
@@ -150,25 +150,24 @@ describe FrequenciesController do
|
|
150
150
|
frequency = Frequency.create! valid_attributes
|
151
151
|
# Trigger the behavior that occurs when invalid params are submitted
|
152
152
|
Frequency.any_instance.stub(:save).and_return(false)
|
153
|
-
put :update, :
|
154
|
-
expect(response).to render_template(
|
153
|
+
put :update, id: frequency.id, frequency: { name: 'test' }
|
154
|
+
expect(response).to render_template('edit')
|
155
155
|
end
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
|
-
describe
|
160
|
-
it
|
159
|
+
describe 'DELETE destroy' do
|
160
|
+
it 'destroys the requested frequency' do
|
161
161
|
frequency = Frequency.create! valid_attributes
|
162
|
-
expect
|
163
|
-
delete :destroy, :
|
164
|
-
|
162
|
+
expect do
|
163
|
+
delete :destroy, id: frequency.id
|
164
|
+
end.to change(Frequency, :count).by(-1)
|
165
165
|
end
|
166
166
|
|
167
|
-
it
|
167
|
+
it 'redirects to the frequencies list' do
|
168
168
|
frequency = Frequency.create! valid_attributes
|
169
|
-
delete :destroy, :
|
169
|
+
delete :destroy, id: frequency.id
|
170
170
|
expect(response).to redirect_to(frequencies_url)
|
171
171
|
end
|
172
172
|
end
|
173
|
-
|
174
173
|
end
|
@@ -29,113 +29,113 @@ describe IdentifierTypesController do
|
|
29
29
|
FactoryGirl.attributes_for(:identifier_type)
|
30
30
|
end
|
31
31
|
|
32
|
-
describe
|
33
|
-
it
|
32
|
+
describe 'GET index' do
|
33
|
+
it 'assigns all identifier_types as @identifier_types' do
|
34
34
|
identifier_type = IdentifierType.create! valid_attributes
|
35
35
|
get :index
|
36
36
|
expect(assigns(:identifier_types)).to eq(IdentifierType.order(:position))
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
41
|
-
it
|
40
|
+
describe 'GET show' do
|
41
|
+
it 'assigns the requested identifier_type as @identifier_type' do
|
42
42
|
identifier_type = IdentifierType.create! valid_attributes
|
43
|
-
get :show, :
|
43
|
+
get :show, id: identifier_type.id
|
44
44
|
expect(assigns(:identifier_type)).to eq(identifier_type)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe
|
49
|
-
it
|
48
|
+
describe 'GET new' do
|
49
|
+
it 'assigns a new identifier_type as @identifier_type' do
|
50
50
|
get :new
|
51
51
|
expect(assigns(:identifier_type)).to be_a_new(IdentifierType)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
describe
|
56
|
-
it
|
55
|
+
describe 'GET edit' do
|
56
|
+
it 'assigns the requested identifier_type as @identifier_type' do
|
57
57
|
identifier_type = IdentifierType.create! valid_attributes
|
58
|
-
get :edit, :
|
58
|
+
get :edit, id: identifier_type.id
|
59
59
|
expect(assigns(:identifier_type)).to eq(identifier_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 IdentifierType' do
|
66
|
+
expect do
|
67
|
+
post :create, identifier_type: valid_attributes
|
68
|
+
end.to change(IdentifierType, :count).by(1)
|
69
69
|
end
|
70
70
|
|
71
|
-
it
|
72
|
-
post :create, :
|
71
|
+
it 'assigns a newly created identifier_type as @identifier_type' do
|
72
|
+
post :create, identifier_type: valid_attributes
|
73
73
|
expect(assigns(:identifier_type)).to be_a(IdentifierType)
|
74
74
|
expect(assigns(:identifier_type)).to be_persisted
|
75
75
|
end
|
76
76
|
|
77
|
-
it
|
78
|
-
post :create, :
|
77
|
+
it 'redirects to the created identifier_type' do
|
78
|
+
post :create, identifier_type: valid_attributes
|
79
79
|
expect(response).to redirect_to(IdentifierType.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 identifier_type as @identifier_type' do
|
85
85
|
# Trigger the behavior that occurs when invalid params are submitted
|
86
86
|
IdentifierType.any_instance.stub(:save).and_return(false)
|
87
|
-
post :create, :
|
87
|
+
post :create, identifier_type: { name: 'test' }
|
88
88
|
expect(assigns(:identifier_type)).to be_a_new(IdentifierType)
|
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
|
IdentifierType.any_instance.stub(:save).and_return(false)
|
94
|
-
post :create, :
|
95
|
-
expect(response).to render_template(
|
94
|
+
post :create, identifier_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 identifier_type' do
|
103
103
|
identifier_type = IdentifierType.create! valid_attributes
|
104
104
|
# Assuming there are no other identifier_types in the database, this
|
105
105
|
# specifies that the IdentifierType created on the previous line
|
106
106
|
# receives the :update_attributes message with whatever params are
|
107
107
|
# submitted in the request.
|
108
|
-
IdentifierType.any_instance.should_receive(:update_attributes).with(
|
109
|
-
put :update, :
|
108
|
+
IdentifierType.any_instance.should_receive(:update_attributes).with('name' => 'test')
|
109
|
+
put :update, id: identifier_type.id, identifier_type: { 'name' => 'test' }
|
110
110
|
end
|
111
111
|
|
112
|
-
it
|
112
|
+
it 'assigns the requested identifier_type as @identifier_type' do
|
113
113
|
identifier_type = IdentifierType.create! valid_attributes
|
114
|
-
put :update, :
|
114
|
+
put :update, id: identifier_type.id, identifier_type: valid_attributes
|
115
115
|
expect(assigns(:identifier_type)).to eq(identifier_type)
|
116
116
|
end
|
117
117
|
|
118
|
-
it
|
118
|
+
it 'redirects to the identifier_type' do
|
119
119
|
identifier_type = IdentifierType.create! valid_attributes
|
120
|
-
put :update, :
|
120
|
+
put :update, id: identifier_type.id, identifier_type: valid_attributes
|
121
121
|
expect(response).to redirect_to(identifier_type)
|
122
122
|
end
|
123
123
|
|
124
|
-
it
|
124
|
+
it 'moves its position when specified' do
|
125
125
|
identifier_type = IdentifierType.create! valid_attributes
|
126
126
|
position = identifier_type.position
|
127
|
-
put :update, :
|
127
|
+
put :update, id: identifier_type.id, move: 'higher'
|
128
128
|
expect(response).to redirect_to identifier_types_url
|
129
129
|
assigns(:identifier_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 identifier_type as @identifier_type' do
|
135
135
|
identifier_type = IdentifierType.create! valid_attributes
|
136
136
|
# Trigger the behavior that occurs when invalid params are submitted
|
137
137
|
IdentifierType.any_instance.stub(:save).and_return(false)
|
138
|
-
put :update, :
|
138
|
+
put :update, id: identifier_type.id, identifier_type: { name: 'test' }
|
139
139
|
expect(assigns(:identifier_type)).to eq(identifier_type)
|
140
140
|
end
|
141
141
|
|
@@ -143,25 +143,24 @@ describe IdentifierTypesController do
|
|
143
143
|
identifier_type = IdentifierType.create! valid_attributes
|
144
144
|
# Trigger the behavior that occurs when invalid params are submitted
|
145
145
|
IdentifierType.any_instance.stub(:save).and_return(false)
|
146
|
-
put :update, :
|
147
|
-
expect(response).to render_template(
|
146
|
+
put :update, id: identifier_type.id, identifier_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 identifier_type' do
|
154
154
|
identifier_type = IdentifierType.create! valid_attributes
|
155
|
-
expect
|
156
|
-
delete :destroy, :
|
157
|
-
|
155
|
+
expect do
|
156
|
+
delete :destroy, id: identifier_type.id
|
157
|
+
end.to change(IdentifierType, :count).by(-1)
|
158
158
|
end
|
159
159
|
|
160
|
-
it
|
160
|
+
it 'redirects to the identifier_types list' do
|
161
161
|
identifier_type = IdentifierType.create! valid_attributes
|
162
|
-
delete :destroy, :
|
162
|
+
delete :destroy, id: identifier_type.id
|
163
163
|
expect(response).to redirect_to(identifier_types_url)
|
164
164
|
end
|
165
165
|
end
|
166
|
-
|
167
166
|
end
|