Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
catalog#index should attempt to render document export formats if non…
…e of the explicit formats match
- Loading branch information
Showing
4 changed files
with
86 additions
and
1 deletion.
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,45 @@ | ||
# -*- encoding : utf-8 -*- | ||
|
||
require 'spec_helper' | ||
|
||
describe "Search Formats" do | ||
before do | ||
# Get all the fields from Solr, so the #index documents have the MARC field (to trigger appropriate | ||
# export formats) | ||
CatalogController.blacklight_config.default_solr_params[:fl] = '*' | ||
end | ||
|
||
it "should have an RSS XML response" do | ||
visit "/catalog.rss?q=" | ||
expect(page).to have_content "Blacklight Search Results" | ||
doc = Nokogiri::XML(page.body) | ||
expect(doc.xpath("//item")).to have(10).items | ||
end | ||
|
||
it "should have an ATOM XML response" do | ||
visit "/catalog.atom?q=" | ||
expect(page).to have_content "Blacklight Search Results" | ||
doc = Nokogiri::XML(page.body) | ||
expect(doc.xpath("//atom:entry", atom: "http://www.w3.org/2005/Atom")).to have(10).entries | ||
end | ||
|
||
it "should return new-line separated RIS records" do | ||
visit "/catalog.endnote?q=" | ||
expect(page.status_code).to eq 200 | ||
rmt_regex = /^%0/ | ||
expect(page).to have_content "%A Bstan-ʼdzin-rgya-mtsho," | ||
expect(page).to have_content "%@ 9789573908678" | ||
expect(page.body).to match rmt_regex | ||
expect(page.body.scan(rmt_regex).length).to eq 10 | ||
end | ||
|
||
it "should return new-line separated MARC records" do | ||
visit "/catalog.refworks_marc_txt?q=" | ||
expect(page.status_code).to eq 200 | ||
rmt_regex = /LEADER .+\n(\d\d\d .. .+\n)+/ | ||
expect(page).to have_content "LEADER 01221cam a22002534a 4500001" | ||
expect(page).to have_content "LEADER 01127cam a22002895a 4500001" | ||
expect(page.body).to match rmt_regex | ||
expect(page.body.scan(rmt_regex).length).to eq 10 | ||
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