Sha256: e1e57c36c436e89dae47c59be616d6a2bade37973745e246f982f55286dd3c77

Contents?: true

Size: 1.28 KB

Versions: 28

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

RSpec.describe "catalog/constraints" do
  let :blacklight_config do
    Blacklight::Configuration.new do |config|
      config.view.xyz({})
    end
  end

  it "renders nothing if no constraints are set" do
    allow(view).to receive_messages(query_has_constraints?: false)
    allow(view).to receive(:blacklight_config).and_return(blacklight_config)
    render partial: "catalog/constraints"
    expect(rendered.strip).to be_empty
  end

  it "renders a start over link" do
    allow(view).to receive(:search_action_path).with({}).and_return('http://xyz')
    allow(view).to receive_messages(query_has_constraints?: true)
    allow(view).to receive(:blacklight_config).and_return(blacklight_config)
    render partial: "catalog/constraints"
    expect(rendered).to have_link("Start Over", href: 'http://xyz')
  end

  it "renders a start over link with the current view type" do
    allow(view).to receive(:search_action_path).with({ view: :xyz }).and_return('http://xyz?view=xyz')
    allow(view).to receive_messages(query_has_constraints?: true)
    params[:view] = 'xyz'
    allow(view).to receive(:blacklight_config).and_return(blacklight_config)
    render partial: "catalog/constraints"
    expect(rendered).to have_link("Start Over", href: 'http://xyz?view=xyz')
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
blacklight-7.40.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.39.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.38.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.37.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.36.2 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.36.1 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.36.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.35.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.34.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.33.1 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.33.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.32.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.31.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.30.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.29.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.28.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.27.1 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.27.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-7.26.1 spec/views/catalog/_constraints.html.erb_spec.rb