Skip to content

Commit

Permalink
Merge pull request #1747 from sul-dlss/fixture-rename
Browse files Browse the repository at this point in the history
  • Loading branch information
mjgiarlo authored Nov 16, 2023
2 parents 4c070a1 + 9a07ddb commit 1a83f2f
Show file tree
Hide file tree
Showing 23 changed files with 90 additions and 89 deletions.
2 changes: 1 addition & 1 deletion spec/components/embed/download/geo_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
end

context 'with stanford only' do
let(:response) { stanford_restricted_multi_file_purl }
let(:response) { stanford_restricted_multi_file_purl_xml }

it 'has the stanford-only class (with screen reader text)' do
expect(page).to have_css 'li .sul-embed-stanford-only-text .sul-embed-text-hide', text: 'Stanford only', visible: :all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
end

context 'when rights are Stanford only' do
let(:response) { stanford_restricted_file_purl }
let(:response) { stanford_restricted_file_purl_xml }

it 'has a span with a stanford-only s icon class (with screen-reader text)' do
expect(page).to have_css('.sul-embed-stanford-only-text', visible: :all)
Expand Down
2 changes: 1 addition & 1 deletion spec/components/embed/file/header_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

before do
allow(request).to receive(:purl_object).and_return(object)
allow(object).to receive(:response).and_return(file_purl)
allow(object).to receive(:response).and_return(file_purl_xml)
render_inline(described_class.new(viewer:))
end

Expand Down
6 changes: 3 additions & 3 deletions spec/components/embed/file_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
end
let(:object) { Embed::Purl.new('12345') }
let(:viewer) { Embed::Viewer::File.new(request) }
let(:response) { file_purl }
let(:response) { file_purl_xml }

before do
allow(request).to receive(:purl_object).and_return(object)
Expand Down Expand Up @@ -60,7 +60,7 @@
end

describe 'embargo/Stanford only' do
let(:response) { embargoed_stanford_file_purl }
let(:response) { embargoed_stanford_file_purl_xml }

it 'adds a Stanford specific embargo message with links still present' do
expect(page).to have_css('.sul-embed-embargo-message', visible: :all, text: "Access is restricted to Stanford-affiliated patrons until #{1.month.from_now.strftime('%d-%b-%Y')}")
Expand All @@ -77,7 +77,7 @@
end

describe 'embargoed to world' do
let(:response) { embargoed_file_purl }
let(:response) { embargoed_file_purl_xml }

it 'adds a generalized embargo message and no links are present' do
expect(page).to have_css('.sul-embed-embargo-message', visible: :all, text: "Access is restricted until #{1.month.from_now.strftime('%d-%b-%Y')}")
Expand Down
2 changes: 1 addition & 1 deletion spec/components/embed/footer_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

before do
allow(request).to receive(:purl_object).and_return(object)
allow(object).to receive(:response).and_return(image_purl)
allow(object).to receive(:response).and_return(image_purl_xml)
render_inline(described_class.new(viewer:))
end

Expand Down
2 changes: 1 addition & 1 deletion spec/components/embed/m3_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
before do
allow(request).to receive(:purl_object).and_return(object)
allow(viewer).to receive(:asset_host).and_return('http://example.com/')
allow(object).to receive(:response).and_return(image_purl)
allow(object).to receive(:response).and_return(image_purl_xml)
render_inline(described_class.new(viewer:))
end

Expand Down
4 changes: 2 additions & 2 deletions spec/features/basic_functionality_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
RSpec.describe 'basic oembed functionality' do
include PurlFixtures
it 'returns a response with required parameters (xml)' do
stub_purl_xml_response_with_fixture(file_purl)
stub_purl_xml_response_with_fixture(file_purl_xml)
visit embed_path(url: 'http://purl.stanford.edu/abc', format: 'xml')
expect(page).to have_xpath '//oembed'
expect(page).to have_xpath '//type'
expect(page).to have_xpath '//version', text: '1.0'
end

it 'returns a response with correct parameter fields (xml)' do
stub_purl_xml_response_with_fixture(file_purl)
stub_purl_xml_response_with_fixture(file_purl_xml)
visit embed_path(url: 'http://purl.stanford.edu/abc', format: 'xml')
expect(page).to have_xpath '//type', text: 'rich'
expect(page).to have_xpath('//title', text: 'File Title')
Expand Down
2 changes: 1 addition & 1 deletion spec/features/download_panel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
end

