Sha256: 5fae2aff6b651cdfb6a245907f8ca84c7c34d129358b663af0cbd823599fdfa5

Contents?: true

Size: 1.31 KB

Versions: 31

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

describe "catalog/constraints" do
  let :blacklight_config do
    Blacklight::Configuration.new do |config|
      config.view.xyz
    end
  end

  it "should render 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 "should render 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 "should render 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

31 entries across 31 versions & 1 rubygems

Version Path
blacklight-5.19.2 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.19.1 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.19.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.18.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.17.2 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.0.0.pre5 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.17.1 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.17.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.0.0.pre4 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.16.4 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.0.0.pre3 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.16.3 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.16.2 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.16.1 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.0.0.pre2 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-6.0.0.pre1 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.16.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.15.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.14.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.13.1 spec/views/catalog/_constraints.html.erb_spec.rb