-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: GriffinJ <jrgriffiniii@gmail.com>
- Loading branch information
1 parent
17f28fd
commit aa6cd07
Showing
7 changed files
with
136 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe 'Catalog', type: :feature, js: true do | ||
let(:exhibit) { FactoryBot.create(:exhibit, title: 'Exhibit Title 1') } | ||
let(:curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) } | ||
let(:admin) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) } | ||
let(:document_id) { '1r66j4408' } | ||
let(:id) { Digest::MD5.hexdigest("#{exhibit.id}-#{document_id}") } | ||
let(:document) do | ||
SolrDocument.new( | ||
id: id | ||
) | ||
end | ||
|
||
before do | ||
sign_in admin | ||
Spotlight::SolrDocumentSidecar.create!( | ||
document: document, exhibit: exhibit, | ||
data: { | ||
full_title_tesim: [ | ||
'test item' | ||
], | ||
access_identifier_ssim: [ | ||
"1r66j4408" | ||
], | ||
'readonly_description_ssim': [ | ||
"panoramic" * 50 | ||
], | ||
'exhibit_exhibit-title-1_readonly_description_ssim': [ | ||
"panoramic" * 50 | ||
], | ||
'content_metadata_iiif_manifest_field_ssi': [ | ||
'http://images.institution.edu' | ||
] | ||
} | ||
) | ||
|
||
document.make_public! exhibit | ||
document.reindex | ||
Blacklight.default_index.connection.commit | ||
|
||
Spotlight::CustomField.create!(exhibit: exhibit, slug: 'description', field: 'readonly_description_ssim', configuration: { "label" => "Description" }, field_type: 'vocab', readonly_field: true) | ||
end | ||
|
||
it 'will add a ... More link in the field' do | ||
visit spotlight.exhibit_solr_document_path(exhibit, document_id) | ||
expect(page).to have_content 'panoramic' | ||
expect(page).to have_selector "a.morelink" | ||
end | ||
|
||
def index | ||
Blacklight.default_index.connection | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'capybara/rspec' | ||
require 'selenium-webdriver' | ||
|
||
# there's a bug in capybara-screenshot that requires us to name | ||
# the driver ":selenium" so we changed it from :headless_chrome" | ||
Capybara.register_driver(:selenium) do |app| | ||
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( | ||
chromeOptions: { args: %w[headless disable-gpu disable-setuid-sandbox window-size=7680,4320] } | ||
) | ||
|
||
http_client = Selenium::WebDriver::Remote::Http::Default.new | ||
http_client.read_timeout = 120 | ||
http_client.open_timeout = 120 | ||
Capybara::Selenium::Driver.new(app, | ||
browser: :chrome, | ||
desired_capabilities: capabilities, | ||
http_client: http_client) | ||
end | ||
|
||
Capybara.javascript_driver = :selenium | ||
Capybara.default_max_wait_time = 15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'request_spec_helper' | ||
RSpec.configure do |config| | ||
config.include Devise::Test::ControllerHelpers, type: :controller | ||
config.include Devise::Test::ControllerHelpers, type: :view | ||
config.include Devise::Test::ControllerHelpers, type: :controller | ||
config.include RequestSpecHelper, type: :request | ||
config.include RequestSpecHelper, type: :feature, js: true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
module RequestSpecHelper | ||
include Warden::Test::Helpers | ||
|
||
def self.included(base) | ||
base.before { Warden.test_mode! } | ||
base.after { Warden.test_reset! } | ||
end | ||
|
||
def sign_in(resource) | ||
login_as(resource, scope: warden_scope(resource)) | ||
end | ||
|
||
def sign_out(resource) | ||
logout(warden_scope(resource)) | ||
end | ||
|
||
private | ||
|
||
def warden_scope(resource) | ||
resource.class.name.underscore.to_sym | ||
end | ||
end |