Sha256: 265bedb03533745fb23c98ecb948c2e5d2201df73deb19a75d287002fca533c0

Contents?: true

Size: 1.22 KB

Versions: 8

Compression:

Stored size: 1.22 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
    view.stub(query_has_constraints?: false)
    render partial: "catalog/constraints"
    expect(rendered).to be_empty
  end

  it "should render a start over link" do
    view.should_receive(:search_action_path).with({}).and_return('http://xyz')
    view.stub(query_has_constraints?: true)
    view.stub(: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
    view.should_receive(:search_action_path).with(view: :xyz).and_return('http://xyz?view=xyz')
    view.stub(query_has_constraints?: true)
    params[:view] = 'xyz'
    view.stub(: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

8 entries across 8 versions & 1 rubygems

Version Path
blacklight-5.5.1 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.5.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.4.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.4.0.rc1 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.3.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.1.1 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.2.0 spec/views/catalog/_constraints.html.erb_spec.rb
blacklight-5.1.0 spec/views/catalog/_constraints.html.erb_spec.rb