blacklight-spotlight 2.6.1.1 → 2.7.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/crop.es6 +5 -0
- data/app/models/concerns/spotlight/custom_translation_extension.rb +2 -0
- data/app/models/spotlight/blacklight_configuration.rb +1 -1
- data/app/models/spotlight/page.rb +1 -0
- data/lib/spotlight/version.rb +1 -1
- data/spec/examples.txt +1307 -1319
- data/spec/factories/pages.rb +6 -0
- data/spec/models/spotlight/custom_translation_extension_spec.rb +23 -0
- data/spec/models/spotlight/page_spec.rb +10 -0
- data/spec/spec_helper.rb +8 -13
- metadata +5 -3
data/spec/factories/pages.rb
CHANGED
@@ -7,6 +7,12 @@ FactoryBot.define do
|
|
7
7
|
published { true }
|
8
8
|
content { '[]' }
|
9
9
|
end
|
10
|
+
factory :feature_page_static_title, class: 'Spotlight::FeaturePage' do
|
11
|
+
exhibit
|
12
|
+
title { 'FeaturePage' }
|
13
|
+
published { true }
|
14
|
+
content { '[]' }
|
15
|
+
end
|
10
16
|
factory :feature_subpage, parent: :feature_page do
|
11
17
|
transient do
|
12
18
|
exhibit
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Spotlight::CustomTranslationExtension do
|
4
|
+
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
+
subject do
|
6
|
+
Class.new(ActiveRecord::Base) do
|
7
|
+
include Spotlight::CustomTranslationExtension
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '.current_exhibit' do
|
12
|
+
it 'sets the current exhibit' do
|
13
|
+
subject.current_exhibit = exhibit
|
14
|
+
expect(subject.current_exhibit).to eq exhibit
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'reloads the i18n' do
|
18
|
+
allow(I18n.backend).to receive(:reload!)
|
19
|
+
|
20
|
+
subject.current_exhibit = exhibit
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -172,6 +172,16 @@ describe Spotlight::Page, type: :model do
|
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
175
|
+
context 'when cloning a page that has been deleted with a FriendlyId UUID added' do
|
176
|
+
let(:feature_page_static_title) { FactoryBot.create(:feature_page_static_title, exhibit: exhibit) }
|
177
|
+
let(:feature_page_static_title_two) { FactoryBot.create(:feature_page_static_title, exhibit: exhibit) }
|
178
|
+
it 'translated page has the same UUID' do
|
179
|
+
expect(feature_page_static_title.slug).to eq 'featurepage'
|
180
|
+
expect(feature_page_static_title_two.slug).not_to eq feature_page_static_title.slug
|
181
|
+
expect(feature_page_static_title_two.clone_for_locale('es').slug).to eq feature_page_static_title_two.slug
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
175
185
|
context 'when cloning a parent page whose children pages have already been cloned' do
|
176
186
|
let(:parent_page_es) { parent_page.clone_for_locale('es') }
|
177
187
|
let(:child_page_es) { child_page.clone_for_locale('es') }
|
data/spec/spec_helper.rb
CHANGED
@@ -15,25 +15,20 @@ require 'rspec/rails'
|
|
15
15
|
require 'rspec/active_model/mocks'
|
16
16
|
require 'paper_trail/frameworks/rspec'
|
17
17
|
|
18
|
-
require 'chromedriver-helper'
|
19
18
|
require 'selenium-webdriver'
|
20
19
|
require 'webmock/rspec'
|
21
20
|
|
22
21
|
Capybara.javascript_driver = :headless_chrome
|
23
22
|
|
24
|
-
# @note In January 2018, TravisCI disabled Chrome sandboxing in its Linux
|
25
|
-
# container build environments to mitigate Meltdown/Spectre
|
26
|
-
# vulnerabilities, at which point Spotlight needs to use the --no-sandbox
|
27
|
-
# flag. https://github.com/travis-ci/docs-travis-ci-com/blob/c1da4af0b7ee5de35fa4490fa8e0fc4b44881089/user/chrome.md
|
28
|
-
# h/t @mjgiarlo
|
29
23
|
Capybara.register_driver :headless_chrome do |app|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
24
|
+
Capybara::Selenium::Driver.load_selenium
|
25
|
+
browser_options = ::Selenium::WebDriver::Chrome::Options.new.tap do |opts|
|
26
|
+
opts.args << '--headless'
|
27
|
+
opts.args << '--disable-gpu'
|
28
|
+
opts.args << '--no-sandbox'
|
29
|
+
opts.args << '--window-size=1280,1696'
|
30
|
+
end
|
31
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
|
37
32
|
end
|
38
33
|
|
39
34
|
if ENV['COVERAGE'] || ENV['CI']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight-spotlight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2019-
|
14
|
+
date: 2019-06-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -636,7 +636,7 @@ dependencies:
|
|
636
636
|
- !ruby/object:Gem::Version
|
637
637
|
version: '1.25'
|
638
638
|
- !ruby/object:Gem::Dependency
|
639
|
-
name:
|
639
|
+
name: webdrivers
|
640
640
|
requirement: !ruby/object:Gem::Requirement
|
641
641
|
requirements:
|
642
642
|
- - ">="
|
@@ -1423,6 +1423,7 @@ files:
|
|
1423
1423
|
- spec/models/spotlight/contact_image_spec.rb
|
1424
1424
|
- spec/models/spotlight/contact_spec.rb
|
1425
1425
|
- spec/models/spotlight/custom_field_spec.rb
|
1426
|
+
- spec/models/spotlight/custom_translation_extension_spec.rb
|
1426
1427
|
- spec/models/spotlight/exhibit_spec.rb
|
1427
1428
|
- spec/models/spotlight/exhibit_thumbnail_spec.rb
|
1428
1429
|
- spec/models/spotlight/feature_page_spec.rb
|
@@ -1662,6 +1663,7 @@ test_files:
|
|
1662
1663
|
- spec/models/spotlight/exhibit_spec.rb
|
1663
1664
|
- spec/models/spotlight/featured_image_spec.rb
|
1664
1665
|
- spec/models/spotlight/ability_spec.rb
|
1666
|
+
- spec/models/spotlight/custom_translation_extension_spec.rb
|
1665
1667
|
- spec/models/spotlight/site_spec.rb
|
1666
1668
|
- spec/models/spotlight/solr_document_sidecar_spec.rb
|
1667
1669
|
- spec/models/spotlight/search_spec.rb
|