enju_biblio 0.1.0.pre56 → 0.1.0.pre57
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/agent_import_files_controller.rb +1 -1
- data/app/controllers/agent_import_results_controller.rb +30 -6
- data/app/controllers/agent_relationship_types_controller.rb +74 -4
- data/app/controllers/agent_relationships_controller.rb +92 -10
- data/app/controllers/agent_types_controller.rb +74 -3
- data/app/controllers/carrier_types_controller.rb +1 -1
- data/app/controllers/content_types_controller.rb +74 -4
- data/app/controllers/countries_controller.rb +66 -4
- data/app/controllers/create_types_controller.rb +74 -3
- data/app/controllers/extents_controller.rb +74 -4
- data/app/controllers/form_of_works_controller.rb +74 -4
- data/app/controllers/frequencies_controller.rb +74 -4
- data/app/controllers/identifier_types_controller.rb +4 -5
- data/app/controllers/import_requests_controller.rb +1 -1
- data/app/controllers/languages_controller.rb +66 -4
- data/app/controllers/licenses_controller.rb +74 -3
- data/app/controllers/manifestation_relationship_types_controller.rb +74 -3
- data/app/controllers/manifestation_relationships_controller.rb +92 -9
- data/app/controllers/medium_of_performances_controller.rb +74 -3
- data/app/controllers/picture_files_controller.rb +34 -10
- data/app/controllers/produce_types_controller.rb +74 -3
- data/app/controllers/realize_types_controller.rb +74 -3
- data/app/controllers/resource_import_files_controller.rb +2 -1
- data/app/controllers/resource_import_results_controller.rb +31 -11
- data/app/models/agent_import_file.rb +1 -1
- data/app/models/agent_import_result.rb +0 -2
- data/app/models/carrier_type.rb +1 -1
- data/app/models/identifier.rb +5 -0
- data/app/models/item.rb +1 -1
- data/app/models/manifestation.rb +13 -8
- data/app/models/resource_import_file.rb +73 -79
- data/app/views/agent_import_files/index.html.erb +1 -0
- data/app/views/agent_relationship_types/index.html.erb +5 -4
- data/app/views/agent_types/index.html.erb +5 -4
- data/app/views/carrier_types/index.html.erb +2 -1
- data/app/views/content_types/index.html.erb +1 -0
- data/app/views/countries/show.html.erb +5 -0
- data/app/views/create_types/index.html.erb +5 -4
- data/app/views/extents/index.html.erb +2 -1
- data/app/views/form_of_works/index.html.erb +2 -1
- data/app/views/frequencies/index.html.erb +2 -1
- data/app/views/identifier_types/index.html.erb +12 -5
- data/app/views/import_requests/index.html.erb +1 -0
- data/app/views/items/show.html.erb +3 -7
- data/app/views/languages/_form.html.erb +19 -4
- data/app/views/languages/index.html.erb +6 -5
- data/app/views/languages/show.html.erb +19 -4
- data/app/views/layouts/manifestations.html.erb +2 -1
- data/app/views/licenses/index.html.erb +2 -1
- data/app/views/manifestation_relationship_types/index.html.erb +5 -4
- data/app/views/manifestations/_call_number.html.erb +1 -1
- data/app/views/manifestations/_edit_detail.html.erb +4 -1
- data/app/views/manifestations/_form.html.erb +5 -5
- data/app/views/manifestations/_show_detail_librarian.html.erb +8 -3
- data/app/views/manifestations/_show_detail_user.html.erb +8 -3
- data/app/views/medium_of_performances/index.html.erb +2 -1
- data/app/views/notifier/manifestation_info.en.text.erb +1 -1
- data/app/views/notifier/manifestation_info.ja.text.erb +1 -1
- data/app/views/picture_files/_index.html.erb +1 -0
- data/app/views/picture_files/_index_agent.html.erb +1 -0
- data/app/views/picture_files/_index_manifestation.html.erb +1 -0
- data/app/views/picture_files/show.html.erb +15 -7
- data/app/views/produce_types/index.html.erb +5 -4
- data/app/views/realize_types/index.html.erb +5 -4
- data/app/views/resource_import_files/index.html.erb +1 -0
- data/app/views/series_statements/_index.html.erb +1 -0
- data/app/views/series_statements/_index_series_statement_merge_list.html.erb +1 -0
- data/config/locales/translation_en.yml +70 -1
- data/config/locales/translation_ja.yml +77 -8
- data/db/migrate/20140817155043_add_extent_of_text_to_manifestation.rb +5 -0
- data/lib/enju_biblio/biblio_helper.rb +13 -0
- data/lib/enju_biblio/engine.rb +0 -2
- data/lib/enju_biblio/version.rb +1 -1
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/content_types.yml +1 -1
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/identifier_types.yml +24 -3
- data/lib/tasks/enju_biblio_tasks.rake +2 -0
- data/lib/tasks/identifier_type.rb +12 -0
- data/lib/tasks/item.rb +1 -1
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_send_message_when_import_is_completed.yml +433 -0
- data/spec/controllers/agent_import_files_controller_spec.rb +35 -35
- data/spec/controllers/agent_import_results_controller_spec.rb +11 -11
- data/spec/controllers/agent_relationship_types_controller_spec.rb +51 -51
- data/spec/controllers/agent_relationships_controller_spec.rb +53 -53
- data/spec/controllers/agent_types_controller_spec.rb +15 -15
- data/spec/controllers/agents_controller_spec.rb +96 -96
- data/spec/controllers/carrier_types_controller_spec.rb +15 -15
- data/spec/controllers/content_types_controller_spec.rb +15 -15
- data/spec/controllers/countries_controller_spec.rb +25 -25
- data/spec/controllers/create_types_controller_spec.rb +15 -15
- data/spec/controllers/creates_controller_spec.rb +50 -50
- data/spec/controllers/donates_controller_spec.rb +49 -49
- data/spec/controllers/extents_controller_spec.rb +15 -15
- data/spec/controllers/form_of_works_controller_spec.rb +15 -15
- data/spec/controllers/frequencies_controller_spec.rb +6 -6
- data/spec/controllers/identifier_types_controller_spec.rb +15 -15
- data/spec/controllers/import_requests_controller_spec.rb +50 -50
- data/spec/controllers/items_controller_spec.rb +72 -72
- data/spec/controllers/languages_controller_spec.rb +18 -18
- data/spec/controllers/licenses_controller_spec.rb +15 -15
- data/spec/controllers/manifestation_relationship_types_controller_spec.rb +51 -51
- data/spec/controllers/manifestation_relationships_controller_spec.rb +53 -53
- data/spec/controllers/manifestations_controller_spec.rb +108 -108
- data/spec/controllers/medium_of_performances_controller_spec.rb +15 -15
- data/spec/controllers/owns_controller_spec.rb +52 -52
- data/spec/controllers/picture_files_controller_spec.rb +52 -52
- data/spec/controllers/produce_types_controller_spec.rb +15 -15
- data/spec/controllers/produces_controller_spec.rb +50 -50
- data/spec/controllers/realize_types_controller_spec.rb +15 -15
- data/spec/controllers/realizes_controller_spec.rb +51 -51
- data/spec/controllers/resource_export_files_controller_spec.rb +38 -38
- data/spec/controllers/resource_import_files_controller_spec.rb +38 -38
- data/spec/controllers/resource_import_results_controller_spec.rb +15 -15
- data/spec/controllers/series_statements_controller_spec.rb +54 -54
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +2 -3
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample1.tsv +19 -19
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample2.tsv +19 -19
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-53863-1jz1wlr.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-55246-1rvhs1s.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-60268-1psjqua.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-60996-1cy28m2.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-67507-19qjhj3.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-69234-1cllrec.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-76875-1os6joy.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-1148-136brhb.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-473-1c326dm.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-93795-1x882ik.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-94274-1xr9d9e.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-94643-1fjcept.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-97947-mfqh5b.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-98488-126cvb4.txt +147 -0
- data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-98849-1lg47mm.txt +147 -0
- data/spec/dummy/solr/test/data/index/segments.gen +0 -0
- data/spec/dummy/solr/test/data/index/segments_5ur +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007580 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007581 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007582 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007583 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007584 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007585 +0 -0
- data/spec/dummy/tmp/cache/ACB/B20/manifestation_search_total +0 -0
- data/spec/dummy/tmp/cache/stdout +2554 -0
- data/spec/dummy/tmp/pids/redis-test.pid +1 -1
- data/spec/fixtures/agent_import_results.yml +0 -3
- data/spec/fixtures/carrier_types.yml +16 -16
- data/spec/fixtures/content_types.yml +78 -29
- data/spec/fixtures/frequencies.yml +32 -62
- data/spec/fixtures/manifestations.yml +1 -1
- data/spec/models/agent_import_result_spec.rb +0 -2
- data/spec/models/manifestation_spec.rb +1 -1
- data/spec/models/resource_import_file_spec.rb +30 -3
- data/spec/views/manifestations/show.html.erb_spec.rb +1 -1
- metadata +68 -103
- data/app/views/picture_files/_index_event.html.erb +0 -53
- data/app/views/picture_files/_index_shelf.html.erb +0 -53
- data/db/migrate/20121116033446_add_doi_to_manifestation.rb +0 -6
- data/spec/dummy/solr/test/data/index/_20i.fdt +0 -0
- data/spec/dummy/solr/test/data/index/_20i.fdx +0 -0
- data/spec/dummy/solr/test/data/index/_20i.fnm +0 -0
- data/spec/dummy/solr/test/data/index/_20i.nvd +0 -0
- data/spec/dummy/solr/test/data/index/_20i.nvm +0 -0
- data/spec/dummy/solr/test/data/index/_20i.si +0 -0
- data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.doc +0 -0
- data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.pos +0 -0
- data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.tip +0 -0
- data/spec/dummy/solr/test/data/index/_20j.fdt +0 -0
- data/spec/dummy/solr/test/data/index/_20j.fdx +0 -0
- data/spec/dummy/solr/test/data/index/_20j.fnm +0 -0
- data/spec/dummy/solr/test/data/index/_20j.nvd +0 -0
- data/spec/dummy/solr/test/data/index/_20j.nvm +0 -0
- data/spec/dummy/solr/test/data/index/_20j.si +0 -0
- data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.doc +0 -0
- data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.pos +0 -0
- data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.tip +0 -0
- data/spec/dummy/solr/test/data/index/_20k.fdt +0 -0
- data/spec/dummy/solr/test/data/index/_20k.fdx +0 -0
- data/spec/dummy/solr/test/data/index/_20k.fnm +0 -0
- data/spec/dummy/solr/test/data/index/_20k.nvd +0 -0
- data/spec/dummy/solr/test/data/index/_20k.nvm +0 -0
- data/spec/dummy/solr/test/data/index/_20k.si +0 -0
- data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.doc +0 -0
- data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.pos +0 -0
- data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.tip +0 -0
- data/spec/dummy/solr/test/data/index/segments_2uc +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000003680 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000003681 +0 -0
- data/spec/dummy/solr/test/data/tlog/tlog.0000000000000003682 +0 -0
@@ -17,20 +17,20 @@ describe AgentsController do
|
|
17
17
|
|
18
18
|
it "assigns all agents as @agents" do
|
19
19
|
get :index
|
20
|
-
assigns(:agents).
|
20
|
+
expect(assigns(:agents)).not_to be_empty
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should get index with agent_id" do
|
24
24
|
get :index, :agent_id => 1
|
25
|
-
response.
|
26
|
-
assigns(:agent).
|
27
|
-
assigns(:agents).
|
25
|
+
expect(response).to be_success
|
26
|
+
expect(assigns(:agent)).to eq Agent.find(1)
|
27
|
+
expect(assigns(:agents)).to eq assigns(:agent).derived_agents.where('required_role_id >= 1').page(1)
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should get index with query" do
|
31
31
|
get :index, :query => 'Librarian1'
|
32
|
-
assigns(:agents).
|
33
|
-
response.
|
32
|
+
expect(assigns(:agents)).not_to be_empty
|
33
|
+
expect(response).to be_success
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -39,7 +39,7 @@ describe AgentsController do
|
|
39
39
|
|
40
40
|
it "assigns all agents as @agents" do
|
41
41
|
get :index
|
42
|
-
assigns(:agents).
|
42
|
+
expect(assigns(:agents)).not_to be_empty
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -48,43 +48,43 @@ describe AgentsController do
|
|
48
48
|
|
49
49
|
it "assigns all agents as @agents" do
|
50
50
|
get :index
|
51
|
-
assigns(:agents).
|
51
|
+
expect(assigns(:agents)).not_to be_empty
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
describe "When not logged in" do
|
56
56
|
it "assigns all agents as @agents" do
|
57
57
|
get :index
|
58
|
-
assigns(:agents).
|
58
|
+
expect(assigns(:agents)).not_to be_empty
|
59
59
|
end
|
60
60
|
|
61
61
|
it "assigns all agents as @agents in rss format" do
|
62
62
|
get :index, :format => :rss
|
63
|
-
assigns(:agents).
|
63
|
+
expect(assigns(:agents)).not_to be_empty
|
64
64
|
end
|
65
65
|
|
66
66
|
it "assigns all agents as @agents in atom format" do
|
67
67
|
get :index, :format => :atom
|
68
|
-
assigns(:agents).
|
68
|
+
expect(assigns(:agents)).not_to be_empty
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should get index with agent_id" do
|
72
72
|
get :index, :agent_id => 1
|
73
|
-
response.
|
74
|
-
assigns(:agent).
|
75
|
-
assigns(:agents).
|
73
|
+
expect(response).to be_success
|
74
|
+
expect(assigns(:agent)).to eq Agent.find(1)
|
75
|
+
expect(assigns(:agents)).to eq assigns(:agent).derived_agents.where(:required_role_id => 1).page(1)
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should get index with manifestation_id" do
|
79
79
|
get :index, :manifestation_id => 1
|
80
80
|
assigns(:manifestation).should eq Manifestation.find(1)
|
81
|
-
assigns(:agents).
|
81
|
+
expect(assigns(:agents)).to eq assigns(:manifestation).publishers.where(:required_role_id => 1).page(1)
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should get index with query" do
|
85
85
|
get :index, :query => 'Librarian1'
|
86
|
-
assigns(:agents).
|
87
|
-
response.
|
86
|
+
expect(assigns(:agents)).to be_empty
|
87
|
+
expect(response).to be_success
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
@@ -99,7 +99,7 @@ describe AgentsController do
|
|
99
99
|
|
100
100
|
it "assigns the requested agent as @agent" do
|
101
101
|
get :show, :id => @agent.id
|
102
|
-
assigns(:agent).
|
102
|
+
expect(assigns(:agent)).to eq(@agent)
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
@@ -108,39 +108,39 @@ describe AgentsController do
|
|
108
108
|
|
109
109
|
it "assigns the requested agent as @agent" do
|
110
110
|
get :show, :id => @agent.id
|
111
|
-
assigns(:agent).
|
111
|
+
expect(assigns(:agent)).to eq(@agent)
|
112
112
|
end
|
113
113
|
|
114
114
|
#it "should show agent when required_role is user" do
|
115
115
|
# get :show, :id => users(:user2).agent.id
|
116
|
-
# assigns(:agent).
|
117
|
-
# response.
|
116
|
+
# expect(assigns(:agent)).to eq(users(:user2).agent)
|
117
|
+
# expect(response).to be_success
|
118
118
|
#end
|
119
119
|
|
120
120
|
#it "should show_ atron when required_role is librarian" do
|
121
121
|
# get :show, :id => users(:user1).agent.id
|
122
|
-
# assigns(:agent).
|
123
|
-
# response.
|
122
|
+
# expect(assigns(:agent)).to eq(users(:user1).agent)
|
123
|
+
# expect(response).to be_success
|
124
124
|
#end
|
125
125
|
|
126
126
|
it "should not show agent who does not create a work" do
|
127
127
|
lambda{
|
128
128
|
get :show, :id => 3, :work_id => 3
|
129
129
|
}.should raise_error(ActiveRecord::RecordNotFound)
|
130
|
-
#response.
|
130
|
+
#expect(response).to be_missing
|
131
131
|
end
|
132
132
|
|
133
133
|
it "should not show agent who does not produce a manifestation" do
|
134
134
|
lambda{
|
135
135
|
get :show, :id => 4, :manifestation_id => 4
|
136
136
|
}.should raise_error(ActiveRecord::RecordNotFound)
|
137
|
-
#response.
|
137
|
+
#expect(response).to be_missing
|
138
138
|
end
|
139
139
|
|
140
140
|
#it "should not show agent when required_role is 'Administrator'" do
|
141
141
|
# sign_in users(:librarian2)
|
142
142
|
# get :show, :id => users(:librarian1).agent.id
|
143
|
-
# response.
|
143
|
+
# expect(response).to be_forbidden
|
144
144
|
#end
|
145
145
|
end
|
146
146
|
|
@@ -149,41 +149,41 @@ describe AgentsController do
|
|
149
149
|
|
150
150
|
it "assigns the requested agent as @agent" do
|
151
151
|
get :show, :id => @agent.id
|
152
|
-
assigns(:agent).
|
152
|
+
expect(assigns(:agent)).to eq(@agent)
|
153
153
|
end
|
154
154
|
|
155
155
|
#it "should show user" do
|
156
156
|
# get :show, :id => users(:user2).agent.id
|
157
157
|
# assigns(:agent).required_role.name.should eq 'User'
|
158
|
-
# response.
|
158
|
+
# expect(response).to be_success
|
159
159
|
#end
|
160
160
|
|
161
161
|
#it "should not show agent when required_role is 'Librarian'" do
|
162
162
|
# sign_in users(:user2)
|
163
163
|
# get :show, :id => users(:user1).agent.id
|
164
|
-
# response.
|
164
|
+
# expect(response).to be_forbidden
|
165
165
|
#end
|
166
166
|
end
|
167
167
|
|
168
168
|
describe "When not logged in" do
|
169
169
|
it "assigns the requested agent as @agent" do
|
170
170
|
get :show, :id => @agent.id
|
171
|
-
assigns(:agent).
|
171
|
+
expect(assigns(:agent)).to eq(@agent)
|
172
172
|
end
|
173
173
|
|
174
174
|
it "should show agent with work" do
|
175
175
|
get :show, :id => 1, :work_id => 1
|
176
|
-
assigns(:agent).
|
176
|
+
expect(assigns(:agent)).to eq assigns(:work).creators.first
|
177
177
|
end
|
178
178
|
|
179
179
|
it "should show agent with manifestation" do
|
180
180
|
get :show, :id => 1, :manifestation_id => 1
|
181
|
-
assigns(:agent).
|
181
|
+
expect(assigns(:agent)).to eq assigns(:manifestation).publishers.first
|
182
182
|
end
|
183
183
|
|
184
184
|
it "should not show agent when required_role is 'User'" do
|
185
185
|
get :show, :id => 5
|
186
|
-
response.
|
186
|
+
expect(response).to redirect_to new_user_session_url
|
187
187
|
end
|
188
188
|
end
|
189
189
|
end
|
@@ -194,7 +194,7 @@ describe AgentsController do
|
|
194
194
|
|
195
195
|
it "assigns the requested agent as @agent" do
|
196
196
|
get :new
|
197
|
-
assigns(:agent).
|
197
|
+
expect(assigns(:agent)).not_to be_valid
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|
@@ -203,7 +203,7 @@ describe AgentsController do
|
|
203
203
|
|
204
204
|
it "assigns the requested agent as @agent" do
|
205
205
|
get :new
|
206
|
-
assigns(:agent).
|
206
|
+
expect(assigns(:agent)).not_to be_valid
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
@@ -212,16 +212,16 @@ describe AgentsController do
|
|
212
212
|
|
213
213
|
it "should not assign the requested agent as @agent" do
|
214
214
|
get :new
|
215
|
-
assigns(:agent).
|
216
|
-
response.
|
215
|
+
expect(assigns(:agent)).not_to be_valid
|
216
|
+
expect(response).to be_forbidden
|
217
217
|
end
|
218
218
|
end
|
219
219
|
|
220
220
|
describe "When not logged in" do
|
221
221
|
it "should not assign the requested agent as @agent" do
|
222
222
|
get :new
|
223
|
-
assigns(:agent).
|
224
|
-
response.
|
223
|
+
expect(assigns(:agent)).not_to be_valid
|
224
|
+
expect(response).to redirect_to(new_user_session_url)
|
225
225
|
end
|
226
226
|
end
|
227
227
|
end
|
@@ -233,7 +233,7 @@ describe AgentsController do
|
|
233
233
|
it "assigns the requested agent as @agent" do
|
234
234
|
agent = Agent.find(1)
|
235
235
|
get :edit, :id => agent.id
|
236
|
-
assigns(:agent).
|
236
|
+
expect(assigns(:agent)).to eq(agent)
|
237
237
|
end
|
238
238
|
end
|
239
239
|
|
@@ -243,22 +243,22 @@ describe AgentsController do
|
|
243
243
|
it "assigns the requested agent as @agent" do
|
244
244
|
agent = Agent.find(1)
|
245
245
|
get :edit, :id => agent.id
|
246
|
-
assigns(:agent).
|
246
|
+
expect(assigns(:agent)).to eq(agent)
|
247
247
|
end
|
248
248
|
|
249
249
|
#it "should edit agent when its required_role is 'User'" do
|
250
250
|
# get :edit, :id => users(:user2).agent.id
|
251
|
-
# response.
|
251
|
+
# expect(response).to be_success
|
252
252
|
#end
|
253
253
|
|
254
254
|
#it "should edit agent when its required_role is 'Librarian'" do
|
255
255
|
# get :edit, :id => users(:user1).agent.id
|
256
|
-
# response.
|
256
|
+
# expect(response).to be_success
|
257
257
|
#end
|
258
258
|
|
259
259
|
#it "should edit admin" do
|
260
260
|
# get :edit, :id => users(:admin).agent.id
|
261
|
-
# response.
|
261
|
+
# expect(response).to be_forbidden
|
262
262
|
#end
|
263
263
|
end
|
264
264
|
|
@@ -268,17 +268,17 @@ describe AgentsController do
|
|
268
268
|
it "assigns the requested agent as @agent" do
|
269
269
|
agent = Agent.find(1)
|
270
270
|
get :edit, :id => agent.id
|
271
|
-
response.
|
271
|
+
expect(response).to be_forbidden
|
272
272
|
end
|
273
273
|
|
274
274
|
#it "should edit myself" do
|
275
275
|
# get :edit, :id => users(:user1).agent.id
|
276
|
-
# response.
|
276
|
+
# expect(response).to be_success
|
277
277
|
#end
|
278
278
|
|
279
279
|
#it "should not edit other user's agent profile" do
|
280
280
|
# get :edit, :id => users(:user2).agent.id
|
281
|
-
# response.
|
281
|
+
# expect(response).to be_forbidden
|
282
282
|
#end
|
283
283
|
end
|
284
284
|
|
@@ -286,7 +286,7 @@ describe AgentsController do
|
|
286
286
|
it "should not assign the requested agent as @agent" do
|
287
287
|
agent = Agent.find(1)
|
288
288
|
get :edit, :id => agent.id
|
289
|
-
response.
|
289
|
+
expect(response).to redirect_to(new_user_session_url)
|
290
290
|
end
|
291
291
|
end
|
292
292
|
end
|
@@ -303,24 +303,24 @@ describe AgentsController do
|
|
303
303
|
describe "with valid params" do
|
304
304
|
it "assigns a newly created agent as @agent" do
|
305
305
|
post :create, :agent => @attrs
|
306
|
-
assigns(:agent).
|
306
|
+
expect(assigns(:agent)).to be_valid
|
307
307
|
end
|
308
308
|
|
309
309
|
it "redirects to the created agent" do
|
310
310
|
post :create, :agent => @attrs
|
311
|
-
response.
|
311
|
+
expect(response).to redirect_to(agent_url(assigns(:agent)))
|
312
312
|
end
|
313
313
|
end
|
314
314
|
|
315
315
|
describe "with invalid params" do
|
316
316
|
it "assigns a newly created but unsaved agent as @agent" do
|
317
317
|
post :create, :agent => @invalid_attrs
|
318
|
-
assigns(:agent).
|
318
|
+
expect(assigns(:agent)).not_to be_valid
|
319
319
|
end
|
320
320
|
|
321
321
|
it "re-renders the 'new' template" do
|
322
322
|
post :create, :agent => @invalid_attrs
|
323
|
-
response.
|
323
|
+
expect(response).to render_template("new")
|
324
324
|
end
|
325
325
|
end
|
326
326
|
end
|
@@ -331,29 +331,29 @@ describe AgentsController do
|
|
331
331
|
describe "with valid params" do
|
332
332
|
it "assigns a newly created agent as @agent" do
|
333
333
|
post :create, :agent => @attrs
|
334
|
-
assigns(:agent).
|
334
|
+
expect(assigns(:agent)).to be_valid
|
335
335
|
end
|
336
336
|
|
337
337
|
it "redirects to the created agent" do
|
338
338
|
post :create, :agent => @attrs
|
339
|
-
response.
|
339
|
+
expect(response).to redirect_to(agent_url(assigns(:agent)))
|
340
340
|
end
|
341
341
|
|
342
342
|
it "should create a relationship if work_id is set" do
|
343
343
|
post :create, :agent => @attrs, :work_id => 1
|
344
|
-
response.
|
344
|
+
expect(response).to redirect_to(agent_url(assigns(:agent)))
|
345
345
|
assigns(:agent).works.should eq [Manifestation.find(1)]
|
346
346
|
end
|
347
347
|
|
348
348
|
it "should create a relationship if manifestation_id is set" do
|
349
349
|
post :create, :agent => @attrs, :manifestation_id => 1
|
350
|
-
response.
|
350
|
+
expect(response).to redirect_to(agent_url(assigns(:agent)))
|
351
351
|
assigns(:agent).manifestations.should eq [Manifestation.find(1)]
|
352
352
|
end
|
353
353
|
|
354
354
|
it "should create a relationship if item_id is set" do
|
355
355
|
post :create, :agent => @attrs, :item_id => 1
|
356
|
-
response.
|
356
|
+
expect(response).to redirect_to(agent_url(assigns(:agent)))
|
357
357
|
assigns(:agent).items.should eq [Item.find(1)]
|
358
358
|
end
|
359
359
|
end
|
@@ -361,19 +361,19 @@ describe AgentsController do
|
|
361
361
|
describe "with invalid params" do
|
362
362
|
it "assigns a newly created but unsaved agent as @agent" do
|
363
363
|
post :create, :agent => @invalid_attrs
|
364
|
-
assigns(:agent).
|
364
|
+
expect(assigns(:agent)).not_to be_valid
|
365
365
|
end
|
366
366
|
|
367
367
|
it "re-renders the 'new' template" do
|
368
368
|
post :create, :agent => @invalid_attrs
|
369
|
-
response.
|
369
|
+
expect(response).to render_template("new")
|
370
370
|
end
|
371
371
|
end
|
372
372
|
|
373
373
|
# TODO: full_name以外での判断
|
374
374
|
it "should create agent without full_name" do
|
375
375
|
post :create, :agent => { :first_name => 'test' }
|
376
|
-
response.
|
376
|
+
expect(response).to redirect_to agent_url(assigns(:agent))
|
377
377
|
end
|
378
378
|
end
|
379
379
|
|
@@ -383,36 +383,36 @@ describe AgentsController do
|
|
383
383
|
describe "with valid params" do
|
384
384
|
it "assigns a newly created agent as @agent" do
|
385
385
|
post :create, :agent => @attrs
|
386
|
-
assigns(:agent).
|
386
|
+
expect(assigns(:agent)).to be_valid
|
387
387
|
end
|
388
388
|
|
389
389
|
it "should be forbidden" do
|
390
390
|
post :create, :agent => @attrs
|
391
|
-
response.
|
391
|
+
expect(response).to be_forbidden
|
392
392
|
end
|
393
393
|
end
|
394
394
|
|
395
395
|
describe "with invalid params" do
|
396
396
|
it "assigns a newly created but unsaved agent as @agent" do
|
397
397
|
post :create, :agent => @invalid_attrs
|
398
|
-
assigns(:agent).
|
398
|
+
expect(assigns(:agent)).not_to be_valid
|
399
399
|
end
|
400
400
|
|
401
401
|
it "should be forbidden" do
|
402
402
|
post :create, :agent => @invalid_attrs
|
403
|
-
response.
|
403
|
+
expect(response).to be_forbidden
|
404
404
|
end
|
405
405
|
end
|
406
406
|
|
407
407
|
#it "should not create agent myself" do
|
408
408
|
# post :create, :agent => { :full_name => 'test', :user_username => users(:user1).username }
|
409
|
-
# assigns(:agent).
|
410
|
-
# response.
|
409
|
+
# expect(assigns(:agent)).not_to be_valid
|
410
|
+
# expect(response).to be_success
|
411
411
|
#end
|
412
412
|
|
413
413
|
#it "should not create other agent" do
|
414
414
|
# post :create, :agent => { :full_name => 'test', :user_id => users(:user2).username }
|
415
|
-
# response.
|
415
|
+
# expect(response).to be_forbidden
|
416
416
|
#end
|
417
417
|
end
|
418
418
|
|
@@ -420,24 +420,24 @@ describe AgentsController do
|
|
420
420
|
describe "with valid params" do
|
421
421
|
it "assigns a newly created agent as @agent" do
|
422
422
|
post :create, :agent => @attrs
|
423
|
-
assigns(:agent).
|
423
|
+
expect(assigns(:agent)).to be_valid
|
424
424
|
end
|
425
425
|
|
426
426
|
it "should be forbidden" do
|
427
427
|
post :create, :agent => @attrs
|
428
|
-
response.
|
428
|
+
expect(response).to redirect_to(new_user_session_url)
|
429
429
|
end
|
430
430
|
end
|
431
431
|
|
432
432
|
describe "with invalid params" do
|
433
433
|
it "assigns a newly created but unsaved agent as @agent" do
|
434
434
|
post :create, :agent => @invalid_attrs
|
435
|
-
assigns(:agent).
|
435
|
+
expect(assigns(:agent)).not_to be_valid
|
436
436
|
end
|
437
437
|
|
438
438
|
it "should be forbidden" do
|
439
439
|
post :create, :agent => @invalid_attrs
|
440
|
-
response.
|
440
|
+
expect(response).to redirect_to(new_user_session_url)
|
441
441
|
end
|
442
442
|
end
|
443
443
|
end
|
@@ -460,14 +460,14 @@ describe AgentsController do
|
|
460
460
|
|
461
461
|
it "assigns the requested agent as @agent" do
|
462
462
|
put :update, :id => @agent.id, :agent => @attrs
|
463
|
-
assigns(:agent).
|
463
|
+
expect(assigns(:agent)).to eq(@agent)
|
464
464
|
end
|
465
465
|
end
|
466
466
|
|
467
467
|
describe "with invalid params" do
|
468
468
|
it "assigns the requested agent as @agent" do
|
469
469
|
put :update, :id => @agent.id, :agent => @invalid_attrs
|
470
|
-
response.
|
470
|
+
expect(response).to render_template("edit")
|
471
471
|
end
|
472
472
|
end
|
473
473
|
end
|
@@ -482,26 +482,26 @@ describe AgentsController do
|
|
482
482
|
|
483
483
|
it "assigns the requested agent as @agent" do
|
484
484
|
put :update, :id => @agent.id, :agent => @attrs
|
485
|
-
assigns(:agent).
|
486
|
-
response.
|
485
|
+
expect(assigns(:agent)).to eq(@agent)
|
486
|
+
expect(response).to redirect_to(@agent)
|
487
487
|
end
|
488
488
|
end
|
489
489
|
|
490
490
|
describe "with invalid params" do
|
491
491
|
it "assigns the agent as @agent" do
|
492
492
|
put :update, :id => @agent, :agent => @invalid_attrs
|
493
|
-
assigns(:agent).
|
493
|
+
expect(assigns(:agent)).not_to be_valid
|
494
494
|
end
|
495
495
|
|
496
496
|
it "re-renders the 'edit' template" do
|
497
497
|
put :update, :id => @agent, :agent => @invalid_attrs
|
498
|
-
response.
|
498
|
+
expect(response).to render_template("edit")
|
499
499
|
end
|
500
500
|
end
|
501
501
|
|
502
502
|
#it "should update other agent" do
|
503
503
|
# put :update, :id => users(:user2).agent.id, :agent => { :full_name => 'test' }
|
504
|
-
# response.
|
504
|
+
# expect(response).to redirect_to agent_url(assigns(:agent))
|
505
505
|
#end
|
506
506
|
end
|
507
507
|
|
@@ -515,33 +515,33 @@ describe AgentsController do
|
|
515
515
|
|
516
516
|
it "assigns the requested agent as @agent" do
|
517
517
|
put :update, :id => @agent.id, :agent => @attrs
|
518
|
-
assigns(:agent).
|
519
|
-
response.
|
518
|
+
expect(assigns(:agent)).to eq(@agent)
|
519
|
+
expect(response).to be_forbidden
|
520
520
|
end
|
521
521
|
end
|
522
522
|
|
523
523
|
describe "with invalid params" do
|
524
524
|
it "assigns the requested agent as @agent" do
|
525
525
|
put :update, :id => @agent.id, :agent => @invalid_attrs
|
526
|
-
response.
|
526
|
+
expect(response).to be_forbidden
|
527
527
|
end
|
528
528
|
end
|
529
529
|
|
530
530
|
#it "should update myself" do
|
531
531
|
# put :update, :id => users(:user1).agent.id, :agent => { :full_name => 'test' }
|
532
|
-
# assigns(:agent).
|
533
|
-
# response.
|
532
|
+
# expect(assigns(:agent)).to be_valid
|
533
|
+
# expect(response).to redirect_to agent_url(assigns(:agent))
|
534
534
|
#end
|
535
535
|
|
536
536
|
#it "should not update myself without name" do
|
537
537
|
# put :update, :id => users(:user1).agent.id, :agent => { :first_name => '', :last_name => '', :full_name => '' }
|
538
|
-
# assigns(:agent).
|
539
|
-
# response.
|
538
|
+
# expect(assigns(:agent)).not_to be_valid
|
539
|
+
# expect(response).to be_success
|
540
540
|
#end
|
541
541
|
|
542
542
|
#it "should not update other agent" do
|
543
543
|
# put :update, :id => users(:user2).agent.id, :agent => { :full_name => 'test' }
|
544
|
-
# response.
|
544
|
+
# expect(response).to be_forbidden
|
545
545
|
#end
|
546
546
|
end
|
547
547
|
|
@@ -553,14 +553,14 @@ describe AgentsController do
|
|
553
553
|
|
554
554
|
it "should be forbidden" do
|
555
555
|
put :update, :id => @agent.id, :agent => @attrs
|
556
|
-
response.
|
556
|
+
expect(response).to redirect_to(new_user_session_url)
|
557
557
|
end
|
558
558
|
end
|
559
559
|
|
560
560
|
describe "with invalid params" do
|
561
561
|
it "assigns the requested agent as @agent" do
|
562
562
|
put :update, :id => @agent.id, :agent => @invalid_attrs
|
563
|
-
response.
|
563
|
+
expect(response).to redirect_to(new_user_session_url)
|
564
564
|
end
|
565
565
|
end
|
566
566
|
end
|
@@ -580,17 +580,17 @@ describe AgentsController do
|
|
580
580
|
|
581
581
|
it "redirects to the agents list" do
|
582
582
|
delete :destroy, :id => @agent.id
|
583
|
-
response.
|
583
|
+
expect(response).to redirect_to(agents_url)
|
584
584
|
end
|
585
585
|
|
586
586
|
#it "should not destroy librarian who has items checked out" do
|
587
587
|
# delete :destroy, :id => users(:librarian1).agent.id
|
588
|
-
# response.
|
588
|
+
# expect(response).to be_forbidden
|
589
589
|
#end
|
590
590
|
|
591
591
|
#it "should destroy librarian who does not have items checked out" do
|
592
592
|
# delete :destroy, :id => users(:librarian2).agent.id
|
593
|
-
# response.
|
593
|
+
# expect(response).to redirect_to agents_url
|
594
594
|
#end
|
595
595
|
end
|
596
596
|
|
@@ -603,12 +603,12 @@ describe AgentsController do
|
|
603
603
|
|
604
604
|
it "redirects to the agents list" do
|
605
605
|
delete :destroy, :id => @agent.id
|
606
|
-
response.
|
606
|
+
expect(response).to redirect_to(agents_url)
|
607
607
|
end
|
608
608
|
|
609
609
|
#it "should not destroy librarian" do
|
610
610
|
# delete :destroy, :id => users(:librarian2).agent.id
|
611
|
-
# response.
|
611
|
+
# expect(response).to be_forbidden
|
612
612
|
#end
|
613
613
|
end
|
614
614
|
|
@@ -621,12 +621,12 @@ describe AgentsController do
|
|
621
621
|
|
622
622
|
it "should be forbidden" do
|
623
623
|
delete :destroy, :id => @agent.id
|
624
|
-
response.
|
624
|
+
expect(response).to be_forbidden
|
625
625
|
end
|
626
626
|
|
627
627
|
#it "should not destroy agent" do
|
628
628
|
# delete :destroy, :id => users(:user1).agent.id
|
629
|
-
# response.
|
629
|
+
# expect(response).to be_forbidden
|
630
630
|
#end
|
631
631
|
end
|
632
632
|
|
@@ -637,7 +637,7 @@ describe AgentsController do
|
|
637
637
|
|
638
638
|
it "should be forbidden" do
|
639
639
|
delete :destroy, :id => @agent.id
|
640
|
-
response.
|
640
|
+
expect(response).to redirect_to(new_user_session_url)
|
641
641
|
end
|
642
642
|
end
|
643
643
|
end
|