RSpec.describe BlacklightHelper, type: :helper do let(:blacklight_config) { CatalogController.blacklight_config } let(:attributes) do { 'creator_tesim' => ['Justin', 'Joe'], 'depositor_tesim' => ['jcoyne@justincoyne.com'], 'proxy_depositor_ssim' => ['atz@stanford.edu'], 'description_tesim' => ['This links to http://example.com/ What about that?'], 'date_uploaded_dtsi' => '2013-03-14T00:00:00Z', 'rights_tesim' => ["http://creativecommons.org/publicdomain/zero/1.0/", "http://creativecommons.org/publicdomain/mark/1.0/", "http://www.europeana.eu/portal/rights/rr-r.html"], 'identifier_tesim' => ['65434567654345654'], 'keyword_tesim' => ['taco', 'mustache'], 'subject_tesim' => ['Awesome'], 'contributor_tesim' => ['Bird, Big'], 'publisher_tesim' => ['Penguin Random House'], 'based_near_tesim' => ['Pennsylvania'], 'language_tesim' => ['English'], 'resource_type_tesim' => ['Capstone Project'] } end let(:document) { SolrDocument.new(attributes) } before do allow(helper).to receive(:blacklight_config).and_return(blacklight_config) end describe "render_index_field_value" do include SufiaHelper subject { render_index_field_value document, field: field_name } context "rights_tesim" do let(:field_name) { 'rights_tesim' } it { is_expected.to eq "CC0 1.0 Universal, Public Domain Mark 1.0, and All rights reserved" } end context "metadata index links" do let(:search_state) { Blacklight::SearchState.new(params, CatalogController.blacklight_config) } before do allow(controller).to receive(:search_state).and_return(search_state) def search_action_path(stuff) search_catalog_path(stuff) end end context "keyword_tesim" do let(:field_name) { 'keyword_tesim' } it { is_expected.to eq "taco and mustache" } end context "subject_tesim" do let(:field_name) { 'subject_tesim' } it { is_expected.to eq "Awesome" } end context "creator_tesim" do let(:field_name) { 'creator_tesim' } it { is_expected.to eq "Justin and Joe" } end context "contributor_tesim" do let(:field_name) { 'contributor_tesim' } it { is_expected.to eq "Bird, Big" } end context "publisher_tesim" do let(:field_name) { 'publisher_tesim' } it { is_expected.to eq "Penguin Random House" } end context "location_tesim" do let(:field_name) { 'based_near_tesim' } it { is_expected.to eq "Pennsylvania" } end context "language_tesim" do let(:field_name) { 'language_tesim' } it { is_expected.to eq "English" } end context "resource_type_tesim" do let(:field_name) { 'resource_type_tesim' } it { is_expected.to eq "Capstone Project" } end context "identifier_tesim" do let(:field_name) { 'identifier_tesim' } it { is_expected.to eq "65434567654345654" } end end end end