sufia 7.0.0.beta3 → 7.0.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -0
- data/.rubocop_todo.yml +66 -7
- data/app/controllers/concerns/sufia/batch_uploads_controller_behavior.rb +0 -1
- data/app/controllers/concerns/sufia/collections_controller_behavior.rb +0 -1
- data/app/controllers/concerns/sufia/contact_form_controller_behavior.rb +6 -3
- data/app/controllers/concerns/sufia/controller.rb +0 -7
- data/app/controllers/concerns/sufia/file_sets_controller_behavior.rb +1 -1
- data/app/controllers/concerns/sufia/uploads_controller_behavior.rb +18 -0
- data/app/controllers/concerns/sufia/users_controller_behavior.rb +1 -25
- data/app/controllers/concerns/sufia/works_controller_behavior.rb +31 -32
- data/app/controllers/curation_concerns/audits_controller.rb +0 -1
- data/app/controllers/sufia/resource_sync_controller.rb +41 -0
- data/app/controllers/sufia/trophies_controller.rb +17 -0
- data/app/controllers/sufia/uploads_controller.rb +1 -12
- data/app/helpers/sufia/sufia_helper_behavior.rb +15 -3
- data/app/helpers/trophy_helper.rb +1 -1
- data/app/models/concerns/sufia/user.rb +0 -12
- data/app/models/contact_form.rb +2 -2
- data/app/models/local_authority.rb +5 -2
- data/app/presenters/sufia/user_profile_presenter.rb +29 -0
- data/app/services/sufia/query_service.rb +1 -1
- data/app/views/collections/_edit_actions.html.erb +2 -1
- data/app/views/collections/_show_actions.html.erb +2 -1
- data/app/views/collections/_work_action_menu.html.erb +1 -1
- data/app/views/contact_form/new.html.erb +1 -1
- data/app/views/curation_concerns/base/_form_progress.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_contents.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_proxy_rights.html.erb +2 -2
- data/app/views/layouts/_head_tag_content.html.erb +1 -0
- data/app/views/my/_work_action_menu.html.erb +1 -1
- data/app/views/sufia/homepage/_featured_fields.html.erb +1 -5
- data/app/views/sufia/homepage/_home_header.html.erb +1 -1
- data/app/views/transfers/new.html.erb +1 -1
- data/app/views/users/_activity.html.erb +1 -1
- data/app/views/users/_contributions.html.erb +5 -5
- data/app/views/users/_edit_primary.html.erb +2 -2
- data/app/views/users/_profile_actions.html.erb +1 -1
- data/app/views/users/_profile_tabs.html.erb +2 -2
- data/app/views/users/show.html.erb +2 -5
- data/config/locales/sufia.en.yml +1 -1
- data/config/routes.rb +7 -8
- data/{lib/generators/sufia/templates/migrations/acts_as_follower_migration.rb → db/migrate/20160328222155_acts_as_follower_migration.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/add_social_to_users.rb → db/migrate/20160328222156_add_social_to_users.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/add_ldap_attrs_to_user.rb → db/migrate/20160328222157_add_ldap_attrs_to_user.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/add_avatars_to_users.rb → db/migrate/20160328222158_add_avatars_to_users.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/create_local_authorities.rb → db/migrate/20160328222160_create_local_authorities.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/create_trophies.rb → db/migrate/20160328222161_create_trophies.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/add_linkedin_to_users.rb → db/migrate/20160328222162_add_linkedin_to_users.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/create_tinymce_assets.rb → db/migrate/20160328222163_create_tinymce_assets.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/create_content_blocks.rb → db/migrate/20160328222164_create_content_blocks.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/create_featured_works.rb → db/migrate/20160328222165_create_featured_works.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/add_external_key_to_content_blocks.rb → db/migrate/20160328222166_add_external_key_to_content_blocks.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/create_proxy_deposit_rights.rb → db/migrate/20160328222226_create_proxy_deposit_rights.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/create_proxy_deposit_requests.rb → db/migrate/20160328222227_create_proxy_deposit_requests.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/create_file_view_stats.rb → db/migrate/20160328222228_create_file_view_stats.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/create_file_download_stats.rb → db/migrate/20160328222229_create_file_download_stats.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/add_orcid_to_users.rb → db/migrate/20160328222230_add_orcid_to_users.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/create_user_stats.rb → db/migrate/20160328222231_create_user_stats.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/create_work_view_stats.rb → db/migrate/20160328222232_create_work_view_stats.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/add_works_to_user_stats.rb → db/migrate/20160328222233_add_works_to_user_stats.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/change_trophy_generic_file_id_to_work_id.rb → db/migrate/20160328222236_change_trophy_generic_file_id_to_work_id.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/change_proxy_deposit_generic_file_id_to_work_id.rb → db/migrate/20160328222237_change_proxy_deposit_generic_file_id_to_work_id.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/change_audit_log_generic_file_id_to_file_set_id.rb → db/migrate/20160328222238_change_audit_log_generic_file_id_to_file_set_id.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/change_proxy_deposit_request_generic_file_id_to_work_id.rb → db/migrate/20160328222239_change_proxy_deposit_request_generic_file_id_to_work_id.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/create_uploaded_files.rb → db/migrate/20160401142419_create_uploaded_files.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/change_featured_work_generic_file_id_to_work_id.rb → db/migrate/20160510000007_change_featured_work_generic_file_id_to_work_id.rb} +0 -0
- data/{lib/generators/sufia/templates/migrations/add_arkivo_to_users.rb → db/migrate/20160516190435_add_arkivo_to_users.rb} +0 -0
- data/lib/generators/sufia/arkivo_api_generator.rb +1 -8
- data/lib/generators/sufia/config_generator.rb +3 -11
- data/lib/generators/sufia/install_generator.rb +12 -46
- data/lib/generators/sufia/templates/catalog_controller.rb +10 -10
- data/lib/generators/sufia/templates/config/sufia.rb +11 -14
- data/lib/generators/sufia/upgrade700_generator.rb +1 -16
- data/lib/sufia.rb +4 -8
- data/lib/sufia/configuration.rb +132 -0
- data/lib/sufia/engine.rb +6 -46
- data/lib/sufia/resource_sync.rb +11 -0
- data/lib/sufia/resource_sync/capability_list_writer.rb +31 -0
- data/lib/sufia/resource_sync/resource_list_writer.rb +77 -0
- data/lib/sufia/resource_sync/source_description_writer.rb +30 -0
- data/lib/sufia/version.rb +1 -1
- data/spec/actors/{create_with_files_actor_spec.rb → sufia/create_with_files_actor_spec.rb} +0 -0
- data/spec/controllers/{admin_stats_controller_spec.rb → admin/stats_controller_spec.rb} +0 -0
- data/spec/controllers/batch_edits_controller_spec.rb +5 -9
- data/spec/controllers/contact_form_controller_spec.rb +88 -0
- data/spec/controllers/{file_sets_controller_spec.rb → curation_concerns/file_sets_controller_spec.rb} +1 -2
- data/spec/controllers/{generic_works_controller_spec.rb → curation_concerns/generic_works_controller_spec.rb} +1 -1
- data/spec/controllers/depositors_controller_spec.rb +1 -1
- data/spec/controllers/featured_works_controller_spec.rb +1 -1
- data/spec/controllers/mailbox_controller_spec.rb +1 -1
- data/spec/controllers/my/highlights_controller_spec.rb +15 -11
- data/spec/controllers/stats_controller_spec.rb +1 -1
- data/spec/controllers/{homepage_controller_spec.rb → sufia/homepage_controller_spec.rb} +1 -1
- data/spec/controllers/sufia/resource_sync_controller_spec.rb +52 -0
- data/spec/controllers/sufia/trophies_controller_spec.rb +27 -0
- data/spec/controllers/transfers_controller_spec.rb +7 -7
- data/spec/controllers/users_controller_spec.rb +22 -60
- data/spec/features/browse_catalog_spec.rb +1 -1
- data/spec/features/collection_spec.rb +6 -7
- data/spec/features/contact_form_spec.rb +2 -89
- data/spec/features/search_spec.rb +7 -7
- data/spec/features/users_spec.rb +1 -1
- data/spec/forms/curation_concerns/{work_form_spec.rb → generic_work_form_spec.rb} +0 -0
- data/spec/forms/sufia/{batch_edit_form_spec.rb → forms/batch_edit_form_spec.rb} +0 -0
- data/spec/forms/sufia/{batch_upload_form_spec.rb → forms/batch_upload_form_spec.rb} +0 -0
- data/spec/forms/sufia/{collection_form_spec.rb → forms/collection_form_spec.rb} +0 -0
- data/spec/helpers/blacklight_helper_spec.rb +91 -0
- data/spec/helpers/dashboard_helper_spec.rb +2 -2
- data/spec/helpers/sufia_helper_spec.rb +7 -12
- data/spec/helpers/trophy_helper_spec.rb +1 -1
- data/spec/javascripts/jasmine_spec.rb +1 -1
- data/spec/lib/sufia/resource_sync/capability_list_writer_spec.rb +26 -0
- data/spec/lib/sufia/resource_sync/resource_list_writer_spec.rb +24 -0
- data/spec/lib/sufia/resource_sync/source_description_writer_spec.rb +21 -0
- data/spec/models/featured_work_spec.rb +1 -1
- data/spec/models/generic_work_spec.rb +7 -10
- data/spec/models/local_authority_spec.rb +3 -11
- data/spec/models/{ability_spec.rb → sufia/ability_spec.rb} +0 -0
- data/spec/models/sufia/download_spec.rb +13 -0
- data/spec/models/sufia/pageview_spec.rb +13 -0
- data/spec/models/sufia/uploaded_file_spec.rb +1 -1
- data/spec/models/{user_usage_stats_spec.rb → sufia/user_usage_stats_spec.rb} +0 -0
- data/spec/models/trophy_spec.rb +5 -7
- data/spec/models/user_spec.rb +12 -12
- data/spec/presenters/{file_usage_spec.rb → sufia/file_usage_spec.rb} +4 -4
- data/spec/presenters/{presenter_renderer_spec.rb → sufia/presenter_renderer_spec.rb} +0 -0
- data/spec/presenters/sufia/user_profile_presenter_spec.rb +23 -0
- data/spec/presenters/{work_usage_spec.rb → sufia/work_usage_spec.rb} +4 -4
- data/spec/requests/legacy_routing_spec.rb +1 -1
- data/spec/routing/ownership_transfers_route_spec.rb +2 -2
- data/spec/routing/route_spec.rb +19 -16
- data/spec/services/{collection_member_service_spec.rb → sufia/collection_member_service_spec.rb} +0 -0
- data/spec/services/{collection_size_service_spec.rb → sufia/collection_size_service_spec.rb} +0 -0
- data/spec/services/{file_set_csv_service_spec.rb → sufia/file_set_csv_service_spec.rb} +0 -0
- data/spec/services/{repository_audit_service_spec.rb → sufia/repository_audit_service_spec.rb} +0 -0
- data/spec/services/{statistics → sufia/statistics}/collections/over_time_spec.rb +0 -0
- data/spec/services/{statistics → sufia/statistics}/depositors/summary_spec.rb +0 -0
- data/spec/services/{statistics → sufia/statistics}/file_sets/by_format_spec.rb +0 -0
- data/spec/services/{statistics → sufia/statistics}/system_stats_spec.rb +0 -0
- data/spec/services/{statistics → sufia/statistics}/works/by_depositor_spec.rb +0 -0
- data/spec/services/{statistics → sufia/statistics}/works/by_resource_type_spec.rb +0 -0
- data/spec/services/{statistics → sufia/statistics}/works/count_spec.rb +0 -0
- data/spec/services/{statistics → sufia/statistics}/works/over_time_spec.rb +0 -0
- data/spec/spec_helper.rb +12 -15
- data/spec/tasks/rake_spec.rb +0 -28
- data/spec/views/_toolbar.html.erb_spec.rb +1 -1
- data/spec/views/admin/stats/index.html.erb_spec.rb +2 -4
- data/spec/views/batch_edits/edit.html.erb_spec.rb +1 -2
- data/spec/views/catalog/_index_list_default.html.erb_spec.rb +14 -19
- data/spec/views/catalog/index.html.erb_spec.rb +1 -1
- data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +9 -10
- data/spec/views/collections/_form.html.erb_spec.rb +2 -2
- data/spec/views/collections/_form_for_select_collection.html.erb_spec.rb +1 -2
- data/spec/views/collections/edit.html.erb_spec.rb +1 -1
- data/spec/views/collections/show.html.erb_spec.rb +1 -1
- data/spec/views/curation_concerns/base/_form.html.erb_spec.rb +11 -33
- data/spec/views/curation_concerns/base/_form_progress.html.erb_spec.rb +3 -3
- data/spec/views/curation_concerns/base/_relationships.html.erb_spec.rb +1 -1
- data/spec/views/curation_concerns/base/edit.html.erb_spec.rb +1 -1
- data/spec/views/curation_concerns/file_sets/_versioning.html.erb_spec.rb +1 -3
- data/spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb +1 -1
- data/spec/views/dashboard/index_spec.rb +2 -4
- data/spec/views/homepage/_announcement.html.erb_spec.rb +1 -2
- data/spec/views/homepage/_featured_works.html.erb_spec.rb +9 -2
- data/spec/views/homepage/_home_header.html.erb_spec.rb +1 -1
- data/spec/views/my/_list_collections.html.erb_spec.rb +1 -1
- data/spec/views/my/_list_works.html.erb_spec.rb +1 -1
- data/spec/views/sufia/batch_uploads/_form.html.erb_spec.rb +4 -4
- data/spec/views/users/edit.html.erb_spec.rb +0 -3
- data/spec/views/users/show.html.erb_spec.rb +9 -7
- data/sufia.gemspec +1 -0
- metadata +124 -96
- data/app/controllers/directory_controller.rb +0 -30
- data/lib/generators/sufia/abstract_migration_generator.rb +0 -31
- data/lib/generators/sufia/cached_stats_generator.rb +0 -24
- data/lib/generators/sufia/cached_work_stats_generator.rb +0 -24
- data/lib/generators/sufia/citation_config_generator.rb +0 -22
- data/lib/generators/sufia/minimagick_config_generator.rb +0 -18
- data/lib/generators/sufia/orcid_field_generator.rb +0 -19
- data/lib/generators/sufia/proxies_generator.rb +0 -24
- data/lib/generators/sufia/usagestats_generator.rb +0 -18
- data/lib/generators/sufia/user_stats_generator.rb +0 -31
- data/spec/models/download_spec.rb +0 -17
- data/spec/models/pageview_spec.rb +0 -17
- data/tasks/migrate.rake +0 -20
@@ -30,10 +30,10 @@ describe 'searching' do
|
|
30
30
|
visit '/'
|
31
31
|
expect(page).to have_content("All")
|
32
32
|
expect(page).to have_css("a[data-search-label*=All]", visible: false)
|
33
|
-
expect(page).
|
34
|
-
expect(page).
|
35
|
-
expect(page).
|
36
|
-
expect(page).
|
33
|
+
expect(page).not_to have_css("a[data-search-label*='My Works']", visible: false)
|
34
|
+
expect(page).not_to have_css("a[data-search-label*='My Collections']", visible: false)
|
35
|
+
expect(page).not_to have_css("a[data-search-label*='My Highlights']", visible: false)
|
36
|
+
expect(page).not_to have_css("a[data-search-label*='My Shares']", visible: false)
|
37
37
|
|
38
38
|
click_button("All")
|
39
39
|
expect(page).to have_content("All of Sufia")
|
@@ -49,9 +49,9 @@ describe 'searching' do
|
|
49
49
|
it "does not display search options for dashboard files" do
|
50
50
|
visit "/"
|
51
51
|
within(".input-group-btn") do
|
52
|
-
expect(page).
|
53
|
-
expect(page).
|
54
|
-
expect(page).
|
52
|
+
expect(page).not_to have_content("My Works")
|
53
|
+
expect(page).not_to have_content("My Collections")
|
54
|
+
expect(page).not_to have_content("My Shares")
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
data/spec/features/users_spec.rb
CHANGED
@@ -44,7 +44,7 @@ describe "User Profile", type: :feature do
|
|
44
44
|
expect(page).to have_xpath("//td/a[@href='#{dewey_path}']")
|
45
45
|
fill_in 'user_search', with: 'Dewey'
|
46
46
|
click_button "user_submit"
|
47
|
-
expect(page).
|
47
|
+
expect(page).not_to have_xpath("//td/a[@href='#{profile_path}']")
|
48
48
|
expect(page).to have_xpath("//td/a[@href='#{dewey_path}']")
|
49
49
|
end
|
50
50
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,91 @@
|
|
1
|
+
RSpec.describe BlacklightHelper, type: :helper do
|
2
|
+
let(:blacklight_config) { CatalogController.blacklight_config }
|
3
|
+
let(:attributes) do
|
4
|
+
{ 'creator_tesim' => ['Justin', 'Joe'],
|
5
|
+
'depositor_tesim' => ['jcoyne@justincoyne.com'],
|
6
|
+
'proxy_depositor_ssim' => ['atz@stanford.edu'],
|
7
|
+
'description_tesim' => ['This links to http://example.com/ What about that?'],
|
8
|
+
'date_uploaded_dtsi' => '2013-03-14T00:00:00Z',
|
9
|
+
'rights_tesim' => ["http://creativecommons.org/publicdomain/zero/1.0/",
|
10
|
+
"http://creativecommons.org/publicdomain/mark/1.0/",
|
11
|
+
"http://www.europeana.eu/portal/rights/rr-r.html"],
|
12
|
+
'identifier_tesim' => ['65434567654345654'],
|
13
|
+
'keyword_tesim' => ['taco', 'mustache'],
|
14
|
+
'subject_tesim' => ['Awesome'],
|
15
|
+
'contributor_tesim' => ['Bird, Big'],
|
16
|
+
'publisher_tesim' => ['Penguin Random House'],
|
17
|
+
'based_near_tesim' => ['Pennsylvania'],
|
18
|
+
'language_tesim' => ['English'],
|
19
|
+
'resource_type_tesim' => ['Capstone Project'] }
|
20
|
+
end
|
21
|
+
|
22
|
+
let(:document) { SolrDocument.new(attributes) }
|
23
|
+
before do
|
24
|
+
allow(helper).to receive(:blacklight_config).and_return(blacklight_config)
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "render_index_field_value" do
|
28
|
+
include SufiaHelper
|
29
|
+
subject { render_index_field_value document, field: field_name }
|
30
|
+
|
31
|
+
context "rights_tesim" do
|
32
|
+
let(:field_name) { 'rights_tesim' }
|
33
|
+
it { is_expected.to eq "<a href=\"http://creativecommons.org/publicdomain/zero/1.0/\">CC0 1.0 Universal</a>, <a href=\"http://creativecommons.org/publicdomain/mark/1.0/\">Public Domain Mark 1.0</a>, and <a href=\"http://www.europeana.eu/portal/rights/rr-r.html\">All rights reserved</a>" }
|
34
|
+
end
|
35
|
+
|
36
|
+
context "metadata index links" do
|
37
|
+
let(:search_state) { Blacklight::SearchState.new(params, CatalogController.blacklight_config) }
|
38
|
+
before do
|
39
|
+
allow(controller).to receive(:search_state).and_return(search_state)
|
40
|
+
def search_action_path(stuff)
|
41
|
+
search_catalog_path(stuff)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context "keyword_tesim" do
|
46
|
+
let(:field_name) { 'keyword_tesim' }
|
47
|
+
it { is_expected.to eq "<span itemprop=\"keywords\"><a href=\"/catalog?f%5Bkeyword_sim%5D%5B%5D=taco\"><span itemprop=\"keywords\">taco</span></a></span> and <span itemprop=\"keywords\"><a href=\"/catalog?f%5Bkeyword_sim%5D%5B%5D=mustache\"><span itemprop=\"keywords\">mustache</span></a></span>" }
|
48
|
+
end
|
49
|
+
|
50
|
+
context "subject_tesim" do
|
51
|
+
let(:field_name) { 'subject_tesim' }
|
52
|
+
it { is_expected.to eq "<span itemprop=\"about\"><a href=\"/catalog?f%5Bsubject_sim%5D%5B%5D=Awesome\"><span itemprop=\"about\">Awesome</span></a></span>" }
|
53
|
+
end
|
54
|
+
|
55
|
+
context "creator_tesim" do
|
56
|
+
let(:field_name) { 'creator_tesim' }
|
57
|
+
it { is_expected.to eq "<span itemprop=\"creator\"><a href=\"/catalog?f%5Bcreator_sim%5D%5B%5D=Justin\"><span itemprop=\"creator\">Justin</span></a></span> and <span itemprop=\"creator\"><a href=\"/catalog?f%5Bcreator_sim%5D%5B%5D=Joe\"><span itemprop=\"creator\">Joe</span></a></span>" }
|
58
|
+
end
|
59
|
+
|
60
|
+
context "contributor_tesim" do
|
61
|
+
let(:field_name) { 'contributor_tesim' }
|
62
|
+
it { is_expected.to eq "<span itemprop=\"contributor\"><a href=\"/catalog?Bird%2C+Big=%22contributor%22&search_field=advanced\">Bird, Big</a></span>" }
|
63
|
+
end
|
64
|
+
|
65
|
+
context "publisher_tesim" do
|
66
|
+
let(:field_name) { 'publisher_tesim' }
|
67
|
+
it { is_expected.to eq "<span itemprop=\"publisher\"><a href=\"/catalog?f%5Bpublisher_sim%5D%5B%5D=Penguin+Random+House\"><span itemprop=\"publisher\">Penguin Random House</span></a></span>" }
|
68
|
+
end
|
69
|
+
|
70
|
+
context "location_tesim" do
|
71
|
+
let(:field_name) { 'based_near_tesim' }
|
72
|
+
it { is_expected.to eq "<span itemprop=\"contentLocation\"><a href=\"/catalog?f%5Bbased_near_sim%5D%5B%5D=Pennsylvania\"><span itemprop=\"contentLocation\">Pennsylvania</span></a></span>" }
|
73
|
+
end
|
74
|
+
|
75
|
+
context "language_tesim" do
|
76
|
+
let(:field_name) { 'language_tesim' }
|
77
|
+
it { is_expected.to eq "<span itemprop=\"inLanguage\"><a href=\"/catalog?f%5Blanguage_sim%5D%5B%5D=English\"><span itemprop=\"inLanguage\">English</span></a></span>" }
|
78
|
+
end
|
79
|
+
|
80
|
+
context "resource_type_tesim" do
|
81
|
+
let(:field_name) { 'resource_type_tesim' }
|
82
|
+
it { is_expected.to eq "<a href=\"/catalog?f%5Bresource_type_sim%5D%5B%5D=Capstone+Project\">Capstone Project</a>" }
|
83
|
+
end
|
84
|
+
|
85
|
+
context "identifier_tesim" do
|
86
|
+
let(:field_name) { 'identifier_tesim' }
|
87
|
+
it { is_expected.to eq "<a href=\"/catalog?65434567654345654=%22identifier%22&search_field=advanced\">65434567654345654</a>" }
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -20,7 +20,7 @@ describe DashboardHelper, type: :helper do
|
|
20
20
|
describe "#on_the_dashboard?" do
|
21
21
|
it "returns false for controllers that aren't a part of the dashboard" do
|
22
22
|
allow(helper).to receive(:params).and_return(controller: "foo")
|
23
|
-
expect(helper).
|
23
|
+
expect(helper).not_to be_on_the_dashboard
|
24
24
|
end
|
25
25
|
|
26
26
|
it "returns true for controllers that are part of the dashboard" do
|
@@ -38,7 +38,7 @@ describe DashboardHelper, type: :helper do
|
|
38
38
|
describe "#on_my_works" do
|
39
39
|
it "returns false when the controller isn't my works" do
|
40
40
|
allow(helper).to receive(:params).and_return(controller: "my/collections")
|
41
|
-
expect(helper).
|
41
|
+
expect(helper).not_to be_on_my_works
|
42
42
|
end
|
43
43
|
it "returns true when the controller is my works" do
|
44
44
|
allow(helper).to receive(:params).and_return(controller: "my/works")
|
@@ -69,21 +69,16 @@ describe SufiaHelper, type: :helper do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
describe "#link_to_telephone" do
|
72
|
-
|
73
|
-
@user = mock_model(User)
|
74
|
-
allow(@user).to receive(:telephone).and_return('867-5309')
|
75
|
-
end
|
72
|
+
subject { helper.link_to_telephone(user) }
|
76
73
|
|
77
|
-
context "when
|
78
|
-
|
79
|
-
|
80
|
-
end
|
74
|
+
context "when user is set" do
|
75
|
+
let(:user) { mock_model(User, telephone: '867-5309') }
|
76
|
+
it { is_expected.to eq "<a href=\"wtai://wp/mc;867-5309\">867-5309</a>" }
|
81
77
|
end
|
82
78
|
|
83
|
-
context "when
|
84
|
-
|
85
|
-
|
86
|
-
end
|
79
|
+
context "when user is not set" do
|
80
|
+
let(:user) { nil }
|
81
|
+
it { is_expected.to be_nil }
|
87
82
|
end
|
88
83
|
end
|
89
84
|
|
@@ -4,7 +4,7 @@ describe TrophyHelper, type: :helper do
|
|
4
4
|
let(:id) { '9999' }
|
5
5
|
|
6
6
|
let(:text_attributes) { '[data-add-text="Highlight Work on Profile"][data-remove-text="Unhighlight Work"]' }
|
7
|
-
let(:url_attribute) { "[data-url=\"/
|
7
|
+
let(:url_attribute) { "[data-url=\"/works/#{id}/trophy\"]" }
|
8
8
|
|
9
9
|
context "when there is no trophy" do
|
10
10
|
it "has a link for highlighting" do
|
@@ -15,7 +15,7 @@ describe "Jasmine" do
|
|
15
15
|
puts "************************ Jasmine Output *************\n\n"
|
16
16
|
end
|
17
17
|
expect(jasmine_out).to include "0 failures"
|
18
|
-
expect(jasmine_out).
|
18
|
+
expect(jasmine_out).not_to include "\n0 specs"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Sufia::ResourceSync::CapabilityListWriter do
|
4
|
+
let(:sitemap) { 'http://www.sitemaps.org/schemas/sitemap/0.9' }
|
5
|
+
let(:rs) { 'http://www.openarchives.org/rs/terms/' }
|
6
|
+
|
7
|
+
let(:resource_list) { 'http://example.com/resourcelist.xml' }
|
8
|
+
let(:description) { 'http://example.com/resourcesync_description.xml' }
|
9
|
+
|
10
|
+
subject { described_class.new(resource_list_url: resource_list,
|
11
|
+
description_url: description).write }
|
12
|
+
let(:xml) { Nokogiri::XML.parse(subject) }
|
13
|
+
|
14
|
+
it "has url to the capability list" do
|
15
|
+
description_href = xml.xpath('/x:urlset/rs:ln[@rel="up"]/@href', 'x' => sitemap, 'rs' => rs).map(&:value)
|
16
|
+
expect(description_href).to eq [description]
|
17
|
+
|
18
|
+
capability = xml.xpath('/x:urlset/rs:md/@capability', 'x' => sitemap, 'rs' => rs).map(&:value)
|
19
|
+
expect(capability).to eq ["capabilitylist"]
|
20
|
+
|
21
|
+
url = xml.xpath('//x:url[1]/x:loc', 'x' => sitemap).text
|
22
|
+
expect(url).to eq resource_list
|
23
|
+
capability = xml.xpath('//x:url[1]/rs:md/@capability', 'x' => sitemap, 'rs' => rs).map(&:value)
|
24
|
+
expect(capability).to eq ["resourcelist"]
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Sufia::ResourceSync::ResourceListWriter do
|
4
|
+
let(:sitemap) { 'http://www.sitemaps.org/schemas/sitemap/0.9' }
|
5
|
+
let!(:private_collection) { create(:private_collection) }
|
6
|
+
let!(:public_collection) { create(:public_collection) }
|
7
|
+
let!(:public_work) { create(:public_generic_work) }
|
8
|
+
let!(:private_work) { create(:work) }
|
9
|
+
let!(:file_set) { create(:file_set, :public) }
|
10
|
+
let(:capability_list) { 'http://example.com/capabilityList.xml' }
|
11
|
+
|
12
|
+
subject { described_class.new(resource_host: 'example.com', capability_list_url: capability_list).write }
|
13
|
+
let(:xml) { Nokogiri::XML.parse(subject) }
|
14
|
+
|
15
|
+
it "has two urls" do
|
16
|
+
first_url = xml.xpath('//x:url[1]/x:loc', 'x' => sitemap).text
|
17
|
+
second_url = xml.xpath('//x:url[2]/x:loc', 'x' => sitemap).text
|
18
|
+
third_url = xml.xpath('//x:url[3]/x:loc', 'x' => sitemap).text
|
19
|
+
expect(first_url).to eq "http://example.com/collections/#{public_collection.id}"
|
20
|
+
expect(second_url).to eq "http://example.com/concern/generic_works/#{public_work.id}"
|
21
|
+
expect(third_url).to eq "http://example.com/concern/file_sets/#{file_set.id}"
|
22
|
+
expect(xml.xpath('//x:url', 'x' => sitemap).count).to eq 3
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Sufia::ResourceSync::SourceDescriptionWriter do
|
4
|
+
let(:sitemap) { 'http://www.sitemaps.org/schemas/sitemap/0.9' }
|
5
|
+
let(:rs) { 'http://www.openarchives.org/rs/terms/' }
|
6
|
+
|
7
|
+
let(:capability_list) { 'http://example.com/capabilityList.xml' }
|
8
|
+
|
9
|
+
subject { described_class.new(capability_list_url: capability_list).write }
|
10
|
+
let(:xml) { Nokogiri::XML.parse(subject) }
|
11
|
+
|
12
|
+
it "has url to the capability list" do
|
13
|
+
capability = xml.xpath('/x:urlset/rs:md/@capability', 'x' => sitemap, 'rs' => rs).map(&:value)
|
14
|
+
expect(capability).to eq ["description"]
|
15
|
+
|
16
|
+
url = xml.xpath('//x:url[1]/x:loc', 'x' => sitemap).text
|
17
|
+
expect(url).to eq capability_list
|
18
|
+
capability = xml.xpath('//x:url[1]/rs:md/@capability', 'x' => sitemap, 'rs' => rs).map(&:value)
|
19
|
+
expect(capability).to eq ["capabilitylist"]
|
20
|
+
end
|
21
|
+
end
|
@@ -7,7 +7,7 @@ describe FeaturedWork, type: :model do
|
|
7
7
|
|
8
8
|
it "does not allow six features" do
|
9
9
|
5.times do |n|
|
10
|
-
expect(described_class.create(work_id: n.to_s)).
|
10
|
+
expect(described_class.create(work_id: n.to_s)).not_to be_new_record
|
11
11
|
end
|
12
12
|
described_class.create(work_id: "6").tap do |sixth|
|
13
13
|
expect(sixth).to be_new_record
|
@@ -36,19 +36,16 @@ describe GenericWork do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
describe "trophies" do
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
44
|
-
@t = Trophy.create(user_id: u.id, work_id: @w.id)
|
45
|
-
end
|
39
|
+
let(:user) { create(:user) }
|
40
|
+
let(:w) { create(:work, user: user) }
|
41
|
+
let!(:t) { Trophy.create(user_id: user.id, work_id: w.id) }
|
42
|
+
|
46
43
|
it "has a trophy" do
|
47
|
-
expect(Trophy.where(work_id:
|
44
|
+
expect(Trophy.where(work_id: w.id).count).to eq 1
|
48
45
|
end
|
49
46
|
it "removes all trophies when work is deleted" do
|
50
|
-
|
51
|
-
expect(Trophy.where(work_id:
|
47
|
+
w.destroy
|
48
|
+
expect(Trophy.where(work_id: w.id).count).to eq 0
|
52
49
|
end
|
53
50
|
end
|
54
51
|
|
@@ -7,14 +7,6 @@ describe LocalAuthority, type: :model do
|
|
7
7
|
LocalAuthority.harvest_tsv("geo", [fixture_path + '/cities15000.tsv'], prefix: 'http://sws.geonames.org/')
|
8
8
|
end
|
9
9
|
|
10
|
-
before :all do
|
11
|
-
class Manuscript < ActiveFedora::Base; end
|
12
|
-
end
|
13
|
-
|
14
|
-
after :all do
|
15
|
-
Object.send(:remove_const, :Manuscript)
|
16
|
-
end
|
17
|
-
|
18
10
|
it "harvests an ntriples RDF vocab" do
|
19
11
|
harvest_nt
|
20
12
|
expect(described_class.count).to eq(1)
|
@@ -59,14 +51,14 @@ describe LocalAuthority, type: :model do
|
|
59
51
|
expect(LocalAuthorityEntry.count).to eq(num_entries)
|
60
52
|
end
|
61
53
|
it "registers a vocab" do
|
62
|
-
described_class.register_vocabulary(
|
54
|
+
described_class.register_vocabulary('manuscripts', "geographic", "geo")
|
63
55
|
expect(DomainTerm.count).to eq(1)
|
64
56
|
end
|
65
57
|
|
66
58
|
describe "when vocabs are registered" do
|
67
59
|
before do
|
68
|
-
described_class.register_vocabulary(
|
69
|
-
described_class.register_vocabulary(
|
60
|
+
described_class.register_vocabulary('manuscripts', "geographic", "geo")
|
61
|
+
described_class.register_vocabulary('manuscripts', "genre", "genres")
|
70
62
|
end
|
71
63
|
|
72
64
|
it "has some domain terms" do
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
describe Sufia::Download, type: :model do
|
2
|
+
it 'has an events metric' do
|
3
|
+
expect(described_class.metrics).to be == Legato::ListParameter.new(:metrics, [:totalEvents])
|
4
|
+
end
|
5
|
+
|
6
|
+
it 'has dimensions' do
|
7
|
+
expect(described_class.dimensions).to be == Legato::ListParameter.new(:dimensions, [:eventCategory, :eventAction, :eventLabel, :date])
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'responds to :for_file' do
|
11
|
+
expect(described_class).to respond_to(:for_file)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
describe Sufia::Pageview, type: :model do
|
2
|
+
it 'has a pageviews metric' do
|
3
|
+
expect(described_class.metrics).to be == Legato::ListParameter.new(:metrics, [:pageviews])
|
4
|
+
end
|
5
|
+
|
6
|
+
it 'has a date dimension' do
|
7
|
+
expect(described_class.dimensions).to be == Legato::ListParameter.new(:dimensions, [:date])
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'responds to :for_path' do
|
11
|
+
expect(described_class).to respond_to(:for_path)
|
12
|
+
end
|
13
|
+
end
|
File without changes
|
data/spec/models/trophy_spec.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
describe Trophy, type: :model do
|
2
|
-
|
3
|
-
@trophy = described_class.create(user_id: 99, work_id: "99")
|
4
|
-
end
|
2
|
+
let(:trophy) { described_class.create(user_id: 99, work_id: "99") }
|
5
3
|
|
6
4
|
it "has a user" do
|
7
|
-
expect(
|
8
|
-
expect(
|
5
|
+
expect(trophy).to respond_to(:user_id)
|
6
|
+
expect(trophy.user_id).to eq(99)
|
9
7
|
end
|
10
8
|
|
11
9
|
it "has a work" do
|
12
|
-
expect(
|
13
|
-
expect(
|
10
|
+
expect(trophy).to respond_to(:work_id)
|
11
|
+
expect(trophy.work_id).to eq("99")
|
14
12
|
end
|
15
13
|
|
16
14
|
it "does not allow six trophies" do
|
data/spec/models/user_spec.rb
CHANGED
@@ -105,14 +105,14 @@ describe User, type: :model do
|
|
105
105
|
|
106
106
|
it "is able to follow another user" do
|
107
107
|
expect(user).to be_following(another_user)
|
108
|
-
expect(another_user).
|
108
|
+
expect(another_user).not_to be_following(user)
|
109
109
|
expect(another_user).to be_followed_by(user)
|
110
|
-
expect(user).
|
110
|
+
expect(user).not_to be_followed_by(another_user)
|
111
111
|
end
|
112
112
|
it "is able to unfollow another user" do
|
113
113
|
user.stop_following(another_user)
|
114
|
-
expect(user).
|
115
|
-
expect(another_user).
|
114
|
+
expect(user).not_to be_following(another_user)
|
115
|
+
expect(another_user).not_to be_followed_by(user)
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
@@ -154,19 +154,19 @@ describe User, type: :model do
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
describe "proxy_deposit_rights" do
|
157
|
+
subject { create :user }
|
157
158
|
before do
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
@subject.save!
|
159
|
+
subject.can_receive_deposits_from << user
|
160
|
+
subject.can_make_deposits_for << another_user
|
161
|
+
subject.save!
|
162
162
|
end
|
163
163
|
it "can_receive_deposits_from" do
|
164
|
-
expect(
|
165
|
-
expect(user.can_make_deposits_for.to_a).to eq [
|
164
|
+
expect(subject.can_receive_deposits_from.to_a).to eq [user]
|
165
|
+
expect(user.can_make_deposits_for.to_a).to eq [subject]
|
166
166
|
end
|
167
167
|
it "can_make_deposits_for" do
|
168
|
-
expect(
|
169
|
-
expect(another_user.can_receive_deposits_from.to_a).to eq [
|
168
|
+
expect(subject.can_make_deposits_for.to_a).to eq [another_user]
|
169
|
+
expect(another_user.can_receive_deposits_from.to_a).to eq [subject]
|
170
170
|
end
|
171
171
|
end
|
172
172
|
describe "class methods" do
|