enju_biblio 0.1.0.pre49 → 0.1.0.pre50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/agent_types_controller.rb +0 -1
- data/app/controllers/countries_controller.rb +0 -1
- data/app/controllers/create_types_controller.rb +0 -1
- data/app/controllers/extents_controller.rb +0 -1
- data/app/controllers/form_of_works_controller.rb +0 -1
- data/app/controllers/frequencies_controller.rb +0 -1
- data/app/controllers/languages_controller.rb +0 -1
- data/app/controllers/licenses_controller.rb +0 -1
- data/app/controllers/manifestation_relationship_types_controller.rb +0 -1
- data/app/controllers/manifestation_relationships_controller.rb +0 -1
- data/app/controllers/medium_of_performances_controller.rb +0 -1
- data/app/controllers/produce_types_controller.rb +0 -1
- data/app/controllers/realize_types_controller.rb +0 -1
- data/app/models/enju_biblio/ability.rb +3 -9
- data/app/views/manifestations/_form.html.erb +1 -1
- data/app/views/manifestations/_series_form.html.erb +127 -0
- data/app/views/manifestations/_show_detail_librarian.html.erb +2 -0
- data/app/views/manifestations/_show_detail_user.html.erb +2 -0
- data/app/views/manifestations/_show_series_detail.html.erb +6 -20
- data/config/locales/translation_en.yml +3 -2
- data/config/locales/translation_ja.yml +2 -1
- data/config/routes.rb +3 -3
- data/lib/enju_biblio/engine.rb +1 -1
- data/lib/enju_biblio/version.rb +1 -1
- data/spec/cassette_library/ImportRequest/import/should_import_bibliographic_record.yml +512 -501
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_isbn_which_is_already_imported/redirects_to_the_created_import_request.yml +80 -70
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_valid_params/assigns_a_newly_created_import_request_as_import_request.yml +81 -71
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_valid_params/redirects_to_the_created_import_request.yml +81 -71
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Librarian/with_valid_params/assigns_a_newly_created_import_request_as_import_request.yml +80 -70
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Librarian/with_valid_params/redirects_to_the_created_import_request.yml +79 -69
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_has_only_isbn/should_be_imported.yml +470 -460
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_shift_jis/should_be_imported.yml +292 -276
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_be_imported.yml +292 -276
- data/spec/controllers/agent_types_controller_spec.rb +107 -388
- data/spec/controllers/content_types_controller_spec.rb +106 -385
- data/spec/controllers/countries_controller_spec.rb +7 -7
- data/spec/controllers/extents_controller_spec.rb +106 -385
- data/spec/controllers/form_of_works_controller_spec.rb +107 -385
- data/spec/controllers/frequencies_controller_spec.rb +106 -385
- data/spec/controllers/languages_controller_spec.rb +6 -6
- data/spec/controllers/licenses_controller_spec.rb +106 -385
- data/spec/controllers/medium_of_performances_controller_spec.rb +106 -385
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_delete_file.tsv +8 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample3.tsv +5 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_update_file.tsv +3 -0
- data/spec/dummy/private/system/picture_files/pictures/000/000/005/medium/spinner.gif +0 -0
- data/spec/dummy/private/system/picture_files/pictures/000/000/005/original/spinner.gif +0 -0
- data/spec/dummy/private/system/picture_files/pictures/000/000/005/thumb/spinner.gif +0 -0
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/isbn_sample.txt +3 -0
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/item_delete_file.tsv +11 -0
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/item_update_file.tsv +4 -0
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample1.tsv +19 -0
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample2.tsv +19 -0
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/update_series_statement.tsv +2 -0
- data/spec/dummy/solr/test/data/index/segments.gen +0 -0
- data/spec/dummy/solr/test/data/index/segments_1b3 +0 -0
- data/spec/dummy/solr/test/data/tlog/{tlog.0000000000000000389 → tlog.0000000000000001688} +0 -0
- data/spec/dummy/solr/test/data/tlog/{tlog.0000000000000000390 → tlog.0000000000000001689} +0 -0
- data/spec/dummy/solr/test/data/tlog/{tlog.0000000000000000391 → tlog.0000000000000001690} +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000001691 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000001692 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000001693 +0 -0
- data/spec/dummy/tmp/cache/4F7/F90/default_role +0 -0
- data/spec/dummy/tmp/cache/6E4/420/search_engine_all +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0830400afa3009686c89dda6258bd75d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0ee396465e00d17664feec416aacd858 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1555daca1ffdb4f1dbea6b81613a6dd0 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2f332119f883fdd68340b5b3a1079d3f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/41967b168e9b1bbeda476591dad80257 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4b298aca2f28a3547e6865794468d90c +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4facf54d58d89accb1176284157ae74d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/518a573cb9468335bfe3ebde3696755d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5c7fbc78c580dd8592a994e875ae928c +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c1a4d979d844b4bfa222a268acbdfcac +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c45932b8beef81cc3ed460679239a0e0 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/eac0985173184e3c4a1fdabeca4673a0 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/eaf86421a990484c49be01e9af85c061 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f206beea95d427cdde150003c8bd3253 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f3ab79106bf7c705cff60f636a7d8b26 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/models/resource_import_file_spec.rb +5 -2
- metadata +164 -151
- data/spec/dummy/solr/test/data/index/_7n.fdt +0 -0
- data/spec/dummy/solr/test/data/index/_7n.fdx +0 -0
- data/spec/dummy/solr/test/data/index/_7n.fnm +0 -0
- data/spec/dummy/solr/test/data/index/_7n.nvd +0 -0
- data/spec/dummy/solr/test/data/index/_7n.nvm +0 -0
- data/spec/dummy/solr/test/data/index/_7n.si +0 -0
- data/spec/dummy/solr/test/data/index/_7n_Lucene41_0.doc +0 -0
- data/spec/dummy/solr/test/data/index/_7n_Lucene41_0.pos +0 -0
- data/spec/dummy/solr/test/data/index/_7n_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/test/data/index/_7n_Lucene41_0.tip +0 -0
- data/spec/dummy/solr/test/data/index/_7o.fdt +0 -0
- data/spec/dummy/solr/test/data/index/_7o.fdx +0 -0
- data/spec/dummy/solr/test/data/index/_7o.fnm +0 -0
- data/spec/dummy/solr/test/data/index/_7o.nvd +0 -0
- data/spec/dummy/solr/test/data/index/_7o.nvm +0 -0
- data/spec/dummy/solr/test/data/index/_7o.si +0 -0
- data/spec/dummy/solr/test/data/index/_7o_Lucene41_0.doc +0 -0
- data/spec/dummy/solr/test/data/index/_7o_Lucene41_0.pos +0 -0
- data/spec/dummy/solr/test/data/index/_7o_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/test/data/index/_7o_Lucene41_0.tip +0 -0
- data/spec/dummy/solr/test/data/index/_7p.fdt +0 -0
- data/spec/dummy/solr/test/data/index/_7p.fdx +0 -0
- data/spec/dummy/solr/test/data/index/_7p.fnm +0 -0
- data/spec/dummy/solr/test/data/index/_7p.nvd +0 -0
- data/spec/dummy/solr/test/data/index/_7p.nvm +0 -0
- data/spec/dummy/solr/test/data/index/_7p.si +0 -0
- data/spec/dummy/solr/test/data/index/_7p_Lucene41_0.doc +0 -0
- data/spec/dummy/solr/test/data/index/_7p_Lucene41_0.pos +0 -0
- data/spec/dummy/solr/test/data/index/_7p_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/test/data/index/_7p_Lucene41_0.tip +0 -0
- data/spec/dummy/solr/test/data/index/segments_ax +0 -0
- data/spec/dummy/tmp/cache/ACB/B20/manifestation_search_total +0 -1
@@ -1,445 +1,167 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
|
2
|
+
|
3
|
+
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
4
|
+
# It demonstrates how one might use RSpec to specify the controller code that
|
5
|
+
# was generated by Rails when you ran the scaffold generator.
|
6
|
+
#
|
7
|
+
# It assumes that the implementation code is generated by the rails scaffold
|
8
|
+
# generator. If you are using any extension libraries to generate different
|
9
|
+
# controller code, this generated spec may or may not pass.
|
10
|
+
#
|
11
|
+
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
12
|
+
# of tools you can use to make these specs even more expressive, but we're
|
13
|
+
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
14
|
+
#
|
15
|
+
# Compared to earlier versions of this generator, there is very limited use of
|
16
|
+
# stubs and message expectations in this spec. Stubs are only used when there
|
17
|
+
# is no simpler way to get a handle on the object needed for the example.
|
18
|
+
# Message expectations are only used when there is no simpler way to specify
|
19
|
+
# that an instance is receiving a specific message.
|
3
20
|
|
4
21
|
describe FormOfWorksController do
|
5
|
-
|
6
|
-
|
22
|
+
login_admin
|
23
|
+
fixtures :library_groups
|
7
24
|
|
25
|
+
# This should return the minimal set of attributes required to create a valid
|
26
|
+
# FormOfWork. As you add validations to FormOfWork, be sure to
|
27
|
+
# update the return value of this method accordingly.
|
8
28
|
def valid_attributes
|
9
29
|
FactoryGirl.attributes_for(:form_of_work)
|
10
30
|
end
|
11
31
|
|
12
32
|
describe "GET index" do
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
describe "When logged in as Administrator" do
|
18
|
-
login_admin
|
19
|
-
|
20
|
-
it "assigns all form_of_works as @form_of_works" do
|
21
|
-
get :index
|
22
|
-
assigns(:form_of_works).should eq(FormOfWork.all)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "When logged in as Librarian" do
|
27
|
-
login_librarian
|
28
|
-
|
29
|
-
it "assigns all form_of_works as @form_of_works" do
|
30
|
-
get :index
|
31
|
-
assigns(:form_of_works).should eq(FormOfWork.all)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "When logged in as User" do
|
36
|
-
login_user
|
37
|
-
|
38
|
-
it "assigns all form_of_works as @form_of_works" do
|
39
|
-
get :index
|
40
|
-
assigns(:form_of_works).should eq(FormOfWork.all)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe "When not logged in" do
|
45
|
-
it "assigns all form_of_works as @form_of_works" do
|
46
|
-
get :index
|
47
|
-
assigns(:form_of_works).should eq(FormOfWork.all)
|
48
|
-
end
|
33
|
+
it "assigns all form_of_works as @form_of_works" do
|
34
|
+
form_of_work = FormOfWork.create! valid_attributes
|
35
|
+
get :index
|
36
|
+
assigns(:form_of_works).should eq(FormOfWork.all)
|
49
37
|
end
|
50
38
|
end
|
51
39
|
|
52
40
|
describe "GET show" do
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
describe "When logged in as Administrator" do
|
58
|
-
login_admin
|
59
|
-
|
60
|
-
it "assigns the requested form_of_work as @form_of_work" do
|
61
|
-
get :show, :id => @form_of_work.id
|
62
|
-
assigns(:form_of_work).should eq(@form_of_work)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe "When logged in as Librarian" do
|
67
|
-
login_librarian
|
68
|
-
|
69
|
-
it "assigns the requested form_of_work as @form_of_work" do
|
70
|
-
get :show, :id => @form_of_work.id
|
71
|
-
assigns(:form_of_work).should eq(@form_of_work)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe "When logged in as User" do
|
76
|
-
login_user
|
77
|
-
|
78
|
-
it "assigns the requested form_of_work as @form_of_work" do
|
79
|
-
get :show, :id => @form_of_work.id
|
80
|
-
assigns(:form_of_work).should eq(@form_of_work)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe "When not logged in" do
|
85
|
-
it "assigns the requested form_of_work as @form_of_work" do
|
86
|
-
get :show, :id => @form_of_work.id
|
87
|
-
assigns(:form_of_work).should eq(@form_of_work)
|
88
|
-
end
|
41
|
+
it "assigns the requested form_of_work as @form_of_work" do
|
42
|
+
form_of_work = FormOfWork.create! valid_attributes
|
43
|
+
get :show, :id => form_of_work.id
|
44
|
+
assigns(:form_of_work).should eq(form_of_work)
|
89
45
|
end
|
90
46
|
end
|
91
47
|
|
92
48
|
describe "GET new" do
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
it "assigns the requested form_of_work as @form_of_work" do
|
97
|
-
get :new
|
98
|
-
assigns(:form_of_work).should_not be_valid
|
99
|
-
response.should be_forbidden
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
describe "When logged in as Librarian" do
|
104
|
-
login_librarian
|
105
|
-
|
106
|
-
it "should not assign the requested form_of_work as @form_of_work" do
|
107
|
-
get :new
|
108
|
-
assigns(:form_of_work).should_not be_valid
|
109
|
-
response.should be_forbidden
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
describe "When logged in as User" do
|
114
|
-
login_user
|
115
|
-
|
116
|
-
it "should not assign the requested form_of_work as @form_of_work" do
|
117
|
-
get :new
|
118
|
-
assigns(:form_of_work).should_not be_valid
|
119
|
-
response.should be_forbidden
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
describe "When not logged in" do
|
124
|
-
it "should not assign the requested form_of_work as @form_of_work" do
|
125
|
-
get :new
|
126
|
-
assigns(:form_of_work).should_not be_valid
|
127
|
-
response.should redirect_to(new_user_session_url)
|
128
|
-
end
|
49
|
+
it "assigns a new form_of_work as @form_of_work" do
|
50
|
+
get :new
|
51
|
+
assigns(:form_of_work).should be_a_new(FormOfWork)
|
129
52
|
end
|
130
53
|
end
|
131
54
|
|
132
55
|
describe "GET edit" do
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
describe "When logged in as Administrator" do
|
138
|
-
login_admin
|
139
|
-
|
140
|
-
it "assigns the requested form_of_work as @form_of_work" do
|
141
|
-
get :edit, :id => @form_of_work.id
|
142
|
-
assigns(:form_of_work).should eq(@form_of_work)
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
describe "When logged in as Librarian" do
|
147
|
-
login_librarian
|
148
|
-
|
149
|
-
it "assigns the requested form_of_work as @form_of_work" do
|
150
|
-
get :edit, :id => @form_of_work.id
|
151
|
-
response.should be_forbidden
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
describe "When logged in as User" do
|
156
|
-
login_user
|
157
|
-
|
158
|
-
it "assigns the requested form_of_work as @form_of_work" do
|
159
|
-
get :edit, :id => @form_of_work.id
|
160
|
-
response.should be_forbidden
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
describe "When not logged in" do
|
165
|
-
it "should not assign the requested form_of_work as @form_of_work" do
|
166
|
-
get :edit, :id => @form_of_work.id
|
167
|
-
response.should redirect_to(new_user_session_url)
|
168
|
-
end
|
56
|
+
it "assigns the requested form_of_work as @form_of_work" do
|
57
|
+
form_of_work = FormOfWork.create! valid_attributes
|
58
|
+
get :edit, :id => form_of_work.id
|
59
|
+
assigns(:form_of_work).should eq(form_of_work)
|
169
60
|
end
|
170
61
|
end
|
171
62
|
|
172
63
|
describe "POST create" do
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
describe "When logged in as Administrator" do
|
179
|
-
login_admin
|
180
|
-
|
181
|
-
describe "with valid params" do
|
182
|
-
it "assigns a newly created form_of_work as @form_of_work" do
|
183
|
-
post :create, :form_of_work => @attrs
|
184
|
-
assigns(:form_of_work).should be_valid
|
185
|
-
end
|
186
|
-
|
187
|
-
it "should be forbidden" do
|
188
|
-
post :create, :form_of_work => @attrs
|
189
|
-
response.should be_forbidden
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
describe "with invalid params" do
|
194
|
-
it "assigns a newly created but unsaved form_of_work as @form_of_work" do
|
195
|
-
post :create, :form_of_work => @invalid_attrs
|
196
|
-
assigns(:form_of_work).should_not be_valid
|
197
|
-
end
|
198
|
-
|
199
|
-
it "should be forbidden" do
|
200
|
-
post :create, :form_of_work => @invalid_attrs
|
201
|
-
response.should be_forbidden
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
describe "When logged in as Librarian" do
|
207
|
-
login_librarian
|
208
|
-
|
209
|
-
describe "with valid params" do
|
210
|
-
it "assigns a newly created form_of_work as @form_of_work" do
|
211
|
-
post :create, :form_of_work => @attrs
|
212
|
-
assigns(:form_of_work).should be_valid
|
213
|
-
end
|
214
|
-
|
215
|
-
it "should be forbidden" do
|
216
|
-
post :create, :form_of_work => @attrs
|
217
|
-
response.should be_forbidden
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
describe "with invalid params" do
|
222
|
-
it "assigns a newly created but unsaved form_of_work as @form_of_work" do
|
223
|
-
post :create, :form_of_work => @invalid_attrs
|
224
|
-
assigns(:form_of_work).should_not be_valid
|
225
|
-
end
|
226
|
-
|
227
|
-
it "should be forbidden" do
|
228
|
-
post :create, :form_of_work => @invalid_attrs
|
229
|
-
response.should be_forbidden
|
230
|
-
end
|
64
|
+
describe "with valid params" do
|
65
|
+
it "creates a new FormOfWork" do
|
66
|
+
expect {
|
67
|
+
post :create, :form_of_work => valid_attributes
|
68
|
+
}.to change(FormOfWork, :count).by(1)
|
231
69
|
end
|
232
|
-
end
|
233
|
-
|
234
|
-
describe "When logged in as User" do
|
235
|
-
login_user
|
236
70
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
end
|
242
|
-
|
243
|
-
it "should be forbidden" do
|
244
|
-
post :create, :form_of_work => @attrs
|
245
|
-
response.should be_forbidden
|
246
|
-
end
|
71
|
+
it "assigns a newly created form_of_work as @form_of_work" do
|
72
|
+
post :create, :form_of_work => valid_attributes
|
73
|
+
assigns(:form_of_work).should be_a(FormOfWork)
|
74
|
+
assigns(:form_of_work).should be_persisted
|
247
75
|
end
|
248
76
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
assigns(:form_of_work).should_not be_valid
|
253
|
-
end
|
254
|
-
|
255
|
-
it "should be forbidden" do
|
256
|
-
post :create, :form_of_work => @invalid_attrs
|
257
|
-
response.should be_forbidden
|
258
|
-
end
|
77
|
+
it "redirects to the created form_of_work" do
|
78
|
+
post :create, :form_of_work => valid_attributes
|
79
|
+
response.should redirect_to(FormOfWork.last)
|
259
80
|
end
|
260
81
|
end
|
261
82
|
|
262
|
-
describe "
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
it "should be forbidden" do
|
270
|
-
post :create, :form_of_work => @attrs
|
271
|
-
response.should redirect_to(new_user_session_url)
|
272
|
-
end
|
83
|
+
describe "with invalid params" do
|
84
|
+
it "assigns a newly created but unsaved form_of_work as @form_of_work" do
|
85
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
86
|
+
FormOfWork.any_instance.stub(:save).and_return(false)
|
87
|
+
post :create, :form_of_work => {}
|
88
|
+
assigns(:form_of_work).should be_a_new(FormOfWork)
|
273
89
|
end
|
274
90
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
it "should be forbidden" do
|
282
|
-
post :create, :form_of_work => @invalid_attrs
|
283
|
-
response.should redirect_to(new_user_session_url)
|
284
|
-
end
|
91
|
+
it "re-renders the 'new' template" do
|
92
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
93
|
+
FormOfWork.any_instance.stub(:save).and_return(false)
|
94
|
+
post :create, :form_of_work => {}
|
95
|
+
#response.should render_template("new")
|
285
96
|
end
|
286
97
|
end
|
287
98
|
end
|
288
99
|
|
289
100
|
describe "PUT update" do
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
describe "with valid params" do
|
300
|
-
it "updates the requested form_of_work" do
|
301
|
-
put :update, :id => @form_of_work.id, :form_of_work => @attrs
|
302
|
-
end
|
303
|
-
|
304
|
-
it "assigns the requested form_of_work as @form_of_work" do
|
305
|
-
put :update, :id => @form_of_work.id, :form_of_work => @attrs
|
306
|
-
assigns(:form_of_work).should eq(@form_of_work)
|
307
|
-
end
|
308
|
-
|
309
|
-
it "moves its position when specified" do
|
310
|
-
put :update, :id => @form_of_work.id, :form_of_work => @attrs, :move => 'lower'
|
311
|
-
response.should redirect_to(form_of_works_url)
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
|
-
describe "with invalid params" do
|
316
|
-
it "assigns the requested form_of_work as @form_of_work" do
|
317
|
-
put :update, :id => @form_of_work.id, :form_of_work => @invalid_attrs
|
318
|
-
response.should render_template("edit")
|
319
|
-
end
|
101
|
+
describe "with valid params" do
|
102
|
+
it "updates the requested form_of_work" do
|
103
|
+
form_of_work = FormOfWork.create! valid_attributes
|
104
|
+
# Assuming there are no other form_of_works in the database, this
|
105
|
+
# specifies that the FormOfWork created on the previous line
|
106
|
+
# receives the :update_attributes message with whatever params are
|
107
|
+
# submitted in the request.
|
108
|
+
FormOfWork.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
|
109
|
+
put :update, :id => form_of_work.id, :form_of_work => {'these' => 'params'}
|
320
110
|
end
|
321
|
-
end
|
322
111
|
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
it "updates the requested form_of_work" do
|
328
|
-
put :update, :id => @form_of_work.id, :form_of_work => @attrs
|
329
|
-
end
|
330
|
-
|
331
|
-
it "assigns the requested form_of_work as @form_of_work" do
|
332
|
-
put :update, :id => @form_of_work.id, :form_of_work => @attrs
|
333
|
-
assigns(:form_of_work).should eq(@form_of_work)
|
334
|
-
response.should be_forbidden
|
335
|
-
end
|
336
|
-
end
|
337
|
-
|
338
|
-
describe "with invalid params" do
|
339
|
-
it "assigns the requested form_of_work as @form_of_work" do
|
340
|
-
put :update, :id => @form_of_work.id, :form_of_work => @invalid_attrs
|
341
|
-
response.should be_forbidden
|
342
|
-
end
|
112
|
+
it "assigns the requested form_of_work as @form_of_work" do
|
113
|
+
form_of_work = FormOfWork.create! valid_attributes
|
114
|
+
put :update, :id => form_of_work.id, :form_of_work => valid_attributes
|
115
|
+
assigns(:form_of_work).should eq(form_of_work)
|
343
116
|
end
|
344
|
-
end
|
345
|
-
|
346
|
-
describe "When logged in as User" do
|
347
|
-
login_user
|
348
|
-
|
349
|
-
describe "with valid params" do
|
350
|
-
it "updates the requested form_of_work" do
|
351
|
-
put :update, :id => @form_of_work.id, :form_of_work => @attrs
|
352
|
-
end
|
353
117
|
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
end
|
118
|
+
it "redirects to the form_of_work" do
|
119
|
+
form_of_work = FormOfWork.create! valid_attributes
|
120
|
+
put :update, :id => form_of_work.id, :form_of_work => valid_attributes
|
121
|
+
response.should redirect_to(form_of_work)
|
359
122
|
end
|
360
123
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
124
|
+
it "moves its position when specified" do
|
125
|
+
form_of_work = FormOfWork.create! valid_attributes
|
126
|
+
position = form_of_work.position
|
127
|
+
put :update, :id => form_of_work.id, :move => 'higher'
|
128
|
+
response.should redirect_to form_of_works_url
|
129
|
+
assigns(:form_of_work).position.should eq position - 1
|
366
130
|
end
|
367
131
|
end
|
368
132
|
|
369
|
-
describe "
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
put :update, :id => @form_of_work.id, :form_of_work => @attrs
|
377
|
-
response.should redirect_to(new_user_session_url)
|
378
|
-
end
|
133
|
+
describe "with invalid params" do
|
134
|
+
it "assigns the form_of_work as @form_of_work" do
|
135
|
+
form_of_work = FormOfWork.create! valid_attributes
|
136
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
137
|
+
FormOfWork.any_instance.stub(:save).and_return(false)
|
138
|
+
put :update, :id => form_of_work.id, :form_of_work => {}
|
139
|
+
assigns(:form_of_work).should eq(form_of_work)
|
379
140
|
end
|
380
141
|
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
142
|
+
it "re-renders the 'edit' template" do
|
143
|
+
form_of_work = FormOfWork.create! valid_attributes
|
144
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
145
|
+
FormOfWork.any_instance.stub(:save).and_return(false)
|
146
|
+
put :update, :id => form_of_work.id, :form_of_work => {}
|
147
|
+
#response.should render_template("edit")
|
386
148
|
end
|
387
149
|
end
|
388
150
|
end
|
389
151
|
|
390
152
|
describe "DELETE destroy" do
|
391
|
-
|
392
|
-
|
153
|
+
it "destroys the requested form_of_work" do
|
154
|
+
form_of_work = FormOfWork.create! valid_attributes
|
155
|
+
expect {
|
156
|
+
delete :destroy, :id => form_of_work.id
|
157
|
+
}.to change(FormOfWork, :count).by(-1)
|
393
158
|
end
|
394
159
|
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
delete :destroy, :id => @form_of_work.id
|
400
|
-
end
|
401
|
-
|
402
|
-
it "should be forbidden" do
|
403
|
-
delete :destroy, :id => @form_of_work.id
|
404
|
-
response.should be_forbidden
|
405
|
-
end
|
406
|
-
end
|
407
|
-
|
408
|
-
describe "When logged in as Librarian" do
|
409
|
-
login_librarian
|
410
|
-
|
411
|
-
it "destroys the requested form_of_work" do
|
412
|
-
delete :destroy, :id => @form_of_work.id
|
413
|
-
end
|
414
|
-
|
415
|
-
it "should be forbidden" do
|
416
|
-
delete :destroy, :id => @form_of_work.id
|
417
|
-
response.should be_forbidden
|
418
|
-
end
|
419
|
-
end
|
420
|
-
|
421
|
-
describe "When logged in as User" do
|
422
|
-
login_user
|
423
|
-
|
424
|
-
it "destroys the requested form_of_work" do
|
425
|
-
delete :destroy, :id => @form_of_work.id
|
426
|
-
end
|
427
|
-
|
428
|
-
it "should be forbidden" do
|
429
|
-
delete :destroy, :id => @form_of_work.id
|
430
|
-
response.should be_forbidden
|
431
|
-
end
|
432
|
-
end
|
433
|
-
|
434
|
-
describe "When not logged in" do
|
435
|
-
it "destroys the requested form_of_work" do
|
436
|
-
delete :destroy, :id => @form_of_work.id
|
437
|
-
end
|
438
|
-
|
439
|
-
it "should be forbidden" do
|
440
|
-
delete :destroy, :id => @form_of_work.id
|
441
|
-
response.should redirect_to(new_user_session_url)
|
442
|
-
end
|
160
|
+
it "redirects to the form_of_works list" do
|
161
|
+
form_of_work = FormOfWork.create! valid_attributes
|
162
|
+
delete :destroy, :id => form_of_work.id
|
163
|
+
response.should redirect_to(form_of_works_url)
|
443
164
|
end
|
444
165
|
end
|
166
|
+
|
445
167
|
end
|