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.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/agent_import_files_controller.rb +1 -1
  3. data/app/controllers/agent_import_results_controller.rb +30 -6
  4. data/app/controllers/agent_relationship_types_controller.rb +74 -4
  5. data/app/controllers/agent_relationships_controller.rb +92 -10
  6. data/app/controllers/agent_types_controller.rb +74 -3
  7. data/app/controllers/carrier_types_controller.rb +1 -1
  8. data/app/controllers/content_types_controller.rb +74 -4
  9. data/app/controllers/countries_controller.rb +66 -4
  10. data/app/controllers/create_types_controller.rb +74 -3
  11. data/app/controllers/extents_controller.rb +74 -4
  12. data/app/controllers/form_of_works_controller.rb +74 -4
  13. data/app/controllers/frequencies_controller.rb +74 -4
  14. data/app/controllers/identifier_types_controller.rb +4 -5
  15. data/app/controllers/import_requests_controller.rb +1 -1
  16. data/app/controllers/languages_controller.rb +66 -4
  17. data/app/controllers/licenses_controller.rb +74 -3
  18. data/app/controllers/manifestation_relationship_types_controller.rb +74 -3
  19. data/app/controllers/manifestation_relationships_controller.rb +92 -9
  20. data/app/controllers/medium_of_performances_controller.rb +74 -3
  21. data/app/controllers/picture_files_controller.rb +34 -10
  22. data/app/controllers/produce_types_controller.rb +74 -3
  23. data/app/controllers/realize_types_controller.rb +74 -3
  24. data/app/controllers/resource_import_files_controller.rb +2 -1
  25. data/app/controllers/resource_import_results_controller.rb +31 -11
  26. data/app/models/agent_import_file.rb +1 -1
  27. data/app/models/agent_import_result.rb +0 -2
  28. data/app/models/carrier_type.rb +1 -1
  29. data/app/models/identifier.rb +5 -0
  30. data/app/models/item.rb +1 -1
  31. data/app/models/manifestation.rb +13 -8
  32. data/app/models/resource_import_file.rb +73 -79
  33. data/app/views/agent_import_files/index.html.erb +1 -0
  34. data/app/views/agent_relationship_types/index.html.erb +5 -4
  35. data/app/views/agent_types/index.html.erb +5 -4
  36. data/app/views/carrier_types/index.html.erb +2 -1
  37. data/app/views/content_types/index.html.erb +1 -0
  38. data/app/views/countries/show.html.erb +5 -0
  39. data/app/views/create_types/index.html.erb +5 -4
  40. data/app/views/extents/index.html.erb +2 -1
  41. data/app/views/form_of_works/index.html.erb +2 -1
  42. data/app/views/frequencies/index.html.erb +2 -1
  43. data/app/views/identifier_types/index.html.erb +12 -5
  44. data/app/views/import_requests/index.html.erb +1 -0
  45. data/app/views/items/show.html.erb +3 -7
  46. data/app/views/languages/_form.html.erb +19 -4
  47. data/app/views/languages/index.html.erb +6 -5
  48. data/app/views/languages/show.html.erb +19 -4
  49. data/app/views/layouts/manifestations.html.erb +2 -1
  50. data/app/views/licenses/index.html.erb +2 -1
  51. data/app/views/manifestation_relationship_types/index.html.erb +5 -4
  52. data/app/views/manifestations/_call_number.html.erb +1 -1
  53. data/app/views/manifestations/_edit_detail.html.erb +4 -1
  54. data/app/views/manifestations/_form.html.erb +5 -5
  55. data/app/views/manifestations/_show_detail_librarian.html.erb +8 -3
  56. data/app/views/manifestations/_show_detail_user.html.erb +8 -3
  57. data/app/views/medium_of_performances/index.html.erb +2 -1
  58. data/app/views/notifier/manifestation_info.en.text.erb +1 -1
  59. data/app/views/notifier/manifestation_info.ja.text.erb +1 -1
  60. data/app/views/picture_files/_index.html.erb +1 -0
  61. data/app/views/picture_files/_index_agent.html.erb +1 -0
  62. data/app/views/picture_files/_index_manifestation.html.erb +1 -0
  63. data/app/views/picture_files/show.html.erb +15 -7
  64. data/app/views/produce_types/index.html.erb +5 -4
  65. data/app/views/realize_types/index.html.erb +5 -4
  66. data/app/views/resource_import_files/index.html.erb +1 -0
  67. data/app/views/series_statements/_index.html.erb +1 -0
  68. data/app/views/series_statements/_index_series_statement_merge_list.html.erb +1 -0
  69. data/config/locales/translation_en.yml +70 -1
  70. data/config/locales/translation_ja.yml +77 -8
  71. data/db/migrate/20140817155043_add_extent_of_text_to_manifestation.rb +5 -0
  72. data/lib/enju_biblio/biblio_helper.rb +13 -0
  73. data/lib/enju_biblio/engine.rb +0 -2
  74. data/lib/enju_biblio/version.rb +1 -1
  75. data/lib/generators/enju_biblio/setup/templates/db/fixtures/content_types.yml +1 -1
  76. data/lib/generators/enju_biblio/setup/templates/db/fixtures/identifier_types.yml +24 -3
  77. data/lib/tasks/enju_biblio_tasks.rake +2 -0
  78. data/lib/tasks/identifier_type.rb +12 -0
  79. data/lib/tasks/item.rb +1 -1
  80. 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
  81. data/spec/controllers/agent_import_files_controller_spec.rb +35 -35
  82. data/spec/controllers/agent_import_results_controller_spec.rb +11 -11
  83. data/spec/controllers/agent_relationship_types_controller_spec.rb +51 -51
  84. data/spec/controllers/agent_relationships_controller_spec.rb +53 -53
  85. data/spec/controllers/agent_types_controller_spec.rb +15 -15
  86. data/spec/controllers/agents_controller_spec.rb +96 -96
  87. data/spec/controllers/carrier_types_controller_spec.rb +15 -15
  88. data/spec/controllers/content_types_controller_spec.rb +15 -15
  89. data/spec/controllers/countries_controller_spec.rb +25 -25
  90. data/spec/controllers/create_types_controller_spec.rb +15 -15
  91. data/spec/controllers/creates_controller_spec.rb +50 -50
  92. data/spec/controllers/donates_controller_spec.rb +49 -49
  93. data/spec/controllers/extents_controller_spec.rb +15 -15
  94. data/spec/controllers/form_of_works_controller_spec.rb +15 -15
  95. data/spec/controllers/frequencies_controller_spec.rb +6 -6
  96. data/spec/controllers/identifier_types_controller_spec.rb +15 -15
  97. data/spec/controllers/import_requests_controller_spec.rb +50 -50
  98. data/spec/controllers/items_controller_spec.rb +72 -72
  99. data/spec/controllers/languages_controller_spec.rb +18 -18
  100. data/spec/controllers/licenses_controller_spec.rb +15 -15
  101. data/spec/controllers/manifestation_relationship_types_controller_spec.rb +51 -51
  102. data/spec/controllers/manifestation_relationships_controller_spec.rb +53 -53
  103. data/spec/controllers/manifestations_controller_spec.rb +108 -108
  104. data/spec/controllers/medium_of_performances_controller_spec.rb +15 -15
  105. data/spec/controllers/owns_controller_spec.rb +52 -52
  106. data/spec/controllers/picture_files_controller_spec.rb +52 -52
  107. data/spec/controllers/produce_types_controller_spec.rb +15 -15
  108. data/spec/controllers/produces_controller_spec.rb +50 -50
  109. data/spec/controllers/realize_types_controller_spec.rb +15 -15
  110. data/spec/controllers/realizes_controller_spec.rb +51 -51
  111. data/spec/controllers/resource_export_files_controller_spec.rb +38 -38
  112. data/spec/controllers/resource_import_files_controller_spec.rb +38 -38
  113. data/spec/controllers/resource_import_results_controller_spec.rb +15 -15
  114. data/spec/controllers/series_statements_controller_spec.rb +54 -54
  115. data/spec/dummy/db/development.sqlite3 +0 -0
  116. data/spec/dummy/db/schema.rb +2 -3
  117. data/spec/dummy/db/test.sqlite3 +0 -0
  118. data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample1.tsv +19 -19
  119. data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample2.tsv +19 -19
  120. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-53863-1jz1wlr.txt +147 -0
  121. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-55246-1rvhs1s.txt +147 -0
  122. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-60268-1psjqua.txt +147 -0
  123. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-60996-1cy28m2.txt +147 -0
  124. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-67507-19qjhj3.txt +147 -0
  125. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-69234-1cllrec.txt +147 -0
  126. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140818-76875-1os6joy.txt +147 -0
  127. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-1148-136brhb.txt +147 -0
  128. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-473-1c326dm.txt +147 -0
  129. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-93795-1x882ik.txt +147 -0
  130. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-94274-1xr9d9e.txt +147 -0
  131. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-94643-1fjcept.txt +147 -0
  132. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-97947-mfqh5b.txt +147 -0
  133. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-98488-126cvb4.txt +147 -0
  134. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140819-98849-1lg47mm.txt +147 -0
  135. data/spec/dummy/solr/test/data/index/segments.gen +0 -0
  136. data/spec/dummy/solr/test/data/index/segments_5ur +0 -0
  137. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007580 +0 -0
  138. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007581 +0 -0
  139. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007582 +0 -0
  140. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007583 +0 -0
  141. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007584 +0 -0
  142. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000007585 +0 -0
  143. data/spec/dummy/tmp/cache/ACB/B20/manifestation_search_total +0 -0
  144. data/spec/dummy/tmp/cache/stdout +2554 -0
  145. data/spec/dummy/tmp/pids/redis-test.pid +1 -1
  146. data/spec/fixtures/agent_import_results.yml +0 -3
  147. data/spec/fixtures/carrier_types.yml +16 -16
  148. data/spec/fixtures/content_types.yml +78 -29
  149. data/spec/fixtures/frequencies.yml +32 -62
  150. data/spec/fixtures/manifestations.yml +1 -1
  151. data/spec/models/agent_import_result_spec.rb +0 -2
  152. data/spec/models/manifestation_spec.rb +1 -1
  153. data/spec/models/resource_import_file_spec.rb +30 -3
  154. data/spec/views/manifestations/show.html.erb_spec.rb +1 -1
  155. metadata +68 -103
  156. data/app/views/picture_files/_index_event.html.erb +0 -53
  157. data/app/views/picture_files/_index_shelf.html.erb +0 -53
  158. data/db/migrate/20121116033446_add_doi_to_manifestation.rb +0 -6
  159. data/spec/dummy/solr/test/data/index/_20i.fdt +0 -0
  160. data/spec/dummy/solr/test/data/index/_20i.fdx +0 -0
  161. data/spec/dummy/solr/test/data/index/_20i.fnm +0 -0
  162. data/spec/dummy/solr/test/data/index/_20i.nvd +0 -0
  163. data/spec/dummy/solr/test/data/index/_20i.nvm +0 -0
  164. data/spec/dummy/solr/test/data/index/_20i.si +0 -0
  165. data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.doc +0 -0
  166. data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.pos +0 -0
  167. data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.tim +0 -0
  168. data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.tip +0 -0
  169. data/spec/dummy/solr/test/data/index/_20j.fdt +0 -0
  170. data/spec/dummy/solr/test/data/index/_20j.fdx +0 -0
  171. data/spec/dummy/solr/test/data/index/_20j.fnm +0 -0
  172. data/spec/dummy/solr/test/data/index/_20j.nvd +0 -0
  173. data/spec/dummy/solr/test/data/index/_20j.nvm +0 -0
  174. data/spec/dummy/solr/test/data/index/_20j.si +0 -0
  175. data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.doc +0 -0
  176. data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.pos +0 -0
  177. data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.tim +0 -0
  178. data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.tip +0 -0
  179. data/spec/dummy/solr/test/data/index/_20k.fdt +0 -0
  180. data/spec/dummy/solr/test/data/index/_20k.fdx +0 -0
  181. data/spec/dummy/solr/test/data/index/_20k.fnm +0 -0
  182. data/spec/dummy/solr/test/data/index/_20k.nvd +0 -0
  183. data/spec/dummy/solr/test/data/index/_20k.nvm +0 -0
  184. data/spec/dummy/solr/test/data/index/_20k.si +0 -0
  185. data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.doc +0 -0
  186. data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.pos +0 -0
  187. data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.tim +0 -0
  188. data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.tip +0 -0
  189. data/spec/dummy/solr/test/data/index/segments_2uc +0 -0
  190. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000003680 +0 -0
  191. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000003681 +0 -0
  192. 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).should_not be_empty
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.should be_success
26
- assigns(:agent).should eq Agent.find(1)
27
- assigns(:agents).should eq assigns(:agent).derived_agents.where('required_role_id >= 1').page(1)
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).should_not be_empty
33
- response.should be_success
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).should_not be_empty
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).should_not be_empty
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).should_not be_empty
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).should_not be_empty
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).should_not be_empty
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.should be_success
74
- assigns(:agent).should eq Agent.find(1)
75
- assigns(:agents).should eq assigns(:agent).derived_agents.where(:required_role_id => 1).page(1)
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).should eq assigns(:manifestation).publishers.where(:required_role_id => 1).page(1)
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).should be_empty
87
- response.should be_success
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).should eq(@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).should eq(@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).should eq(users(:user2).agent)
117
- # response.should be_success
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).should eq(users(:user1).agent)
123
- # response.should be_success
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.should be_missing
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.should be_missing
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.should be_forbidden
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).should eq(@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.should be_success
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.should be_forbidden
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).should eq(@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).should eq assigns(:work).creators.first
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).should eq assigns(:manifestation).publishers.first
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.should redirect_to new_user_session_url
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).should_not be_valid
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).should_not be_valid
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).should_not be_valid
216
- response.should be_forbidden
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).should_not be_valid
224
- response.should redirect_to(new_user_session_url)
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).should eq(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).should eq(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.should be_success
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.should be_success
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.should be_forbidden
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.should be_forbidden
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.should be_success
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.should be_forbidden
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.should redirect_to(new_user_session_url)
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).should be_valid
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.should redirect_to(agent_url(assigns(:agent)))
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).should_not be_valid
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.should render_template("new")
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).should be_valid
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.should redirect_to(agent_url(assigns(:agent)))
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.should redirect_to(agent_url(assigns(:agent)))
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.should redirect_to(agent_url(assigns(:agent)))
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.should redirect_to(agent_url(assigns(:agent)))
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).should_not be_valid
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.should render_template("new")
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.should redirect_to agent_url(assigns(:agent))
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).should be_valid
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.should be_forbidden
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).should_not be_valid
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.should be_forbidden
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).should_not be_valid
410
- # response.should be_success
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.should be_forbidden
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).should be_valid
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.should redirect_to(new_user_session_url)
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).should_not be_valid
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.should redirect_to(new_user_session_url)
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).should eq(@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.should render_template("edit")
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).should eq(@agent)
486
- response.should redirect_to(@agent)
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).should_not be_valid
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.should render_template("edit")
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.should redirect_to agent_url(assigns(:agent))
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).should eq(@agent)
519
- response.should be_forbidden
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.should be_forbidden
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).should be_valid
533
- # response.should redirect_to agent_url(assigns(:agent))
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).should_not be_valid
539
- # response.should be_success
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.should be_forbidden
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.should redirect_to(new_user_session_url)
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.should redirect_to(new_user_session_url)
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.should redirect_to(agents_url)
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.should be_forbidden
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.should redirect_to agents_url
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.should redirect_to(agents_url)
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.should be_forbidden
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.should be_forbidden
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.should be_forbidden
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.should redirect_to(new_user_session_url)
640
+ expect(response).to redirect_to(new_user_session_url)
641
641
  end
642
642
  end
643
643
  end