Sha256: 615ee76a2b07cd6451067fc25de9e819e1c15dfc4a96dd85de9a996f3bd31512

Contents?: true

Size: 1012 Bytes

Versions: 4

Compression:

Stored size: 1012 Bytes

Contents

require 'spec_helper'

describe RenderConstraintsHelper do

  before do
    # the helper methods below infer paths from the current route
    controller.request.path_parameters["controller"] = 'catalog'
    helper.stub(:search_action_path) do |*args|
      catalog_index_path *args
    end
  end

  describe '#render_constraints_query' do
    it "should have a link relative to the current url" do
      expect(helper.render_constraints_query(:q=>'foobar', :f=>{:type=>'journal'})).to have_selector "a[href='/?f%5Btype%5D=journal']"
    end
  end

  describe '#render_filter_element' do
    before do
      @config = Blacklight::Configuration.new do |config|
        config.add_facet_field 'type'
      end
      helper.stub(:blacklight_config => @config)
    end
    it "should have a link relative to the current url" do
      result = helper.render_filter_element('type', ['journal'], {:q=>'biz'})
      expect(result).to have_link "Remove constraint Type: journal", href: "/catalog?q=biz"
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blacklight-5.4.0 spec/helpers/render_constraints_helper_spec.rb
blacklight-5.4.0.rc1 spec/helpers/render_constraints_helper_spec.rb
blacklight-5.3.0 spec/helpers/render_constraints_helper_spec.rb
blacklight-5.2.0 spec/helpers/render_constraints_helper_spec.rb