Sha256: d433f4d0a2a33ca262d9ae5de1b9f89dfbd11090afbb699f6efb4ae311ff4439

Contents?: true

Size: 1.3 KB

Versions: 36

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

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)
    render partial: "catalog/constraints"
    expect(rendered).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_selector("#startOverLink")
    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_selector("#startOverLink")
    expect(rendered).to have_link("Start Over", :href => 'http://xyz?view=xyz')
  end

end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
blacklight-6.25.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.24.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.23.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.22.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.21.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.20.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.19.2 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.19.1 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.19.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.18.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.17.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.16.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.15.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.14.1 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.14.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.13.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.12.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.11.2 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.11.1 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.11.0 spec/views/catalog/_constraints.html.erb_spec.rb