it 'not shown for file viewer and leaves correctly formatted filenames alone' do
stub_purl_xml_response_with_fixture(multi_file_purl)
stub_purl_xml_response_with_fixture(multi_file_purl_xml)
visit_iframe_response
expect(page).to have_css '.sul-embed-body.sul-embed-file'
expect(page).not_to have_css '.sul-embed-download-panel'
Expand Down
6 changes: 3 additions & 3 deletions spec/features/embed_this_panel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
end

describe 'embed code' do
let(:spec_fixture) { file_purl }
let(:spec_fixture) { file_purl_xml }

it 'includes the allowfullscreen no-scrolling, no-border, and no margin/padding attributes' do
page.find('[data-sul-embed-toggle="sul-embed-embed-this-panel"]', match: :first).click
Expand All @@ -37,7 +37,7 @@
end

describe 'file objects' do
let(:spec_fixture) { file_purl }
let(:spec_fixture) { file_purl_xml }

it 'are present after a user clicks the button' do
expect(page).to have_css('.sul-embed-embed-this-panel', visible: :hidden)
Expand All @@ -58,7 +58,7 @@
end

describe 'Customization Options' do
let(:spec_fixture) { file_purl }
let(:spec_fixture) { file_purl_xml }

context 'with an uncustomized request' do
it 'defaults to having the option checked' do
Expand Down
6 changes: 3 additions & 3 deletions spec/features/feature_testing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
include PurlFixtures
describe 'basic functionality' do
it 'makes purl embed request and embed' do
stub_purl_xml_response_with_fixture(file_purl)
stub_purl_xml_response_with_fixture(file_purl_xml)
visit_iframe_response
expect(page).to have_css('.sul-embed-container')
expect(page).to have_css('.sul-embed-header')
Expand All @@ -16,15 +16,15 @@
end

it 'hides the title when requested' do
stub_purl_xml_response_with_fixture(file_purl)
stub_purl_xml_response_with_fixture(file_purl_xml)
visit_iframe_response('abc123', hide_title: true)
expect(page).not_to have_css('.sul-embed-header-title')
end
end

describe 'file viewer' do
it 'contains the file list' do
stub_purl_xml_response_with_fixture(file_purl)
stub_purl_xml_response_with_fixture(file_purl_xml)
visit_iframe_response
expect(page).to have_css('.sul-embed-file-list')
expect(page).to have_css('.sul-embed-media-list')
Expand Down
2 changes: 1 addition & 1 deletion spec/features/file_hierarchy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RSpec.describe 'file viewer with hierarchy', :js do
include PurlFixtures
it 'renders hierarchy' do
stub_purl_xml_response_with_fixture(hierarchical_file_purl)
stub_purl_xml_response_with_fixture(hierarchical_file_purl_xml)
visit_iframe_response
expect(page).to have_content('2 items')
# There are 2 files
Expand Down
8 changes: 4 additions & 4 deletions spec/features/file_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

context 'when text is entered with a file list' do
it 'limits shown files' do
stub_purl_xml_response_with_fixture(file_purl)
stub_purl_xml_response_with_fixture(file_purl_xml)
visit_iframe_response('abc123', min_files_to_search: 1)
expect(page).to have_css('.sul-embed-count', count: 1)
expect(page).to have_css '.sul-embed-item-count', text: '1 item'
Expand All @@ -21,7 +21,7 @@

context 'when text is entered with a hierarchical file list' do
it 'hides empty directories' do
stub_purl_xml_response_with_fixture(hierarchical_file_purl)
stub_purl_xml_response_with_fixture(hierarchical_file_purl_xml)
visit_iframe_response('abc123', min_files_to_search: 1)
expect(page).to have_css '.sul-embed-item-count', text: '2 items'
expect(page).to have_content('dir1')
Expand All @@ -41,13 +41,13 @@

context 'when the number of files are beneath the threshold' do
it 'does not display the search box' do
stub_purl_xml_response_with_fixture(file_purl)
stub_purl_xml_response_with_fixture(file_purl_xml)
visit_iframe_response
expect(page).not_to have_css('.sul-embed-search-input')
end

it 'hides the search box when requested' do
stub_purl_xml_response_with_fixture(file_purl)
stub_purl_xml_response_with_fixture(file_purl_xml)
visit_iframe_response('abc123', hide_search: true)
expect(page).not_to have_css('.sul-embed-search')
end
Expand Down
4 changes: 2 additions & 2 deletions spec/features/metadata_panel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
end

