sufia 4.0.1 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +247 -215
- data/README.md +7 -3
- data/SUFIA_VERSION +1 -1
- data/app/assets/javascripts/sufia.js +5 -2
- data/app/assets/javascripts/sufia/proxy_rights.js +68 -0
- data/app/assets/javascripts/sufia/transfers.js +3 -0
- data/app/assets/javascripts/sufia/user_search.js +31 -0
- data/app/assets/stylesheets/jquery-ui.css +17 -17
- data/app/assets/stylesheets/sufia.css.scss +3 -2
- data/app/assets/stylesheets/sufia/_proxy-rights.scss +10 -0
- data/app/controllers/concerns/sufia/contact_form_controller_behavior.rb +22 -23
- data/app/controllers/concerns/sufia/depositors_controller_behavior.rb +41 -0
- data/app/controllers/concerns/sufia/files_controller_behavior.rb +1 -0
- data/app/controllers/concerns/sufia/transfers_controller_behavior.rb +76 -0
- data/app/controllers/concerns/sufia/users_controller_behavior.rb +9 -11
- data/app/controllers/depositors_controller.rb +3 -0
- data/app/controllers/transfers_controller.rb +3 -0
- data/app/helpers/sufia/dashboard_helper_behavior.rb +15 -0
- data/app/helpers/sufia/sufia_helper_behavior.rb +24 -2
- data/app/jobs/content_depositor_change_event_job.rb +50 -0
- data/app/views/dashboard/_index_partials/_contents.html.erb +18 -0
- data/app/views/dashboard/_index_partials/_proxy_rights.html.erb +23 -0
- data/app/views/dashboard/_index_partials/_transfers.html.erb +14 -0
- data/app/views/generic_files/proxy.html.erb +5 -0
- data/app/views/generic_files/upload/_form.html.erb +7 -2
- data/app/views/my/_action_menu.html.erb +3 -1
- data/app/views/records/edit_fields/_default.html.erb +1 -1
- data/app/views/transfers/_received.html.erb +58 -0
- data/app/views/transfers/_sent.html.erb +38 -0
- data/app/views/transfers/index.html.erb +7 -0
- data/app/views/transfers/new.html.erb +23 -0
- data/app/views/users/_proxies.html.erb +8 -0
- data/app/views/users/_user_util_links_extra.html.erb +1 -0
- data/app/views/users/edit.html.erb +6 -1
- data/config/locales/sufia.en.yml +9 -4
- data/config/routes.rb +14 -3
- data/lib/sufia.rb +7 -5
- data/lib/sufia/version.rb +1 -1
- data/spec/controllers/authorities_controller_spec.rb +6 -6
- data/spec/controllers/batch_controller_spec.rb +29 -29
- data/spec/controllers/batch_edits_controller_spec.rb +7 -7
- data/spec/controllers/catalog_controller_spec.rb +9 -9
- data/spec/controllers/collections_controller_spec.rb +28 -28
- data/spec/controllers/content_blocks_controller_spec.rb +3 -3
- data/spec/controllers/dashboard_controller_spec.rb +1 -1
- data/spec/controllers/depositors_controller_spec.rb +50 -0
- data/spec/controllers/downloads_controller_spec.rb +22 -22
- data/spec/controllers/featured_work_lists_controller_spec.rb +1 -1
- data/spec/controllers/featured_works_controller_spec.rb +1 -1
- data/spec/controllers/generic_files_controller_spec.rb +98 -90
- data/spec/controllers/homepage_controller_spec.rb +1 -1
- data/spec/controllers/mailbox_controller_spec.rb +10 -10
- data/spec/controllers/my/collections_controller_spec.rb +1 -1
- data/spec/controllers/my/files_controller_spec.rb +1 -1
- data/spec/controllers/my/highlights_controller_spec.rb +1 -1
- data/spec/controllers/my/shares_controller_spec.rb +1 -1
- data/spec/controllers/my_controller_spec.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +1 -1
- data/spec/controllers/single_use_links_controller_spec.rb +46 -50
- data/spec/controllers/single_use_links_viewer_controller_spec.rb +16 -16
- data/spec/controllers/static_controller_spec.rb +9 -9
- data/spec/controllers/tinymce_assets_controller_spec.rb +1 -1
- data/spec/controllers/transfers_controller_spec.rb +212 -0
- data/spec/controllers/users_controller_spec.rb +1 -1
- data/spec/factories/generic_files.rb +4 -4
- data/spec/factories/proxy_deposit_requests.rb +6 -0
- data/spec/features/browse_dashboard_files_spec.rb +25 -36
- data/spec/features/browse_files_spec.rb +18 -13
- data/spec/features/catalog_search_spec.rb +3 -6
- data/spec/features/cloud_upload_spec.rb +5 -7
- data/spec/features/collection_spec.rb +28 -35
- data/spec/features/contact_form_spec.rb +24 -24
- data/spec/features/display_dashboard_spec.rb +11 -11
- data/spec/features/ingest_upload_files_spec.rb +10 -10
- data/spec/features/notifications_spec.rb +11 -11
- data/spec/features/ownership_transfer_spec.rb +111 -0
- data/spec/features/proxy_spec.rb +52 -0
- data/spec/features/search_spec.rb +1 -1
- data/spec/features/single_use_links_spec.rb +28 -18
- data/spec/features/users_spec.rb +3 -3
- data/spec/helpers/batch_edits_helper_spec.rb +1 -1
- data/spec/helpers/content_block_helper_spec.rb +1 -1
- data/spec/helpers/dashboard_helper_spec.rb +1 -1
- data/spec/helpers/generic_file_helper_spec.rb +1 -1
- data/spec/helpers/records_helper_spec.rb +1 -1
- data/spec/helpers/sufia_helper_spec.rb +8 -8
- data/spec/helpers/trophy_helper_spec.rb +1 -1
- data/spec/jobs/audit_job_spec.rb +5 -5
- data/spec/jobs/batch_update_job_spec.rb +14 -14
- data/spec/jobs/content_depositor_change_event_job_spec.rb +22 -0
- data/spec/jobs/event_jobs_spec.rb +104 -104
- data/spec/jobs/import_url_job_spec.rb +2 -2
- data/spec/jobs/ingest_local_file_job_spec.rb +1 -1
- data/spec/lib/sufia/breadcrumbs_spec.rb +3 -3
- data/spec/lib/sufia/id_service_spec.rb +1 -1
- data/spec/lib/sufia/upload_complete_behavior_spec.rb +4 -4
- data/spec/models/ability_spec.rb +59 -15
- data/spec/models/batch_spec.rb +16 -16
- data/spec/models/characterization_spec.rb +1 -1
- data/spec/models/checksum_audit_log_spec.rb +34 -26
- data/spec/models/collection_spec.rb +1 -1
- data/spec/models/download_spec.rb +1 -1
- data/spec/models/featured_work_list_spec.rb +1 -1
- data/spec/models/featured_work_spec.rb +15 -4
- data/spec/models/file_content_datastream_spec.rb +14 -14
- data/spec/models/file_usage_spec.rb +1 -1
- data/spec/models/fits_datastream_spec.rb +1 -1
- data/spec/models/generic_file/reload_on_save_spec.rb +4 -4
- data/spec/models/generic_file/visibility_spec.rb +1 -1
- data/spec/models/generic_file/web_form_spec.rb +6 -5
- data/spec/models/generic_file_rdf_datastream_spec.rb +1 -1
- data/spec/models/generic_file_spec.rb +254 -220
- data/spec/models/geo_names_resource_spec.rb +2 -2
- data/spec/models/local_authority_spec.rb +60 -59
- data/spec/models/pageview_spec.rb +1 -1
- data/spec/models/properties_datastream_spec.rb +29 -10
- data/spec/models/proxy_deposit_request_spec.rb +107 -0
- data/spec/models/single_use_link_spec.rb +13 -13
- data/spec/models/solr_document_spec.rb +1 -1
- data/spec/models/trophy_spec.rb +6 -6
- data/spec/models/user_spec.rb +38 -22
- data/spec/routing/featured_works_route_spec.rb +1 -1
- data/spec/routing/ownership_transfers_route_spec.rb +45 -0
- data/spec/routing/route_spec.rb +42 -42
- data/spec/services/noid_spec.rb +2 -2
- data/spec/spec_helper.rb +10 -5
- data/spec/support/cleaner.rb +12 -0
- data/spec/support/features.rb +5 -0
- data/spec/support/features/session_helpers.rb +3 -17
- data/spec/support/locations.rb +36 -0
- data/spec/support/poltergeist.rb +11 -0
- data/spec/support/proxies.rb +14 -0
- data/spec/support/selectors.rb +122 -0
- data/spec/views/batch/edit.html.erb_spec.rb +1 -1
- data/spec/views/batch_edits/check_all_spec.rb +4 -4
- data/spec/views/catalog/index.html.erb_spec.rb +1 -1
- data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +1 -1
- data/spec/views/collections/_form.html.erb_spec.rb +3 -1
- data/spec/views/collections/_show_descriptions.html.erb_spec.rb +1 -1
- data/spec/views/dashboard/index_spec.rb +3 -6
- data/spec/views/generic_file/edit.html.erb_spec.rb +1 -1
- data/spec/views/generic_file/show.html.erb_spec.rb +1 -1
- data/spec/views/generic_file/stats.html.erb_spec.rb +1 -1
- data/spec/views/my/facet.html.erb_spec.rb +2 -2
- data/spec/views/users/_follower_modal.html.erb_spec.rb +1 -1
- data/spec/views/users/_following_modal.html.erb_spec.rb +1 -1
- data/spec/views/users/_notify_number.html.erb_spec.rb +1 -1
- data/spec/views/users/_user_util_links.html.erb_spec.rb +1 -1
- data/spec/views/users/index.html.erb_spec.rb +2 -2
- data/spec/views/users/show.html.erb_spec.rb +2 -2
- data/sufia-models/app/models/concerns/sufia/ability.rb +22 -0
- data/sufia-models/app/models/concerns/sufia/generic_file.rb +1 -0
- data/sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb +22 -0
- data/sufia-models/app/models/concerns/sufia/properties_datastream_behavior.rb +3 -0
- data/sufia-models/app/models/concerns/sufia/user.rb +9 -0
- data/sufia-models/app/models/proxy_deposit_request.rb +85 -0
- data/sufia-models/app/models/proxy_deposit_rights.rb +4 -0
- data/sufia-models/app/models/sufia/avatar_uploader.rb +2 -3
- data/sufia-models/lib/generators/sufia/models/install_generator.rb +9 -1
- data/sufia-models/lib/generators/sufia/models/proxies_generator.rb +53 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_requests.rb +16 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_rights.rb +11 -0
- data/sufia-models/lib/sufia/models/engine.rb +1 -1
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- data/sufia.gemspec +2 -1
- data/tasks/sufia-dev.rake +5 -0
- metadata +82 -6
- data/tasks/sufia-db.rake +0 -21
@@ -0,0 +1,12 @@
|
|
1
|
+
module CleanerHelper
|
2
|
+
# Removes any data in Fedora and Solr
|
3
|
+
def cleanup_jetty
|
4
|
+
ActiveFedora::Base.delete_all
|
5
|
+
Blacklight.solr.delete_by_query("*:*")
|
6
|
+
Blacklight.solr.commit
|
7
|
+
end
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.include CleanerHelper
|
11
|
+
end
|
12
|
+
end
|
data/spec/support/features.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# spec/support/features.rb
|
2
2
|
require File.expand_path('../features/session_helpers', __FILE__)
|
3
3
|
require File.expand_path('../fixture_helpers', __FILE__)
|
4
|
+
require File.expand_path('../selectors', __FILE__)
|
5
|
+
require File.expand_path('../proxies', __FILE__)
|
6
|
+
require File.expand_path('../locations', __FILE__)
|
7
|
+
require File.expand_path('../poltergeist', __FILE__)
|
8
|
+
require File.expand_path('../cleaner', __FILE__)
|
4
9
|
|
5
10
|
RSpec.configure do |config|
|
6
11
|
config.include Features::SessionHelpers, type: :feature
|
@@ -1,28 +1,14 @@
|
|
1
1
|
# spec/support/features/session_helpers.rb
|
2
2
|
module Features
|
3
3
|
module SessionHelpers
|
4
|
-
def sign_up_with(email, password)
|
5
|
-
Capybara.exact = true
|
6
|
-
visit new_user_registration_path
|
7
|
-
fill_in 'Email', with: email
|
8
|
-
fill_in 'Password', with: password
|
9
|
-
fill_in 'Password confirmation', with: password
|
10
|
-
click_button 'Sign up'
|
11
|
-
end
|
12
|
-
|
13
4
|
def sign_in(who = :user)
|
14
|
-
|
15
|
-
|
16
|
-
else
|
17
|
-
FactoryGirl.build(:user).tap do |u|
|
18
|
-
u.save!
|
19
|
-
end
|
20
|
-
end
|
5
|
+
logout
|
6
|
+
user = who.is_a?(User) ? who : FactoryGirl.build(:user).tap { |u| u.save! }
|
21
7
|
visit new_user_session_path
|
22
8
|
fill_in 'Email', with: user.email
|
23
9
|
fill_in 'Password', with: user.password
|
24
10
|
click_button 'Log in'
|
25
|
-
expect(page).
|
11
|
+
expect(page).not_to have_text 'Invalid email or password.'
|
26
12
|
end
|
27
13
|
end
|
28
14
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Locations
|
2
|
+
def go_to_dashboard
|
3
|
+
visit '/dashboard'
|
4
|
+
# causes selenium to wait until text appears on the page
|
5
|
+
expect(page).to have_content('My Dashboard')
|
6
|
+
end
|
7
|
+
|
8
|
+
def go_to_dashboard_files
|
9
|
+
visit '/dashboard/files'
|
10
|
+
expect(page).to have_selector('li.active', text: "My Files")
|
11
|
+
end
|
12
|
+
|
13
|
+
def go_to_dashboard_collections
|
14
|
+
visit '/dashboard/collections'
|
15
|
+
expect(page).to have_content('My Collections')
|
16
|
+
end
|
17
|
+
|
18
|
+
def go_to_dashboard_shares
|
19
|
+
visit '/dashboard/shares'
|
20
|
+
expect(page).to have_content('Files Shared with Me')
|
21
|
+
end
|
22
|
+
|
23
|
+
def go_to_dashboard_highlights
|
24
|
+
visit '/dashboard/highlights'
|
25
|
+
expect(page).to have_content('My Highlights')
|
26
|
+
end
|
27
|
+
|
28
|
+
def go_to_user_profile
|
29
|
+
first(".dropdown-toggle").click
|
30
|
+
click_link "my profile"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec.configure do |config|
|
35
|
+
config.include Locations
|
36
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# This file causes capybara to use the phantomjs browser, which is fully
|
2
|
+
# compatible with ajax
|
3
|
+
require 'capybara/poltergeist'
|
4
|
+
|
5
|
+
# Register driver and tell it not to print javascript
|
6
|
+
Capybara.register_driver :poltergeist do |app|
|
7
|
+
Capybara::Poltergeist::Driver.new(app, js_errors: true, timeout: 90)
|
8
|
+
end
|
9
|
+
|
10
|
+
Capybara.default_driver = :poltergeist
|
11
|
+
Capybara.javascript_driver = :poltergeist
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module ProxiesHelper
|
2
|
+
def create_proxy_using_partial(*users)
|
3
|
+
users.each do |user|
|
4
|
+
first('a.select2-choice').click
|
5
|
+
find(".select2-input").set(user.user_key)
|
6
|
+
expect(page).to have_css("div.select2-result-label")
|
7
|
+
first("div.select2-result-label").click
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.include ProxiesHelper
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
module Selectors
|
2
|
+
|
3
|
+
module Header
|
4
|
+
|
5
|
+
def user_notifications_link
|
6
|
+
within '#user_utility_links' do
|
7
|
+
find '#notify_link'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def user_utility_toggle
|
12
|
+
within '#user_utility_links' do
|
13
|
+
find '.dropdown-toggle.btn.btn-default'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module Dashboard
|
19
|
+
|
20
|
+
def db_item_actions_toggle item
|
21
|
+
within "#document_#{item.noid}" do
|
22
|
+
find '.dropdown-toggle'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def db_item_title item
|
27
|
+
within "#document_#{item.noid}" do
|
28
|
+
find "#src_copy_link#{item.noid}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def db_file_checkbox file
|
33
|
+
within "#document_#{file.noid}" do
|
34
|
+
find '.batch_document_selector'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def db_collection_radio_button collection
|
39
|
+
within '#collection-list-container' do
|
40
|
+
find "input[id*='#{collection.noid}']"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def db_create_empty_collection_button
|
45
|
+
first '#hydra-collection-add'
|
46
|
+
end
|
47
|
+
|
48
|
+
def db_create_populated_collection_button
|
49
|
+
within '#collection-list-container' do
|
50
|
+
first '#hydra-collection-add'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def db_visibility_link file
|
55
|
+
within "#document_#{file.noid}" do
|
56
|
+
find "a#permission_#{file.noid}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def db_facet_category_toggle id
|
61
|
+
find("a[data-target='#{id}']")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
module EditCollections
|
66
|
+
|
67
|
+
def ec_update_submit
|
68
|
+
within '.col-xs-12.col-sm-10' do
|
69
|
+
within '.primary-actions' do
|
70
|
+
find_button 'Update Collection'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
module NewTransfers
|
78
|
+
|
79
|
+
def new_owner_dropdown
|
80
|
+
find '#s2id_proxy_deposit_request_transfer_to'
|
81
|
+
end
|
82
|
+
|
83
|
+
def new_owner_search_field
|
84
|
+
within '#select2-drop' do
|
85
|
+
find '.select2-input'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def new_owner_search_result
|
90
|
+
within '#select2-drop' do
|
91
|
+
find '.select2-result-selectable'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def submit_button
|
96
|
+
within '#new_transfer' do
|
97
|
+
find 'input[type=submit]'
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
module Transfers
|
103
|
+
|
104
|
+
def first_sent_cancel_button
|
105
|
+
within '#outgoing-transfers' do
|
106
|
+
find '.btn.btn-danger'
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def first_received_accept_dropdown
|
111
|
+
within '#incoming-transfers' do
|
112
|
+
find '.dropdown-toggle.accept'
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def first_received_reject_button
|
117
|
+
within '#incoming-transfers' do
|
118
|
+
find '.btn.btn-danger'
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'Check All' do
|
3
|
+
describe 'Check All', :type => :view do
|
4
4
|
before (:all) do
|
5
5
|
@document_list = ['a','b','c']
|
6
6
|
@batch_size_on_other_page = 0
|
@@ -11,14 +11,14 @@ describe 'Check All' do
|
|
11
11
|
allow(controller).to receive(:controller_name).and_return('batch_edits')
|
12
12
|
controller.prepend_view_path "app/views/batch_edits"
|
13
13
|
html = render partial: 'batch_edits/check_all'
|
14
|
-
html.
|
14
|
+
expect(html).to have_selector("li[data-behavior='batch-edit-select-abc']")
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should render actions for my items' do
|
18
18
|
allow(controller).to receive(:controller_name).and_return('my')
|
19
19
|
controller.prepend_view_path "app/views/my"
|
20
20
|
html = render partial: 'batch_edits/check_all'
|
21
|
-
html.
|
22
|
-
html.
|
21
|
+
expect(html).to have_selector("li[data-behavior='batch-edit-select-none']")
|
22
|
+
expect(html).to have_selector("li[data-behavior='batch-edit-select-page']")
|
23
23
|
end
|
24
24
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'catalog/index.html.erb' do
|
3
|
+
describe 'catalog/index.html.erb', :type => :view do
|
4
4
|
before do
|
5
5
|
allow(view).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
|
6
6
|
stub_template 'catalog/_search_sidebar.html.erb' => ''
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'catalog/_sort_and_per_page.html.erb' do
|
3
|
+
describe 'catalog/_sort_and_per_page.html.erb', :type => :view do
|
4
4
|
before do
|
5
5
|
allow(controller).to receive(:current_user).and_return(stub_model(User))
|
6
6
|
allow_any_instance_of(Ability).to receive(:can?).and_return(true)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'collections/_form.html.erb' do
|
3
|
+
describe 'collections/_form.html.erb', :type => :view do
|
4
4
|
describe 'when the collection edit form is rendered' do
|
5
5
|
let(:collection) { Collection.new({title: 'the title', description: 'the description',
|
6
6
|
creator: 'the creator'})}
|
@@ -14,7 +14,9 @@ describe 'collections/_form.html.erb' do
|
|
14
14
|
it "should draw the metadata fields for collection" do
|
15
15
|
render
|
16
16
|
expect(rendered).to have_selector("input#collection_title", count: 1)
|
17
|
+
expect(rendered).to_not have_selector("div#additional_title_clone button.adder")
|
17
18
|
expect(rendered).to have_selector("input#collection_creator", count: 1)
|
19
|
+
expect(rendered).to have_selector("div#additional_creator_clone button.adder")
|
18
20
|
expect(rendered).to have_selector("textarea#collection_description", count: 1)
|
19
21
|
expect(rendered).to have_selector("input#collection_contributor", count: 1)
|
20
22
|
expect(rendered).to have_selector("input#collection_tag", count: 1)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "dashboard/index.html.erb" do
|
3
|
+
describe "dashboard/index.html.erb", :type => :view do
|
4
4
|
|
5
5
|
before do
|
6
6
|
@user = mock_model(User, name: "Charles Francis Xavier", user_key: "charles")
|
@@ -8,8 +8,10 @@ describe "dashboard/index.html.erb" do
|
|
8
8
|
allow(@user).to receive(:department).and_return("Xavier’s School for Gifted Youngsters")
|
9
9
|
allow(@user).to receive(:telephone).and_return("814.865.8399")
|
10
10
|
allow(@user).to receive(:email).and_return("chuck@xsgy.edu")
|
11
|
+
allow(@user).to receive(:login).and_return("chuck")
|
11
12
|
allow(@user).to receive(:all_following).and_return(["magneto"])
|
12
13
|
allow(@user).to receive(:followers).and_return(["wolverine","storm"])
|
14
|
+
allow(@user).to receive(:can_receive_deposits_from).and_return([])
|
13
15
|
allow(controller).to receive(:current_user).and_return(@user)
|
14
16
|
allow(view).to receive(:number_of_files).and_return("15")
|
15
17
|
allow(view).to receive(:number_of_collections).and_return("3")
|
@@ -110,11 +112,9 @@ describe "dashboard/index.html.erb" do
|
|
110
112
|
expect(rendered).to include "Single File 1"
|
111
113
|
end
|
112
114
|
|
113
|
-
|
114
115
|
end
|
115
116
|
|
116
117
|
context "without activities and notifications" do
|
117
|
-
|
118
118
|
it "should include headings for activities and notifications" do
|
119
119
|
render
|
120
120
|
expect(rendered).to include "User Activity"
|
@@ -126,9 +126,6 @@ describe "dashboard/index.html.erb" do
|
|
126
126
|
expect(rendered).to include "User has no notifications"
|
127
127
|
expect(rendered).to include "User has no recent activity"
|
128
128
|
end
|
129
|
-
|
130
129
|
end
|
131
|
-
|
132
130
|
end
|
133
|
-
|
134
131
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'generic_files/edit.html.erb' do
|
3
|
+
describe 'generic_files/edit.html.erb', :type => :view do
|
4
4
|
describe 'when the file has two or more resource types' do
|
5
5
|
let(:generic_file) {
|
6
6
|
content = double('content', versions: [], mimeType: 'application/pdf')
|
@@ -3,12 +3,12 @@ require 'spec_helper'
|
|
3
3
|
# Note: this is a direct copy of the corresponding test in Blacklight
|
4
4
|
# with changes for "views/my" instead of "views/catalog"
|
5
5
|
|
6
|
-
describe "my/facet.html.erb" do
|
6
|
+
describe "my/facet.html.erb", :type => :view do
|
7
7
|
let(:display_facet) { double }
|
8
8
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
9
9
|
before do
|
10
10
|
blacklight_config.add_facet_field "xyz", label: "Facet title"
|
11
|
-
view.
|
11
|
+
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
12
12
|
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
13
13
|
stub_template "my/_facet_pagination.html.erb" => "pagination"
|
14
14
|
assign :facet, blacklight_config.facet_fields["xyz"]
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'users/index.html.erb' do
|
3
|
+
describe 'users/index.html.erb', :type => :view do
|
4
4
|
|
5
5
|
let(:join_date) { 5.days.ago }
|
6
6
|
before do
|
7
7
|
users = []
|
8
8
|
(1..25).each {|i| users << stub_model(User, name: "name#{i}", user_key: "user#{i}", created_at: join_date)}
|
9
|
-
User.
|
9
|
+
allow(User).to receive_message_chain(:all).and_return(users)
|
10
10
|
relation = User.all
|
11
11
|
allow(relation).to receive(:limit_value).and_return(10)
|
12
12
|
allow(relation).to receive(:current_page).and_return(1)
|