Sha256: c9b92ca8fbf5e0e2107cb66168f7ef910a4601cd05cbfdbc7d7cca868d13cf4f

Contents?: true

Size: 971 Bytes

Versions: 2

Compression:

Stored size: 971 Bytes

Contents

require 'spec_helper'

RSpec.describe Hyrax::SearchState do
  let(:context) { double(params: {}, blacklight_config: config, url_options: {}) }
  let(:config) { Blacklight::Configuration.new }
  let(:state) { described_class.new(context) }

  describe "url_for_document" do
    subject { state.url_for_document(document) }
    context "with a collection" do
      let(:document) { SolrDocument.new(id: '9999', has_model_ssim: ['Collection']) }
      it "returns an array with the route set and doc" do
        expect(subject.first).to be_kind_of ActionDispatch::Routing::RoutesProxy
        expect(subject.last).to eq document
      end
    end
    context "with a work" do
      let(:document) { SolrDocument.new(id: '9999', has_model_ssim: ['GenericWork']) }
      it "returns an array with the route set and doc" do
        expect(subject.first).to be_kind_of ActionDispatch::Routing::RoutesProxy
        expect(subject.last).to eq document
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
hyrax-1.0.0.rc1 spec/lib/hyrax/search_state_spec.rb
test_hyrax-0.0.1.alpha spec/lib/hyrax/search_state_spec.rb