blacklight-spotlight 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spotlight/reindex_monitor.js +109 -0
- data/app/assets/stylesheets/spotlight/_blacklight_configuration.scss +9 -8
- data/app/assets/stylesheets/spotlight/_bootstrap_overrides.scss +15 -7
- data/app/assets/stylesheets/spotlight/_header.scss +67 -90
- data/app/assets/stylesheets/spotlight/_variables.scss +4 -0
- data/app/controllers/spotlight/attachments_controller.rb +2 -5
- data/app/controllers/spotlight/browse_controller.rb +15 -3
- data/app/controllers/spotlight/resources_controller.rb +4 -0
- data/app/controllers/spotlight/roles_controller.rb +1 -1
- data/app/controllers/spotlight/sites_controller.rb +50 -0
- data/app/helpers/spotlight/application_helper.rb +2 -1
- data/app/helpers/spotlight/navbar_helper.rb +1 -1
- data/app/jobs/spotlight/reindex_job.rb +17 -8
- data/app/models/concerns/spotlight/user.rb +8 -4
- data/app/models/spotlight/ability.rb +5 -4
- data/app/models/spotlight/exhibit.rb +15 -1
- data/app/models/spotlight/reindex_progress.rb +107 -0
- data/app/models/spotlight/resource.rb +4 -0
- data/app/models/spotlight/role.rb +2 -2
- data/app/models/spotlight/site.rb +16 -0
- data/app/views/devise/mailer/invitation_instructions.html.erb +1 -1
- data/app/views/layouts/spotlight/spotlight.html.erb +1 -1
- data/app/views/shared/_breadcrumbs.html.erb +1 -1
- data/app/views/shared/_exhibit_navbar.html.erb +6 -7
- data/app/views/shared/_masthead.html.erb +32 -0
- data/app/views/shared/_site_sidebar.html.erb +16 -0
- data/app/views/spotlight/about_pages/_sidebar.html.erb +4 -2
- data/app/views/spotlight/browse/_search_title.html.erb +1 -1
- data/app/views/spotlight/browse/index.html.erb +6 -4
- data/app/views/spotlight/browse/show.html.erb +6 -8
- data/app/views/spotlight/catalog/_admin_header.html.erb +15 -12
- data/app/views/spotlight/catalog/_reindex_progress_panel.html.erb +21 -0
- data/app/views/spotlight/exhibits/index.html.erb +4 -2
- data/app/views/spotlight/featured_images/_upload_form.html.erb +17 -0
- data/app/views/spotlight/home_pages/_empty.html.erb +1 -1
- data/app/views/spotlight/metadata_configurations/_metadata_field.html.erb +2 -2
- data/app/views/spotlight/metadata_configurations/edit.html.erb +3 -3
- data/app/views/spotlight/shared/_configuration_sidebar.html.erb +2 -2
- data/app/views/spotlight/shared/_curation_sidebar.html.erb +1 -1
- data/app/views/spotlight/sites/_exhibit.html.erb +18 -0
- data/app/views/spotlight/sites/edit.html.erb +40 -0
- data/app/views/spotlight/sites/edit_exhibits.html.erb +32 -0
- data/config/locales/spotlight.en.yml +30 -2
- data/config/routes.rb +5 -0
- data/db/migrate/20151210073829_create_spotlight_site.rb +9 -0
- data/db/migrate/20151211131415_add_site_to_spotlight_exhibits.rb +23 -0
- data/db/migrate/20151215141516_change_roles_to_support_polymorphic_associations.rb +40 -0
- data/db/migrate/20151215192845_add_index_status_to_resources.rb +6 -0
- data/lib/spotlight/controller.rb +18 -7
- data/lib/spotlight/engine.rb +37 -35
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/contacts_controller_spec.rb +2 -2
- data/spec/controllers/spotlight/home_pages_controller_spec.rb +2 -4
- data/spec/controllers/spotlight/resources_controller_spec.rb +14 -0
- data/spec/controllers/spotlight/roles_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/sites_controller_spec.rb +48 -0
- data/spec/controllers/spotlight/versions_controller_spec.rb +1 -2
- data/spec/factories/roles.rb +1 -1
- data/spec/factories/users.rb +3 -3
- data/spec/features/add_contacts_spec.rb +2 -2
- data/spec/features/browse_category_spec.rb +65 -0
- data/spec/features/edit_contact_spec.rb +2 -2
- data/spec/features/exhibit_masthead_spec.rb +100 -0
- data/spec/features/javascript/reindex_monitor_spec.rb +22 -0
- data/spec/features/site_masthead_spec.rb +17 -52
- data/spec/helpers/spotlight/application_helper_spec.rb +16 -0
- data/spec/lib/spotlight/controller_spec.rb +34 -8
- data/spec/models/spotlight/ability_spec.rb +3 -4
- data/spec/models/spotlight/exhibit_spec.rb +23 -0
- data/spec/models/spotlight/reindex_progress_spec.rb +104 -0
- data/spec/models/spotlight/site_spec.rb +9 -0
- data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +3 -9
- data/spec/views/shared/_masthead.html.erb_spec.rb +83 -0
- data/spec/views/spotlight/browse/show.html.erb_spec.rb +2 -2
- data/spec/views/spotlight/catalog/admin.html.erb_spec.rb +1 -0
- data/spec/views/spotlight/roles/index.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/sites/edit_exhibits.html.erb_spec.rb +29 -0
- metadata +33 -14
- data/app/views/shared/_exhibit_masthead.html.erb +0 -20
- data/app/views/shared/_exhibit_masthead_and_navbar.html.erb +0 -9
- data/app/views/shared/_home_sidebar.html.erb +0 -1
- data/app/views/spotlight/attachments/_form.html.erb +0 -29
- data/app/views/spotlight/attachments/edit.html.erb +0 -6
- data/app/views/spotlight/attachments/index.html.erb +0 -31
- data/app/views/spotlight/attachments/new.html.erb +0 -5
- data/app/views/spotlight/attachments/show.html.erb +0 -19
- data/spec/views/shared/_exhibit_masthead.html.erb_spec.rb +0 -70
- data/spec/views/shared/_exhibit_masthead_and_navbar.html.erb_spec.rb +0 -36
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'Add a contact to an exhibit', type: :feature do
|
4
|
-
let(:curator) { FactoryGirl.create(:exhibit_curator) }
|
5
|
-
let(:exhibit) {
|
4
|
+
let(:curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
|
5
|
+
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
6
6
|
let!(:about_page) { FactoryGirl.create(:about_page, exhibit: exhibit) }
|
7
7
|
before { login_as curator }
|
8
8
|
it 'displays a newly added contact in the sidebar' do
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature 'Browse pages' do
|
4
|
+
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
5
|
+
|
6
|
+
context 'a browse page' do
|
7
|
+
let!(:search) { FactoryGirl.create(:search, title: 'Some Saved Search', exhibit: exhibit, published: true) }
|
8
|
+
context 'with the standard exhibit masthead' do
|
9
|
+
it 'includes the search title and resource count in the body' do
|
10
|
+
visit spotlight.exhibit_browse_path(exhibit, search)
|
11
|
+
|
12
|
+
within '#main-container' do
|
13
|
+
expect(page).to have_selector 'h1', text: 'Some Saved Search'
|
14
|
+
end
|
15
|
+
|
16
|
+
expect(page).not_to have_selector '.masthead .h1', text: 'Some Saved Search'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'shows the search bar' do
|
20
|
+
visit spotlight.exhibit_browse_path(exhibit, search)
|
21
|
+
|
22
|
+
expect(page).to have_selector '.search-query-form'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'has breadcrumbs' do
|
26
|
+
visit spotlight.exhibit_browse_path(exhibit, search)
|
27
|
+
|
28
|
+
expect(page).to have_selector '.breadcrumbs-container'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'with a custom masthead' do
|
33
|
+
let(:masthead) { FactoryGirl.create(:masthead, display: true) }
|
34
|
+
|
35
|
+
before do
|
36
|
+
search.masthead = masthead
|
37
|
+
search.save
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'has a contextual masthead with the title and resource count' do
|
41
|
+
visit spotlight.exhibit_browse_path(exhibit, search)
|
42
|
+
|
43
|
+
expect(page).to have_selector '.masthead .h1', text: 'Some Saved Search'
|
44
|
+
|
45
|
+
within '#main-container' do
|
46
|
+
expect(page).not_to have_selector 'h1', text: 'Some Saved Search'
|
47
|
+
end
|
48
|
+
|
49
|
+
expect(page).to have_selector '.masthead small.item-count', text: /\d+ items/
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'does not show the search bar' do
|
53
|
+
visit spotlight.exhibit_browse_path(exhibit, search)
|
54
|
+
|
55
|
+
expect(page).not_to have_selector '.search-query-form'
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'does not have breadcrumbs' do
|
59
|
+
visit spotlight.exhibit_browse_path(exhibit, search)
|
60
|
+
|
61
|
+
expect(page).not_to have_selector '.breadcrumbs-container'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'Add a contact to an exhibit', type: :feature do
|
4
|
-
let(:curator) { FactoryGirl.create(:exhibit_curator) }
|
5
|
-
let(:exhibit) {
|
4
|
+
let(:curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
|
5
|
+
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
6
6
|
let!(:about_page) { FactoryGirl.create(:about_page, exhibit: exhibit) }
|
7
7
|
let!(:contact) { FactoryGirl.create(:contact, name: 'Marcus Aurelius', exhibit: exhibit) }
|
8
8
|
before { login_as curator }
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Add and update the site masthead', type: :feature do
|
4
|
+
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
5
|
+
let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
|
6
|
+
|
7
|
+
before { login_as user }
|
8
|
+
it 'updates exhibit masthead options' do
|
9
|
+
visit spotlight.exhibit_dashboard_path(exhibit)
|
10
|
+
|
11
|
+
within '#sidebar' do
|
12
|
+
click_link 'Appearance'
|
13
|
+
end
|
14
|
+
|
15
|
+
click_link 'Site masthead'
|
16
|
+
|
17
|
+
within '#site-masthead' do
|
18
|
+
check 'Show background image in masthead'
|
19
|
+
choose 'Upload an image'
|
20
|
+
attach_file('exhibit_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
21
|
+
end
|
22
|
+
|
23
|
+
click_button 'Save changes'
|
24
|
+
|
25
|
+
expect(page).to have_content('The exhibit was successfully updated.')
|
26
|
+
|
27
|
+
within '#sidebar' do
|
28
|
+
click_link 'Appearance'
|
29
|
+
end
|
30
|
+
|
31
|
+
click_link 'Site masthead'
|
32
|
+
|
33
|
+
within '#site-masthead' do
|
34
|
+
expect(field_labeled('Show background image in masthead')).to be_checked
|
35
|
+
expect(field_labeled('Upload an image')).to be_checked
|
36
|
+
end
|
37
|
+
end
|
38
|
+
it 'displays a masthead image when one is uploaded and configured' do
|
39
|
+
visit spotlight.exhibit_dashboard_path(exhibit)
|
40
|
+
expect(page).to_not have_css('.image-masthead')
|
41
|
+
within '#sidebar' do
|
42
|
+
click_link 'Appearance'
|
43
|
+
end
|
44
|
+
|
45
|
+
click_link 'Site masthead'
|
46
|
+
|
47
|
+
within '#site-masthead' do
|
48
|
+
check 'Show background image in masthead'
|
49
|
+
|
50
|
+
attach_file('exhibit_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
51
|
+
end
|
52
|
+
|
53
|
+
click_button 'Save changes'
|
54
|
+
|
55
|
+
expect(page).to have_content('The exhibit was successfully updated.')
|
56
|
+
|
57
|
+
expect(page).to have_css('.image-masthead .background-container')
|
58
|
+
end
|
59
|
+
it 'does not display an uploaded masthead if configured to not display' do
|
60
|
+
visit spotlight.exhibit_dashboard_path(exhibit)
|
61
|
+
expect(page).to_not have_css('.image-masthead')
|
62
|
+
within '#sidebar' do
|
63
|
+
click_link 'Appearance'
|
64
|
+
end
|
65
|
+
|
66
|
+
click_link 'Site masthead'
|
67
|
+
|
68
|
+
within '#site-masthead' do
|
69
|
+
attach_file('exhibit_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
70
|
+
end
|
71
|
+
|
72
|
+
click_button 'Save changes'
|
73
|
+
|
74
|
+
expect(page).to have_content('The exhibit was successfully updated.')
|
75
|
+
|
76
|
+
expect(page).to_not have_css('.image-masthead .background-container')
|
77
|
+
end
|
78
|
+
it 'displays a masthead image when one is uploaded from an exhibit item', js: true do
|
79
|
+
skip "Capyabara and jcrop don't play well together.."
|
80
|
+
visit spotlight.exhibit_dashboard_path(exhibit)
|
81
|
+
expect(page).to_not have_css('.image-masthead')
|
82
|
+
within '#sidebar' do
|
83
|
+
click_link 'Appearance'
|
84
|
+
end
|
85
|
+
|
86
|
+
click_link 'Site masthead'
|
87
|
+
|
88
|
+
within '#site-masthead' do
|
89
|
+
check 'Show background image in masthead'
|
90
|
+
|
91
|
+
fill_in_typeahead_field 'document_title', with: 'Armenia'
|
92
|
+
end
|
93
|
+
|
94
|
+
click_button 'Save changes'
|
95
|
+
|
96
|
+
expect(page).to have_content('The appearance was successfully updated.')
|
97
|
+
|
98
|
+
expect(page).to have_css('.image-masthead .background-container')
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature 'Reindex Monitor', js: true do
|
4
|
+
let(:resources) do
|
5
|
+
[FactoryGirl.create(:resource, updated_at: Time.zone.now, index_status: 1)]
|
6
|
+
end
|
7
|
+
let(:exhibit) { FactoryGirl.create(:exhibit, resources: resources) }
|
8
|
+
let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
|
9
|
+
|
10
|
+
before do
|
11
|
+
login_as exhibit_curator
|
12
|
+
visit spotlight.admin_exhibit_catalog_index_path(exhibit)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'is rendered on the item admin page' do
|
16
|
+
expect(page).to have_css('.panel.index-status', visible: true)
|
17
|
+
within('.panel.index-status') do
|
18
|
+
expect(page).to have_css('p', text: /Began reindexing a total of \d items/)
|
19
|
+
expect(page).to have_css('p', text: /Reindexed \d of \d items/)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,100 +1,65 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'Add and update the site masthead', type: :feature do
|
4
|
-
let(:
|
5
|
-
let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
|
4
|
+
let(:user) { FactoryGirl.create(:site_admin) }
|
6
5
|
|
7
6
|
before { login_as user }
|
8
|
-
it 'updates site masthead options' do
|
9
|
-
visit spotlight.exhibit_dashboard_path(exhibit)
|
10
7
|
|
11
|
-
|
12
|
-
|
13
|
-
end
|
8
|
+
it 'updates site masthead options' do
|
9
|
+
visit spotlight.edit_site_path
|
14
10
|
|
15
11
|
click_link 'Site masthead'
|
16
12
|
|
17
13
|
within '#site-masthead' do
|
18
14
|
check 'Show background image in masthead'
|
19
|
-
|
20
|
-
attach_file('exhibit_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
15
|
+
attach_file('site_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
21
16
|
end
|
22
17
|
|
23
18
|
click_button 'Save changes'
|
24
19
|
|
25
|
-
expect(page).to have_content('The
|
26
|
-
|
27
|
-
within '#sidebar' do
|
28
|
-
click_link 'Appearance'
|
29
|
-
end
|
20
|
+
expect(page).to have_content('The site was successfully updated.')
|
30
21
|
|
22
|
+
visit spotlight.edit_site_path
|
31
23
|
click_link 'Site masthead'
|
32
24
|
|
33
25
|
within '#site-masthead' do
|
34
26
|
expect(field_labeled('Show background image in masthead')).to be_checked
|
35
|
-
expect(field_labeled('Upload an image')).to be_checked
|
36
27
|
end
|
37
28
|
end
|
38
29
|
it 'displays a masthead image when one is uploaded and configured' do
|
39
|
-
visit spotlight.
|
40
|
-
|
41
|
-
|
42
|
-
click_link 'Appearance'
|
43
|
-
end
|
30
|
+
visit spotlight.edit_site_path
|
31
|
+
|
32
|
+
expect(page).to_not have_css('.image-masthead')
|
44
33
|
|
45
34
|
click_link 'Site masthead'
|
46
35
|
|
47
36
|
within '#site-masthead' do
|
48
37
|
check 'Show background image in masthead'
|
49
38
|
|
50
|
-
attach_file('
|
39
|
+
attach_file('site_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
51
40
|
end
|
52
41
|
|
53
42
|
click_button 'Save changes'
|
54
43
|
|
55
|
-
expect(page).to have_content('The
|
44
|
+
expect(page).to have_content('The site was successfully updated.')
|
56
45
|
|
57
|
-
expect(page).to have_css('
|
46
|
+
expect(page).to have_css('.image-masthead .background-container')
|
58
47
|
end
|
59
48
|
it 'does not display an uploaded masthead if configured to not display' do
|
60
|
-
visit spotlight.
|
61
|
-
expect(page).to_not have_css('#exhibit-masthead.with-image')
|
62
|
-
within '#sidebar' do
|
63
|
-
click_link 'Appearance'
|
64
|
-
end
|
65
|
-
|
66
|
-
click_link 'Site masthead'
|
49
|
+
visit spotlight.edit_site_path
|
67
50
|
|
68
|
-
|
69
|
-
attach_file('exhibit_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
70
|
-
end
|
71
|
-
|
72
|
-
click_button 'Save changes'
|
73
|
-
|
74
|
-
expect(page).to have_content('The exhibit was successfully updated.')
|
75
|
-
|
76
|
-
expect(page).to_not have_css('#exhibit-masthead.with-image .background-container')
|
77
|
-
end
|
78
|
-
it 'displays a masthead image when one is uploaded from an exhibit item', js: true do
|
79
|
-
skip "Capyabara and jcrop don't play well together.."
|
80
|
-
visit spotlight.exhibit_dashboard_path(exhibit)
|
81
|
-
expect(page).to_not have_css('#exhibit-masthead.with-image')
|
82
|
-
within '#sidebar' do
|
83
|
-
click_link 'Appearance'
|
84
|
-
end
|
51
|
+
expect(page).to_not have_css('.image-masthead')
|
85
52
|
|
86
53
|
click_link 'Site masthead'
|
87
54
|
|
88
55
|
within '#site-masthead' do
|
89
|
-
|
90
|
-
|
91
|
-
fill_in_typeahead_field 'document_title', with: 'Armenia'
|
56
|
+
attach_file('site_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
|
92
57
|
end
|
93
58
|
|
94
59
|
click_button 'Save changes'
|
95
60
|
|
96
|
-
expect(page).to have_content('The
|
61
|
+
expect(page).to have_content('The site was successfully updated.')
|
97
62
|
|
98
|
-
expect(page).
|
63
|
+
expect(page).to_not have_css('.image-masthead .background-container')
|
99
64
|
end
|
100
65
|
end
|
@@ -2,6 +2,11 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Spotlight::ApplicationHelper, type: :helper do
|
4
4
|
describe '#application_name' do
|
5
|
+
let(:site) { Spotlight::Site.instance }
|
6
|
+
before do
|
7
|
+
allow(helper).to receive(:current_site).and_return(site)
|
8
|
+
end
|
9
|
+
|
5
10
|
it 'includes the exhibit' do
|
6
11
|
allow(helper).to receive_messages(current_exhibit: double(title: 'My Exhibit'))
|
7
12
|
expect(helper.application_name).to eq 'My Exhibit - Blacklight'
|
@@ -11,6 +16,17 @@ describe Spotlight::ApplicationHelper, type: :helper do
|
|
11
16
|
allow(helper).to receive_messages(current_exhibit: nil)
|
12
17
|
expect(helper.application_name).to eq 'Blacklight'
|
13
18
|
end
|
19
|
+
|
20
|
+
context 'with a configured site title' do
|
21
|
+
before do
|
22
|
+
site.title = 'Some Title'
|
23
|
+
allow(helper).to receive_messages(current_exhibit: nil)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'uses the configured name' do
|
27
|
+
expect(helper.application_name).to eq 'Some Title'
|
28
|
+
end
|
29
|
+
end
|
14
30
|
end
|
15
31
|
|
16
32
|
describe '#url_to_tag_facet' do
|
@@ -24,37 +24,63 @@ describe Spotlight::Controller do
|
|
24
24
|
allow(subject).to receive_messages(current_exhibit: nil, current_masthead: nil)
|
25
25
|
end
|
26
26
|
|
27
|
-
it 'is
|
28
|
-
expect(subject.exhibit_masthead?).to
|
27
|
+
it 'is false if there is no exhibit' do
|
28
|
+
expect(subject.exhibit_masthead?).to be_falsey
|
29
29
|
end
|
30
30
|
|
31
|
-
it 'is
|
32
|
-
allow(subject).to receive_messages(current_exhibit: double, current_masthead: nil)
|
33
|
-
expect(subject.exhibit_masthead?).to
|
31
|
+
it 'is false if there is no custom exhibit masthead' do
|
32
|
+
allow(subject).to receive_messages(current_exhibit: double(masthead: nil), current_masthead: nil)
|
33
|
+
expect(subject.exhibit_masthead?).to be_falsey
|
34
34
|
end
|
35
35
|
|
36
|
-
it 'is
|
37
|
-
allow(subject).to receive_messages(current_exhibit: double(masthead: double
|
38
|
-
expect(subject.exhibit_masthead?).to
|
36
|
+
it 'is true if there is an exhibit masthead, but it is not set to display' do
|
37
|
+
allow(subject).to receive_messages(current_exhibit: double(masthead: double(display?: false)))
|
38
|
+
expect(subject.exhibit_masthead?).to be_falsey
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'is true if there is an exhibit masthead' do
|
42
|
+
allow(subject).to receive_messages(current_exhibit: double(masthead: double(display?: true)))
|
43
|
+
expect(subject.exhibit_masthead?).to be_truthy
|
39
44
|
end
|
40
45
|
end
|
46
|
+
|
41
47
|
describe '#current_masthead' do
|
42
48
|
let(:search_masthead) { double('search-masthead', display?: true) }
|
43
49
|
let(:no_display_search_masthead) { double('no-display-search-masthead', display?: false) }
|
44
50
|
let(:exhibit_masthead) { double('exhibit-masthead', display?: true) }
|
45
51
|
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
46
52
|
let(:search) { FactoryGirl.create(:search) }
|
53
|
+
|
47
54
|
it 'is nil by default' do
|
48
55
|
expect(subject.current_masthead).to be_nil
|
49
56
|
end
|
57
|
+
|
50
58
|
it 'returns the exhibit masthead if available' do
|
51
59
|
allow(exhibit).to receive_messages(masthead: exhibit_masthead)
|
52
60
|
subject.instance_variable_set(:@exhibit, exhibit)
|
53
61
|
expect(subject.current_masthead).to eq exhibit_masthead
|
54
62
|
end
|
63
|
+
|
55
64
|
it 'allows the masthead to be set' do
|
56
65
|
subject.current_masthead = search_masthead
|
57
66
|
expect(subject.current_masthead).to eq search_masthead
|
58
67
|
end
|
68
|
+
|
69
|
+
context 'with a resource masthead' do
|
70
|
+
before do
|
71
|
+
allow(subject).to receive(:resource_masthead?).and_return(true)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'checks if the current resource has a masthead' do
|
75
|
+
pending
|
76
|
+
expect(subject.current_masthead).to eq search_masthead
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe '#resource_masthead?' do
|
82
|
+
it 'is false by default' do
|
83
|
+
expect(subject.resource_masthead?).to eq false
|
84
|
+
end
|
59
85
|
end
|
60
86
|
end
|
@@ -30,7 +30,7 @@ describe Spotlight::Ability, type: :model do
|
|
30
30
|
|
31
31
|
describe 'a user with admin role' do
|
32
32
|
let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
|
33
|
-
let(:role) { FactoryGirl.create(:role,
|
33
|
+
let(:role) { FactoryGirl.create(:role, resource: exhibit) }
|
34
34
|
|
35
35
|
it { is_expected.to be_able_to(:update, exhibit) }
|
36
36
|
|
@@ -43,7 +43,7 @@ describe Spotlight::Ability, type: :model do
|
|
43
43
|
it { is_expected.to be_able_to(:process_import, exhibit) }
|
44
44
|
it { is_expected.to be_able_to(:destroy, exhibit) }
|
45
45
|
|
46
|
-
let(:blacklight_config) {
|
46
|
+
let(:blacklight_config) { exhibit.blacklight_configuration }
|
47
47
|
end
|
48
48
|
|
49
49
|
describe 'a user with curate role' do
|
@@ -72,7 +72,6 @@ describe Spotlight::Ability, type: :model do
|
|
72
72
|
it { is_expected.to be_able_to(:create, contact) }
|
73
73
|
it { is_expected.to be_able_to(:destroy, contact) }
|
74
74
|
|
75
|
-
let(:
|
76
|
-
let(:blacklight_config) { role.exhibit.blacklight_configuration }
|
75
|
+
let(:blacklight_config) { exhibit.blacklight_configuration }
|
77
76
|
end
|
78
77
|
end
|