it 'is present after a user clicks the button' do
stub_purl_xml_response_with_fixture(file_purl)
stub_purl_xml_response_with_fixture(file_purl_xml)
visit_iframe_response
expect(page).to have_css('.sul-embed-metadata-panel', visible: :hidden)
page.find('[data-sul-embed-toggle="sul-embed-metadata-panel"]', match: :first).click
Expand All @@ -23,7 +23,7 @@
end

it 'has purl link, use and reproduction, and license text' do
stub_purl_xml_response_with_fixture(file_purl)
stub_purl_xml_response_with_fixture(file_purl_xml)
visit_iframe_response
page.find('[data-sul-embed-toggle="sul-embed-metadata-panel"]', match: :first).click
expect(page).to have_css('dt', text: 'Citation URL', visible: :all)
Expand Down
2 changes: 1 addition & 1 deletion spec/features/sandbox_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
include PurlFixtures

before do
stub_purl_xml_response_with_fixture(file_purl)
stub_purl_xml_response_with_fixture(file_purl_xml)
end

it 'returns the iframe output from the embed endpoint' do
Expand Down
25 changes: 13 additions & 12 deletions spec/fixtures/purl_fixtures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def access_read_world
XML
end

def file_purl
def file_purl_xml
<<-XML
<publicObject>
<identityMetadata>
Expand Down Expand Up @@ -86,7 +86,7 @@ def mods_license_purl
</publicObject>
XML
end
def image_purl
def image_purl_xml
<<-XML
<publicObject>
<identityMetadata>
Expand Down Expand Up @@ -118,7 +118,7 @@ def image_purl
</publicObject>
XML
end
def multi_file_purl
def multi_file_purl_xml
<<-XML
<publicObject>
<identityMetadata>
Expand All @@ -145,7 +145,7 @@ def multi_file_purl
</publicObject>
XML
end
def hierarchical_file_purl
def hierarchical_file_purl_xml
<<-XML
<publicObject>
<identityMetadata>
Expand All @@ -172,7 +172,7 @@ def hierarchical_file_purl
</publicObject>
XML
end
def many_file_purl
def many_file_purl_xml
files = (0..3001).map { |file_num|
<<-XML
<resource sequence="1" type="file">
Expand All @@ -199,7 +199,7 @@ def many_file_purl
</publicObject>
XML
end
def large_file_purl
def large_file_purl_xml
<<-XML
<publicObject>
<identityMetadata>
Expand Down Expand Up @@ -344,7 +344,7 @@ def multi_media_purl
XML
end

def stanford_restricted_file_purl
def stanford_restricted_file_purl_xml
<<-XML
<publicObject>
<identityMetadata>
Expand All @@ -366,7 +366,8 @@ def stanford_restricted_file_purl
</publicObject>
XML
end
def stanford_no_download_restricted_file_purl

def stanford_no_download_restricted_file_purl_xml
<<-XML
<publicObject>
<identityMetadata>
Expand All @@ -388,7 +389,7 @@ def stanford_no_download_restricted_file_purl
</publicObject>
XML
end
def stanford_restricted_image_purl
def stanford_restricted_image_purl_xml
<<-XML
<publicObject>
<identityMetadata>
Expand Down Expand Up @@ -487,7 +488,7 @@ def stanford_restricted_download_purl
</access>
XML
end
def stanford_restricted_multi_file_purl
def stanford_restricted_multi_file_purl_xml
<<-XML
<publicObject>
<identityMetadata>
Expand All @@ -514,7 +515,7 @@ def stanford_restricted_multi_file_purl
</publicObject>
XML
end
def embargoed_stanford_file_purl
def embargoed_stanford_file_purl_xml
<<-XML
<publicObject>
<identityMetadata>
Expand All @@ -537,7 +538,7 @@ def embargoed_stanford_file_purl
</publicObject>
XML
end
def embargoed_file_purl
def embargoed_file_purl_xml
<<-XML
<publicObject>
<identityMetadata>
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/embed/viewer/common_viewer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
expect(request).to receive(:maxheight).at_least(:once).and_return(100)
expect(request).to receive(:maxwidth).at_least(:once).and_return(200)
stub_purl_request(request)
stub_purl_xml_response_with_fixture(multi_file_purl)
stub_purl_xml_response_with_fixture(multi_file_purl_xml)
expect(file_viewer.height).to eq 100
expect(file_viewer.width).to eq 200
end
Expand Down
Loading

0 comments on commit 1a83f2f

Please sign in to comment.