Sha256: 56442db525cbb99e1a42259fb5f8f9542f8f29364629443164ae37de8c391513

Contents?: true

Size: 933 Bytes

Versions: 49

Compression:

Stored size: 933 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Blacklight::StartOverButtonComponent, type: :component do
  subject(:render) { render_inline(instance) }

  let(:instance) { described_class.new }
  let(:blacklight_config) do
    Blacklight::Configuration.new.configure do |config|
      config.view = { list: nil, abc: nil }
    end
  end

  before do
    allow(controller).to receive(:blacklight_config).and_return(blacklight_config)
  end

  context 'with the current view type' do
    before do
      controller.params[:view] = 'abc'
    end

    it 'is the catalog path' do
      expect(render.css('a').first['href']).to eq '/catalog?view=abc'
    end
  end

  context 'when the current view type is the default' do
    before do
      controller.params[:view] = 'list'
    end

    it 'does not include the current view type' do
      expect(render.css('a').first['href']).to eq '/catalog'
    end
  end
end

Version data entries

49 entries across 48 versions & 2 rubygems

Version Path
blacklight-8.6.1 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.40.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.6.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.5.1 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.5.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.39.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.4.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.38.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/spec/components/blacklight/start_over_button_component_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.3.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.2.2 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.2.1 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.2.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.37.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.36.2 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.36.1 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.36.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-7.35.0 spec/components/blacklight/start_over_button_component_spec.rb
blacklight-8.1.0 spec/components/blacklight/start_over_button_component_spec.rb