enju_biblio 0.1.0.pre42 → 0.1.0.pre43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/creates_controller.rb +11 -11
- data/app/controllers/items_controller.rb +3 -3
- data/app/controllers/manifestations_controller.rb +14 -14
- data/app/controllers/owns_controller.rb +10 -10
- data/app/controllers/patron_import_files_controller.rb +34 -34
- data/app/controllers/patron_import_results_controller.rb +5 -5
- data/app/controllers/patron_relationship_types_controller.rb +3 -3
- data/app/controllers/patron_relationships_controller.rb +7 -7
- data/app/controllers/patron_types_controller.rb +3 -3
- data/app/controllers/patrons_controller.rb +61 -61
- data/app/controllers/picture_files_controller.rb +4 -4
- data/app/controllers/produces_controller.rb +11 -11
- data/app/controllers/realizes_controller.rb +11 -11
- data/app/helpers/{patrons_helper.rb → agents_helper.rb} +5 -5
- data/app/models/{patron.rb → agent.rb} +36 -36
- data/app/models/{patron_import_file.rb → agent_import_file.rb} +77 -77
- data/app/models/agent_import_result.rb +26 -0
- data/app/models/{patron_relationship.rb → agent_relationship.rb} +7 -7
- data/app/models/{patron_relationship_type.rb → agent_relationship_type.rb} +4 -4
- data/app/models/{patron_sweeper.rb → agent_sweeper.rb} +6 -6
- data/app/models/{patron_type.rb → agent_type.rb} +4 -4
- data/app/models/country.rb +1 -1
- data/app/models/create.rb +7 -7
- data/app/models/donate.rb +5 -5
- data/app/models/enju_biblio/ability.rb +24 -24
- data/app/models/item.rb +5 -5
- data/app/models/item_sweeper.rb +2 -2
- data/app/models/manifestation.rb +24 -20
- data/app/models/own.rb +7 -7
- data/app/models/page_sweeper.rb +4 -4
- data/app/models/picture_file.rb +1 -1
- data/app/models/produce.rb +7 -7
- data/app/models/realize.rb +7 -7
- data/app/models/resource_import_file.rb +19 -19
- data/app/views/{patron_import_files → agent_import_files}/edit.html.erb +6 -6
- data/app/views/agent_import_files/index.html.erb +40 -0
- data/app/views/{patron_import_files → agent_import_files}/new.html.erb +3 -3
- data/app/views/agent_import_files/show.html.erb +69 -0
- data/app/views/agent_import_results/index.csv.erb +3 -0
- data/app/views/agent_import_results/index.html.erb +52 -0
- data/app/views/agent_import_results/show.html.erb +38 -0
- data/app/views/{patron_relationship_types → agent_relationship_types}/_form.html.erb +1 -1
- data/app/views/{patron_relationship_types → agent_relationship_types}/edit.html.erb +3 -3
- data/app/views/agent_relationship_types/index.html.erb +43 -0
- data/app/views/{patron_relationship_types → agent_relationship_types}/new.html.erb +2 -2
- data/app/views/agent_relationship_types/show.html.erb +29 -0
- data/app/views/{patron_relationships → agent_relationships}/_form.html.erb +7 -7
- data/app/views/{patron_relationships → agent_relationships}/edit.html.erb +3 -3
- data/app/views/agent_relationships/index.html.erb +34 -0
- data/app/views/{patron_relationships → agent_relationships}/new.html.erb +2 -2
- data/app/views/agent_relationships/show.html.erb +24 -0
- data/app/views/{patron_types → agent_types}/_form.html.erb +1 -1
- data/app/views/{patron_types → agent_types}/edit.html.erb +3 -3
- data/app/views/agent_types/index.html.erb +43 -0
- data/app/views/{patron_types → agent_types}/new.html.erb +2 -2
- data/app/views/agent_types/show.html.erb +29 -0
- data/app/views/{patrons → agents}/_expression_list.html.erb +3 -3
- data/app/views/{patrons → agents}/_form.html.erb +9 -9
- data/app/views/{patrons → agents}/_form_family_name_first.html.erb +0 -0
- data/app/views/{patrons → agents}/_form_family_name_last.html.erb +0 -0
- data/app/views/{patrons → agents}/_history_list.html.erb +2 -2
- data/app/views/{patrons → agents}/_index.html.erb +9 -9
- data/app/views/{patrons → agents}/_index_expression.html.erb +15 -15
- data/app/views/{patrons → agents}/_index_manifestation.html.erb +16 -16
- data/app/views/agents/_index_patron.html.erb +71 -0
- data/app/views/agents/_index_patron_merge_list.html.erb +53 -0
- data/app/views/{patrons → agents}/_index_work.html.erb +17 -17
- data/app/views/{patrons → agents}/_manifestation_list.html.erb +3 -3
- data/app/views/agents/_patron.html.erb +13 -0
- data/app/views/agents/_patron_list.html.erb +18 -0
- data/app/views/{patrons → agents}/_work_list.html.erb +1 -1
- data/app/views/agents/edit.html.erb +16 -0
- data/app/views/agents/index.atom.builder +10 -0
- data/app/views/{patrons → agents}/index.html.erb +4 -4
- data/app/views/{patrons → agents}/index.mobile.erb +5 -5
- data/app/views/{patrons → agents}/index.rss.builder +11 -11
- data/app/views/{patrons → agents}/new.html.erb +2 -2
- data/app/views/agents/show.html.erb +152 -0
- data/app/views/{patrons → agents}/show.js.erb +0 -0
- data/app/views/agents/show.mobile.erb +69 -0
- data/app/views/creates/_form.html.erb +5 -5
- data/app/views/creates/_index.html.erb +2 -2
- data/app/views/creates/_index_patron.html.erb +6 -6
- data/app/views/creates/_index_work.html.erb +2 -2
- data/app/views/creates/index.html.erb +2 -2
- data/app/views/creates/new.html.erb +3 -3
- data/app/views/creates/show.html.erb +4 -4
- data/app/views/donates/edit.html.erb +2 -2
- data/app/views/donates/index.html.erb +2 -2
- data/app/views/donates/new.html.erb +2 -2
- data/app/views/donates/show.html.erb +2 -2
- data/app/views/items/index.html.erb +1 -1
- data/app/views/languages/index.html.erb +1 -1
- data/app/views/layouts/patrons.html.erb +2 -2
- data/app/views/manifestations/_index_form_contributor.html.erb +1 -1
- data/app/views/manifestations/_index_form_creator.html.erb +1 -1
- data/app/views/manifestations/_index_form_publisher.html.erb +1 -1
- data/app/views/manifestations/_manifestation_list.html.erb +6 -6
- data/app/views/manifestations/_show.mods.builder +4 -4
- data/app/views/manifestations/_show.rdf.builder +4 -4
- data/app/views/manifestations/_show_creators.html.erb +4 -4
- data/app/views/manifestations/_show_creators.mobile.erb +4 -4
- data/app/views/manifestations/_title.html.erb +3 -3
- data/app/views/manifestations/_title.mobile.erb +3 -3
- data/app/views/manifestations/edit.html.erb +2 -2
- data/app/views/manifestations/index.atom.builder +2 -2
- data/app/views/manifestations/index.html.erb +3 -3
- data/app/views/manifestations/index.opds.builder +2 -2
- data/app/views/manifestations/index.sru.builder +6 -6
- data/app/views/manifestations/new.html.erb +2 -2
- 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/owns/_form.html.erb +1 -1
- data/app/views/owns/index.html.erb +2 -2
- data/app/views/owns/show.html.erb +4 -4
- data/app/views/picture_files/_index.html.erb +1 -1
- data/app/views/picture_files/_index_patron.html.erb +2 -2
- data/app/views/picture_files/index.html.erb +2 -2
- data/app/views/picture_files/show.html.erb +2 -2
- data/app/views/produces/_form.html.erb +5 -5
- data/app/views/produces/_index.html.erb +2 -2
- data/app/views/produces/_index_manifestation.html.erb +3 -3
- data/app/views/produces/_index_patron.html.erb +3 -3
- data/app/views/produces/index.html.erb +2 -2
- data/app/views/produces/new.html.erb +3 -3
- data/app/views/produces/show.html.erb +4 -4
- data/app/views/realizes/_form.html.erb +5 -5
- data/app/views/realizes/_index.html.erb +2 -2
- data/app/views/realizes/_index_expression.html.erb +3 -3
- data/app/views/realizes/_index_patron.html.erb +3 -3
- data/app/views/realizes/index.html.erb +2 -2
- data/app/views/realizes/new.html.erb +3 -3
- data/app/views/realizes/show.html.erb +4 -4
- data/app/views/resource_import_results/show.html.erb +1 -1
- data/config/routes.rb +16 -16
- data/db/migrate/{001_create_patrons.rb → 001_create_agents.rb} +8 -8
- data/db/migrate/012_create_owns.rb +2 -2
- data/db/migrate/015_create_creates.rb +2 -2
- data/db/migrate/047_create_produces.rb +2 -2
- data/db/migrate/125_create_donates.rb +2 -2
- data/db/migrate/20080830154109_create_realizes.rb +2 -2
- data/db/migrate/{20080905191442_create_patron_types.rb → 20080905191442_create_agent_types.rb} +2 -2
- data/db/migrate/20081028083142_create_agent_import_files.rb +22 -0
- data/db/migrate/{20090812151902_create_patron_relationship_types.rb → 20090812151902_create_agent_relationship_types.rb} +2 -2
- data/db/migrate/20091012101112_add_dcndl_schema.rb +2 -2
- data/db/migrate/20100606073747_create_agent_relationships.rb +13 -0
- data/db/migrate/20100814091104_add_position_to_agent_relationship.rb +11 -0
- data/db/migrate/20100925074559_create_agent_import_results.rb +12 -0
- data/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb +11 -0
- data/db/migrate/20120413161403_add_fingerprint_to_agent_import_file.rb +5 -0
- data/db/migrate/20120413170720_add_error_message_to_agent_import_file.rb +5 -0
- data/db/migrate/20120511072422_add_agent_identifier_to_agent.rb +6 -0
- data/db/migrate/20120602141129_add_edit_mode_to_agent_import_file.rb +5 -0
- data/lib/enju_biblio/biblio_helper.rb +8 -8
- data/lib/enju_biblio/version.rb +1 -1
- data/lib/enju_biblio.rb +3 -3
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/patron_relationship_types.yml +3 -3
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/patron_types.yml +2 -2
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/patrons.yml +4 -4
- data/spec/controllers/agent_import_files_controller_spec.rb +321 -0
- data/spec/controllers/{patron_import_results_controller_spec.rb → agent_import_results_controller_spec.rb} +17 -17
- data/spec/controllers/agent_relationship_types_controller_spec.rb +445 -0
- data/spec/controllers/agent_relationships_controller_spec.rb +446 -0
- data/spec/controllers/agent_types_controller_spec.rb +447 -0
- data/spec/controllers/agents_controller_spec.rb +644 -0
- data/spec/controllers/countries_controller_spec.rb +1 -1
- data/spec/controllers/items_controller_spec.rb +4 -4
- data/spec/controllers/manifestation_relationship_types_controller_spec.rb +1 -1
- data/spec/controllers/manifestations_controller_spec.rb +4 -4
- data/spec/controllers/owns_controller_spec.rb +2 -2
- data/spec/controllers/resource_import_files_controller_spec.rb +1 -1
- data/spec/dummy/app/helpers/application_helper.rb +5 -222
- data/spec/dummy/app/models/ability.rb +31 -31
- data/spec/dummy/app/models/{local_patron.rb → local_agent.rb} +1 -1
- data/spec/dummy/app/models/user.rb +3 -3
- data/spec/dummy/config/application.rb +0 -1
- data/spec/dummy/config/environments/test.rb +1 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/035_create_reserves.rb +1 -1
- data/spec/dummy/db/migrate/20090519203307_create_participates.rb +2 -2
- data/spec/dummy/db/schema.rb +132 -132
- 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_sample1.tsv +5 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample2.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/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_q76 +0 -0
- data/spec/factories/{patron.rb → agent.rb} +3 -3
- data/spec/factories/create.rb +1 -1
- data/spec/factories/donate.rb +1 -1
- data/spec/factories/own.rb +1 -1
- data/spec/factories/patron_relationship.rb +3 -3
- data/spec/factories/patron_relationship_type.rb +2 -2
- data/spec/factories/patron_type.rb +2 -2
- data/spec/factories/produce.rb +1 -1
- data/spec/factories/realize.rb +1 -1
- data/spec/fixtures/{patron_import_files.yml → agent_import_files.yml} +18 -18
- data/spec/fixtures/{patron_import_results.yml → agent_import_results.yml} +7 -7
- data/spec/fixtures/{patron_relationship_types.yml → agent_relationship_types.yml} +4 -4
- data/spec/fixtures/{patron_relationships.yml → agent_relationships.yml} +4 -4
- data/spec/fixtures/{patron_types.yml → agent_types.yml} +4 -4
- data/spec/fixtures/{patrons.yml → agents.yml} +47 -47
- data/spec/fixtures/creates.yml +8 -8
- data/spec/fixtures/donates.yml +4 -4
- data/spec/fixtures/owns.yml +3 -3
- data/spec/fixtures/picture_files.yml +1 -1
- data/spec/fixtures/produces.yml +20 -20
- data/spec/fixtures/realizes.yml +11 -11
- data/spec/fixtures/reserves.yml +1 -1
- data/spec/models/agent_import_file_spec.rb +96 -0
- data/spec/models/{patron_import_result_spec.rb → agent_import_result_spec.rb} +4 -4
- data/spec/models/{patron_relationship_spec.rb → agent_relationship_spec.rb} +3 -3
- data/spec/models/{patron_relationship_type_spec.rb → agent_relationship_type_spec.rb} +2 -2
- data/spec/models/{patron_spec.rb → agent_spec.rb} +16 -16
- data/spec/models/{patron_type_spec.rb → agent_type_spec.rb} +2 -2
- data/spec/models/create_spec.rb +1 -1
- data/spec/models/donate_spec.rb +1 -1
- data/spec/models/manifestation_spec.rb +1 -1
- data/spec/models/own_spec.rb +1 -1
- data/spec/models/produce_spec.rb +1 -1
- data/spec/models/realize_spec.rb +1 -1
- data/spec/models/resource_import_file_spec.rb +8 -8
- data/spec/requests/agents_spec.rb +9 -0
- data/spec/routing/agent_relationship_types_routing_spec.rb +35 -0
- data/spec/routing/agent_relationships_routing_spec.rb +35 -0
- data/spec/routing/agents_routing_spec.rb +35 -0
- data/spec/views/creates/edit.html.erb_spec.rb +1 -1
- data/spec/views/creates/index.html.erb_spec.rb +2 -2
- data/spec/views/creates/new.html.erb_spec.rb +1 -1
- data/spec/views/creates/show.html.erb_spec.rb +1 -1
- data/spec/views/owns/edit.html.erb_spec.rb +1 -1
- data/spec/views/owns/index.html.erb_spec.rb +2 -2
- data/spec/views/owns/new.html.erb_spec.rb +1 -1
- data/spec/views/owns/show.html.erb_spec.rb +1 -1
- data/spec/views/produces/edit.html.erb_spec.rb +2 -2
- data/spec/views/produces/index.html.erb_spec.rb +2 -2
- data/spec/views/produces/new.html.erb_spec.rb +2 -2
- data/spec/views/produces/show.html.erb_spec.rb +1 -1
- data/spec/views/realizes/edit.html.erb_spec.rb +2 -2
- data/spec/views/realizes/index.html.erb_spec.rb +2 -2
- data/spec/views/realizes/new.html.erb_spec.rb +2 -2
- data/spec/views/realizes/show.html.erb_spec.rb +1 -1
- metadata +131 -187
- data/app/models/patron_import_result.rb +0 -26
- data/app/views/patron_import_files/index.html.erb +0 -40
- data/app/views/patron_import_files/show.html.erb +0 -69
- data/app/views/patron_import_results/index.csv.erb +0 -3
- data/app/views/patron_import_results/index.html.erb +0 -52
- data/app/views/patron_import_results/show.html.erb +0 -38
- data/app/views/patron_relationship_types/index.html.erb +0 -43
- data/app/views/patron_relationship_types/show.html.erb +0 -29
- data/app/views/patron_relationships/index.html.erb +0 -34
- data/app/views/patron_relationships/show.html.erb +0 -24
- data/app/views/patron_types/index.html.erb +0 -43
- data/app/views/patron_types/show.html.erb +0 -29
- data/app/views/patrons/_index_patron.html.erb +0 -71
- data/app/views/patrons/_index_patron_merge_list.html.erb +0 -53
- data/app/views/patrons/_patron.html.erb +0 -13
- data/app/views/patrons/_patron_list.html.erb +0 -18
- data/app/views/patrons/edit.html.erb +0 -16
- data/app/views/patrons/index.atom.builder +0 -10
- data/app/views/patrons/show.html.erb +0 -152
- data/app/views/patrons/show.mobile.erb +0 -69
- data/db/migrate/20081028083142_create_patron_import_files.rb +0 -22
- data/db/migrate/20100606073747_create_patron_relationships.rb +0 -13
- data/db/migrate/20100814091104_add_position_to_patron_relationship.rb +0 -11
- data/db/migrate/20100925074559_create_patron_import_results.rb +0 -12
- data/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +0 -11
- data/db/migrate/20120413161403_add_fingerprint_to_patron_import_file.rb +0 -5
- data/db/migrate/20120413170720_add_error_message_to_patron_import_file.rb +0 -5
- data/db/migrate/20120511072422_add_patron_identifier_to_patron.rb +0 -6
- data/db/migrate/20120602141129_add_edit_mode_to_patron_import_file.rb +0 -5
- data/spec/controllers/patron_import_files_controller_spec.rb +0 -321
- data/spec/controllers/patron_relationship_types_controller_spec.rb +0 -445
- data/spec/controllers/patron_relationships_controller_spec.rb +0 -446
- data/spec/controllers/patron_types_controller_spec.rb +0 -447
- data/spec/controllers/patrons_controller_spec.rb +0 -644
- data/spec/dummy/app/mailers/notifier.rb +0 -40
- data/spec/dummy/lib/plugins/ext/event-calendar.rb +0 -38
- data/spec/dummy/lib/plugins/ext/sunspot/abstract_search.rb +0 -12
- data/spec/dummy/lib/plugins/ext/sunspot/dismax.rb +0 -41
- data/spec/dummy/lib/plugins/ext/sunspot/start_record.rb +0 -55
- data/spec/dummy/lib/plugins/ext/sunspot.rb +0 -3
- data/spec/dummy/lib/plugins/ext.rb +0 -1
- data/spec/dummy/lib/plugins.rb +0 -2
- data/spec/dummy/solr/data/test/index/_goc.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_goc.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_goc.fnm +0 -7
- data/spec/dummy/solr/data/test/index/_goc.frq +0 -0
- data/spec/dummy/solr/data/test/index/_goc.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_goc.prx +0 -0
- data/spec/dummy/solr/data/test/index/_goc.tii +0 -0
- data/spec/dummy/solr/data/test/index/_goc.tis +0 -0
- data/spec/dummy/solr/data/test/index/_god.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_god.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_god.fnm +0 -7
- data/spec/dummy/solr/data/test/index/_god.frq +0 -0
- data/spec/dummy/solr/data/test/index/_god.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_god.prx +0 -0
- data/spec/dummy/solr/data/test/index/_god.tii +0 -0
- data/spec/dummy/solr/data/test/index/_god.tis +0 -0
- data/spec/dummy/solr/data/test/index/_goe.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_goe.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_goe.fnm +0 -8
- data/spec/dummy/solr/data/test/index/_goe.frq +0 -0
- data/spec/dummy/solr/data/test/index/_goe.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_goe.prx +0 -0
- data/spec/dummy/solr/data/test/index/_goe.tii +0 -0
- data/spec/dummy/solr/data/test/index/_goe.tis +0 -0
- data/spec/dummy/solr/data/test/index/segments_otc +0 -0
- data/spec/dummy/tmp/cache/4AD/470/country_all +0 -0
- data/spec/models/patron_import_file_spec.rb +0 -96
- data/spec/requests/patrons_spec.rb +0 -9
- data/spec/routing/patron_relationship_types_routing_spec.rb +0 -35
- data/spec/routing/patron_relationships_routing_spec.rb +0 -35
- data/spec/routing/patrons_routing_spec.rb +0 -35
@@ -0,0 +1,96 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe AgentImportFile do
|
5
|
+
fixtures :all
|
6
|
+
|
7
|
+
describe "when its mode is 'create'" do
|
8
|
+
before(:each) do
|
9
|
+
@file = AgentImportFile.create! :agent_import => File.new("#{Rails.root.to_s}/../../examples/agent_import_file_sample1.tsv")
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should be imported" do
|
13
|
+
old_agents_count = Agent.count
|
14
|
+
old_import_results_count = AgentImportResult.count
|
15
|
+
@file.state.should eq 'pending'
|
16
|
+
@file.import_start.should eq({:agent_imported => 3, :user_imported => 0, :failed => 0})
|
17
|
+
Agent.order('id DESC')[0].full_name.should eq '原田 ushi 隆史'
|
18
|
+
Agent.order('id DESC')[1].full_name.should eq '田辺浩介'
|
19
|
+
Agent.order('id DESC')[2].date_of_birth.should eq Time.zone.parse('1978-01-01')
|
20
|
+
Agent.count.should eq old_agents_count + 3
|
21
|
+
AgentImportResult.count.should eq old_import_results_count + 4
|
22
|
+
|
23
|
+
@file.agent_import_fingerprint.should be_true
|
24
|
+
@file.executed_at.should be_true
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "when it is written in shift_jis" do
|
29
|
+
before(:each) do
|
30
|
+
@file = AgentImportFile.create! :agent_import => File.new("#{Rails.root.to_s}/../../examples/agent_import_file_sample3.tsv")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should be imported" do
|
34
|
+
old_agents_count = Agent.count
|
35
|
+
old_import_results_count = AgentImportResult.count
|
36
|
+
@file.state.should eq 'pending'
|
37
|
+
@file.import_start.should eq({:agent_imported => 4, :user_imported => 0, :failed => 0})
|
38
|
+
Agent.count.should eq old_agents_count + 4
|
39
|
+
Agent.order('id DESC')[0].full_name.should eq '原田 ushi 隆史'
|
40
|
+
Agent.order('id DESC')[1].full_name.should eq '田辺浩介'
|
41
|
+
Agent.order('id DESC')[2].email.should eq 'fugafuga@example.jp'
|
42
|
+
Agent.order('id DESC')[3].required_role.should eq Role.find_by_name('Guest')
|
43
|
+
Agent.order('id DESC')[1].email.should eq 'tanabe@library.example.jp'
|
44
|
+
AgentImportResult.count.should eq old_import_results_count + 5
|
45
|
+
|
46
|
+
@file.agent_import_fingerprint.should be_true
|
47
|
+
@file.executed_at.should be_true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "when its mode is 'update'" do
|
52
|
+
it "should update users" do
|
53
|
+
@file = AgentImportFile.create :agent_import => File.new("#{Rails.root.to_s}/../../examples/agent_update_file.tsv")
|
54
|
+
@file.modify
|
55
|
+
agent_1 = Agent.find(1)
|
56
|
+
agent_1.full_name.should eq 'たなべこうすけ'
|
57
|
+
agent_1.address_1.should eq '東京都'
|
58
|
+
agent_2 = Agent.find(2)
|
59
|
+
agent_2.full_name.should eq '田辺浩介'
|
60
|
+
agent_2.address_1.should eq '岡山県'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "when its mode is 'destroy'" do
|
65
|
+
it "should remove users" do
|
66
|
+
old_count = Agent.count
|
67
|
+
@file = AgentImportFile.create :agent_import => File.new("#{Rails.root.to_s}/../../examples/agent_delete_file.tsv")
|
68
|
+
@file.remove
|
69
|
+
Agent.count.should eq old_count - 7
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# == Schema Information
|
75
|
+
#
|
76
|
+
# Table name: agent_import_files
|
77
|
+
#
|
78
|
+
# id :integer not null, primary key
|
79
|
+
# parent_id :integer
|
80
|
+
# content_type :string(255)
|
81
|
+
# size :integer
|
82
|
+
# user_id :integer
|
83
|
+
# note :text
|
84
|
+
# executed_at :datetime
|
85
|
+
# state :string(255)
|
86
|
+
# agent_import_file_name :string(255)
|
87
|
+
# agent_import_content_type :string(255)
|
88
|
+
# agent_import_file_size :integer
|
89
|
+
# agent_import_updated_at :datetime
|
90
|
+
# created_at :datetime not null
|
91
|
+
# updated_at :datetime not null
|
92
|
+
# agent_import_fingerprint :string(255)
|
93
|
+
# error_message :text
|
94
|
+
# edit_mode :string(255)
|
95
|
+
#
|
96
|
+
|
@@ -1,18 +1,18 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe AgentImportResult do
|
5
5
|
#pending "add some examples to (or delete) #{__FILE__}"
|
6
6
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# == Schema Information
|
10
10
|
#
|
11
|
-
# Table name:
|
11
|
+
# Table name: agent_import_results
|
12
12
|
#
|
13
13
|
# id :integer not null, primary key
|
14
|
-
#
|
15
|
-
#
|
14
|
+
# agent_import_file_id :integer
|
15
|
+
# agent_id :integer
|
16
16
|
# user_id :integer
|
17
17
|
# body :text
|
18
18
|
# created_at :datetime not null
|
@@ -1,19 +1,19 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe AgentRelationship do
|
5
5
|
#pending "add some examples to (or delete) #{__FILE__}"
|
6
6
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# == Schema Information
|
10
10
|
#
|
11
|
-
# Table name:
|
11
|
+
# Table name: agent_relationships
|
12
12
|
#
|
13
13
|
# id :integer not null, primary key
|
14
14
|
# parent_id :integer
|
15
15
|
# child_id :integer
|
16
|
-
#
|
16
|
+
# agent_relationship_type_id :integer
|
17
17
|
# created_at :datetime not null
|
18
18
|
# updated_at :datetime not null
|
19
19
|
# position :integer
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe AgentRelationshipType do
|
5
5
|
#pending "add some examples to (or delete) #{__FILE__}"
|
6
6
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# == Schema Information
|
10
10
|
#
|
11
|
-
# Table name:
|
11
|
+
# Table name: agent_relationship_types
|
12
12
|
#
|
13
13
|
# id :integer not null, primary key
|
14
14
|
# name :string(255) not null
|
@@ -1,50 +1,50 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe Agent do
|
5
5
|
#pending "add some examples to (or delete) #{__FILE__}"
|
6
6
|
fixtures :all
|
7
7
|
|
8
8
|
it "should set a default required_role to Guest" do
|
9
|
-
|
10
|
-
|
9
|
+
agent = FactoryGirl.create(:agent)
|
10
|
+
agent.required_role.should eq Role.find_by_name('Guest')
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should set birth_date" do
|
14
|
-
|
15
|
-
|
14
|
+
agent = FactoryGirl.create(:agent, :birth_date => '2000')
|
15
|
+
agent.date_of_birth.should eq Time.zone.parse('2000-01-01')
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should set death_date" do
|
19
|
-
|
20
|
-
|
19
|
+
agent = FactoryGirl.create(:agent, :death_date => '2000')
|
20
|
+
agent.date_of_death.should eq Time.zone.parse('2000-01-01')
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should not set death_date earlier than birth_date" do
|
24
|
-
|
25
|
-
|
24
|
+
agent = FactoryGirl.create(:agent, :birth_date => '2010', :death_date => '2000')
|
25
|
+
agent.should_not be_valid
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should be creator" do
|
29
|
-
|
29
|
+
agents(:agent_00001).creator?(manifestations(:manifestation_00001)).should be_true
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should not be creator" do
|
33
|
-
|
33
|
+
agents(:agent_00010).creator?(manifestations(:manifestation_00001)).should be_false
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should be publisher" do
|
37
|
-
|
37
|
+
agents(:agent_00001).publisher?(manifestations(:manifestation_00001)).should be_true
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should not be publisher" do
|
41
|
-
|
41
|
+
agents(:agent_00010).publisher?(manifestations(:manifestation_00001)).should be_false
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
# == Schema Information
|
46
46
|
#
|
47
|
-
# Table name:
|
47
|
+
# Table name: agents
|
48
48
|
#
|
49
49
|
# id :integer not null, primary key
|
50
50
|
# user_id :integer
|
@@ -82,7 +82,7 @@ end
|
|
82
82
|
# date_of_death :datetime
|
83
83
|
# language_id :integer default(1), not null
|
84
84
|
# country_id :integer default(1), not null
|
85
|
-
#
|
85
|
+
# agent_type_id :integer default(1), not null
|
86
86
|
# lock_version :integer default(0), not null
|
87
87
|
# note :text
|
88
88
|
# required_role_id :integer default(1), not null
|
@@ -93,6 +93,6 @@ end
|
|
93
93
|
# full_name_alternative_transcription :text
|
94
94
|
# birth_date :string(255)
|
95
95
|
# death_date :string(255)
|
96
|
-
#
|
96
|
+
# agent_identifier :string(255)
|
97
97
|
#
|
98
98
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe AgentType do
|
5
5
|
#pending "add some examples to (or delete) #{__FILE__}"
|
6
6
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# == Schema Information
|
10
10
|
#
|
11
|
-
# Table name:
|
11
|
+
# Table name: agent_types
|
12
12
|
#
|
13
13
|
# id :integer not null, primary key
|
14
14
|
# name :string(255) not null
|
data/spec/models/create_spec.rb
CHANGED
data/spec/models/donate_spec.rb
CHANGED
@@ -45,7 +45,7 @@ describe Manifestation, :solr => true do
|
|
45
45
|
results.size.should eq 1
|
46
46
|
end
|
47
47
|
|
48
|
-
it "should search
|
48
|
+
it "should search agent in openurl" do
|
49
49
|
openurl = Openurl.new({:aulast => "Administrator"})
|
50
50
|
results = openurl.search
|
51
51
|
openurl.query_text.should eq "au_text:Administrator"
|
data/spec/models/own_spec.rb
CHANGED
data/spec/models/produce_spec.rb
CHANGED
data/spec/models/realize_spec.rb
CHANGED
@@ -13,7 +13,7 @@ describe ResourceImportFile do
|
|
13
13
|
it "should be imported", :vcr => true do
|
14
14
|
old_manifestations_count = Manifestation.count
|
15
15
|
old_items_count = Item.count
|
16
|
-
|
16
|
+
old_agents_count = Agent.count
|
17
17
|
old_import_results_count = ResourceImportResult.count
|
18
18
|
@file.import_start.should eq({:manifestation_imported => 9, :item_imported => 6, :manifestation_found => 3, :item_found => 3, :failed => 7})
|
19
19
|
manifestation = Item.where(:item_identifier => '11111').first.manifestation
|
@@ -24,7 +24,7 @@ describe ResourceImportFile do
|
|
24
24
|
manifestation.creates.first.create_type.name.should eq 'author'
|
25
25
|
Manifestation.count.should eq old_manifestations_count + 9
|
26
26
|
Item.count.should eq old_items_count + 6
|
27
|
-
|
27
|
+
Agent.count.should eq old_agents_count + 9
|
28
28
|
ResourceImportResult.count.should eq old_import_results_count + 17
|
29
29
|
|
30
30
|
manifestation_101 = Manifestation.where(:manifestation_identifier => '101').first
|
@@ -37,7 +37,7 @@ describe ResourceImportFile do
|
|
37
37
|
item_10101 = Item.where(:item_identifier => '10101').first
|
38
38
|
item_10101.manifestation.creators.size.should eq 2
|
39
39
|
item_10101.manifestation.creates.order(:id).first.create_type.name.should eq 'author'
|
40
|
-
item_10101.manifestation.creates.order(:id).second.
|
40
|
+
item_10101.manifestation.creates.order(:id).second.agent.full_name.should eq 'test1'
|
41
41
|
item_10101.manifestation.creates.order(:id).second.create_type.name.should eq 'illustrator'
|
42
42
|
item_10101.manifestation.date_of_publication.should eq Time.zone.parse('2001-01-01')
|
43
43
|
item_10101.budget_type.name.should eq 'Public fund'
|
@@ -79,7 +79,7 @@ describe ResourceImportFile do
|
|
79
79
|
it "should be imported", :vcr => true do
|
80
80
|
old_manifestations_count = Manifestation.count
|
81
81
|
old_items_count = Item.count
|
82
|
-
|
82
|
+
old_agents_count = Agent.count
|
83
83
|
old_import_results_count = ResourceImportResult.count
|
84
84
|
@file.import_start.should eq({:manifestation_imported => 9, :item_imported => 6, :manifestation_found => 3, :item_found => 3, :failed => 7})
|
85
85
|
manifestation = Item.where(:item_identifier => '11111').first.manifestation
|
@@ -88,7 +88,7 @@ describe ResourceImportFile do
|
|
88
88
|
manifestation.publishers.second.full_name_transcription.should eq 'てすと5'
|
89
89
|
Manifestation.count.should eq old_manifestations_count + 9
|
90
90
|
Item.count.should eq old_items_count + 6
|
91
|
-
|
91
|
+
Agent.count.should eq old_agents_count + 9
|
92
92
|
ResourceImportResult.count.should eq old_import_results_count + 17
|
93
93
|
Item.find_by_item_identifier('10101').manifestation.creators.size.should eq 2
|
94
94
|
Item.find_by_item_identifier('10101').manifestation.date_of_publication.should eq Time.zone.parse('2001-01-01')
|
@@ -113,10 +113,10 @@ describe ResourceImportFile do
|
|
113
113
|
|
114
114
|
it "should be imported", :vcr => true do
|
115
115
|
old_manifestations_count = Manifestation.count
|
116
|
-
|
116
|
+
old_agents_count = Agent.count
|
117
117
|
@file.import_start
|
118
118
|
Manifestation.count.should eq old_manifestations_count + 1
|
119
|
-
|
119
|
+
Agent.count.should eq old_agents_count + 4
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
@@ -125,7 +125,7 @@ describe ResourceImportFile do
|
|
125
125
|
it "should update items", :vcr => true do
|
126
126
|
@file = ResourceImportFile.create :resource_import => File.new("#{Rails.root.to_s}/../../examples/item_update_file.tsv"), :edit_mode => 'update'
|
127
127
|
@file.modify
|
128
|
-
Item.where(:item_identifier => '00001').first.manifestation.creators.order('
|
128
|
+
Item.where(:item_identifier => '00001').first.manifestation.creators.order('agents.id').collect(&:full_name).should eq ['たなべ', 'こうすけ']
|
129
129
|
Item.where(:item_identifier => '00002').first.manifestation.publishers.collect(&:full_name).should eq ['test2']
|
130
130
|
Item.where(:item_identifier => '00003').first.manifestation.original_title.should eq 'テスト3'
|
131
131
|
Item.where(:item_identifier => '00003').first.acquired_at.should eq Time.zone.parse('2012-01-01')
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe AgentRelationshipTypesController do
|
4
|
+
describe "routing" do
|
5
|
+
|
6
|
+
it "recognizes and generates #index" do
|
7
|
+
{ :get => "/agent_relationship_types" }.should route_to(:controller => "agent_relationship_types", :action => "index")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "recognizes and generates #new" do
|
11
|
+
{ :get => "/agent_relationship_types/new" }.should route_to(:controller => "agent_relationship_types", :action => "new")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "recognizes and generates #show" do
|
15
|
+
{ :get => "/agent_relationship_types/1" }.should route_to(:controller => "agent_relationship_types", :action => "show", :id => "1")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "recognizes and generates #edit" do
|
19
|
+
{ :get => "/agent_relationship_types/1/edit" }.should route_to(:controller => "agent_relationship_types", :action => "edit", :id => "1")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "recognizes and generates #create" do
|
23
|
+
{ :post => "/agent_relationship_types" }.should route_to(:controller => "agent_relationship_types", :action => "create")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "recognizes and generates #update" do
|
27
|
+
{ :put => "/agent_relationship_types/1" }.should route_to(:controller => "agent_relationship_types", :action => "update", :id => "1")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "recognizes and generates #destroy" do
|
31
|
+
{ :delete => "/agent_relationship_types/1" }.should route_to(:controller => "agent_relationship_types", :action => "destroy", :id => "1")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe AgentRelationshipsController do
|
4
|
+
describe "routing" do
|
5
|
+
|
6
|
+
it "recognizes and generates #index" do
|
7
|
+
{ :get => "/agent_relationships" }.should route_to(:controller => "agent_relationships", :action => "index")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "recognizes and generates #new" do
|
11
|
+
{ :get => "/agent_relationships/new" }.should route_to(:controller => "agent_relationships", :action => "new")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "recognizes and generates #show" do
|
15
|
+
{ :get => "/agent_relationships/1" }.should route_to(:controller => "agent_relationships", :action => "show", :id => "1")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "recognizes and generates #edit" do
|
19
|
+
{ :get => "/agent_relationships/1/edit" }.should route_to(:controller => "agent_relationships", :action => "edit", :id => "1")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "recognizes and generates #create" do
|
23
|
+
{ :post => "/agent_relationships" }.should route_to(:controller => "agent_relationships", :action => "create")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "recognizes and generates #update" do
|
27
|
+
{ :put => "/agent_relationships/1" }.should route_to(:controller => "agent_relationships", :action => "update", :id => "1")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "recognizes and generates #destroy" do
|
31
|
+
{ :delete => "/agent_relationships/1" }.should route_to(:controller => "agent_relationships", :action => "destroy", :id => "1")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe AgentsController do
|
4
|
+
describe "routing" do
|
5
|
+
|
6
|
+
it "recognizes and generates #index" do
|
7
|
+
{ :get => "/agents" }.should route_to(:controller => "agents", :action => "index")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "recognizes and generates #new" do
|
11
|
+
{ :get => "/agents/new" }.should route_to(:controller => "agents", :action => "new")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "recognizes and generates #show" do
|
15
|
+
{ :get => "/agents/1" }.should route_to(:controller => "agents", :action => "show", :id => "1")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "recognizes and generates #edit" do
|
19
|
+
{ :get => "/agents/1/edit" }.should route_to(:controller => "agents", :action => "edit", :id => "1")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "recognizes and generates #create" do
|
23
|
+
{ :post => "/agents" }.should route_to(:controller => "agents", :action => "create")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "recognizes and generates #update" do
|
27
|
+
{ :put => "/agents/1" }.should route_to(:controller => "agents", :action => "update", :id => "1")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "recognizes and generates #destroy" do
|
31
|
+
{ :delete => "/agents/1" }.should route_to(:controller => "agents", :action => "destroy", :id => "1")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -5,11 +5,11 @@ describe "creates/index" do
|
|
5
5
|
assign(:creates, Kaminari::paginate_array([
|
6
6
|
stub_model(Create,
|
7
7
|
:work_id => 1,
|
8
|
-
:
|
8
|
+
:agent_id => 1
|
9
9
|
),
|
10
10
|
stub_model(Create,
|
11
11
|
:work_id => 1,
|
12
|
-
:
|
12
|
+
:agent_id => 2
|
13
13
|
)
|
14
14
|
]).page(1))
|
15
15
|
@ability = Object.new
|
@@ -5,11 +5,11 @@ describe "owns/index" do
|
|
5
5
|
assign(:owns, Kaminari::paginate_array([
|
6
6
|
stub_model(Own,
|
7
7
|
:item_id => 1,
|
8
|
-
:
|
8
|
+
:agent_id => 1
|
9
9
|
),
|
10
10
|
stub_model(Own,
|
11
11
|
:item_id => 1,
|
12
|
-
:
|
12
|
+
:agent_id => 2
|
13
13
|
)
|
14
14
|
]).page(1))
|
15
15
|
@ability = Object.new
|
@@ -6,7 +6,7 @@ describe "produces/edit" do
|
|
6
6
|
before(:each) do
|
7
7
|
@produce = assign(:produce, stub_model(Produce,
|
8
8
|
:manifestation_id => 1,
|
9
|
-
:
|
9
|
+
:agent_id => 1
|
10
10
|
))
|
11
11
|
@produce_types = ProduceType.all
|
12
12
|
@ability = Object.new
|
@@ -20,7 +20,7 @@ describe "produces/edit" do
|
|
20
20
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
21
21
|
assert_select "form", :action => produces_path(@produce), :method => "post" do
|
22
22
|
assert_select "input#produce_manifestation_id", :name => "produce[manifestation_id]"
|
23
|
-
assert_select "input#
|
23
|
+
assert_select "input#produce_agent_id", :name => "produce[agent_id]"
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -5,11 +5,11 @@ describe "produces/index" do
|
|
5
5
|
assign(:produces, Kaminari::paginate_array([
|
6
6
|
stub_model(Produce,
|
7
7
|
:manifestation_id => 1,
|
8
|
-
:
|
8
|
+
:agent_id => 2
|
9
9
|
),
|
10
10
|
stub_model(Produce,
|
11
11
|
:manifestation_id => 1,
|
12
|
-
:
|
12
|
+
:agent_id => 2
|
13
13
|
)
|
14
14
|
]).page(1))
|
15
15
|
@ability = Object.new
|
@@ -6,7 +6,7 @@ describe "produces/new" do
|
|
6
6
|
before(:each) do
|
7
7
|
assign(:produce, stub_model(Produce,
|
8
8
|
:manifestation_id => 1,
|
9
|
-
:
|
9
|
+
:agent_id => 1
|
10
10
|
).as_new_record)
|
11
11
|
@produce_types = ProduceType.all
|
12
12
|
@ability = Object.new
|
@@ -20,7 +20,7 @@ describe "produces/new" do
|
|
20
20
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
21
21
|
assert_select "form", :action => produces_path, :method => "post" do
|
22
22
|
assert_select "input#produce_manifestation_id", :name => "produce[manifestation_id]"
|
23
|
-
assert_select "input#
|
23
|
+
assert_select "input#produce_agent_id", :name => "produce[agent_id]"
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|