Sha256: 1df492c770667877b93b90c5345e65e2f7f8960598d633f2b346d6d93af69475

Contents?: true

Size: 1.55 KB

Versions: 42

Compression:

Stored size: 1.55 KB

Contents

# -*- 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

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
blacklight-5.18.0 spec/features/search_formats_spec.rb
blacklight-5.17.2 spec/features/search_formats_spec.rb
blacklight-5.17.1 spec/features/search_formats_spec.rb
blacklight-5.17.0 spec/features/search_formats_spec.rb
blacklight-5.16.4 spec/features/search_formats_spec.rb
blacklight-5.16.3 spec/features/search_formats_spec.rb
blacklight-5.16.2 spec/features/search_formats_spec.rb
blacklight-5.16.1 spec/features/search_formats_spec.rb
blacklight-5.16.0 spec/features/search_formats_spec.rb
blacklight-5.15.0 spec/features/search_formats_spec.rb
blacklight-5.14.0 spec/features/search_formats_spec.rb
blacklight-5.13.1 spec/features/search_formats_spec.rb
blacklight-5.13.0 spec/features/search_formats_spec.rb
blacklight-5.11.3 spec/features/search_formats_spec.rb
blacklight-5.12.1 spec/features/search_formats_spec.rb
blacklight-5.12.0 spec/features/search_formats_spec.rb
blacklight-5.10.3 spec/features/search_formats_spec.rb
blacklight-5.9.4 spec/features/search_formats_spec.rb
blacklight-5.11.2 spec/features/search_formats_spec.rb
blacklight-5.11.1 spec/features/search_formats_spec.rb