Sha256: e3df6ae1f868b604e7a2339c92a835b087301cb00b9718c9fb5a01f94b7c45b3

Contents?: true

Size: 969 Bytes

Versions: 7

Compression:

Stored size: 969 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'
  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'})
      # I'm not certain how the ampersand gets in there. It's not important.
      expect(result).to have_selector "a[href='/?&q=biz']"
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
blacklight-5.0.3 spec/helpers/render_constraints_helper_spec.rb
blacklight-5.0.2 spec/helpers/render_constraints_helper_spec.rb
blacklight-5.0.1 spec/helpers/render_constraints_helper_spec.rb
blacklight-5.0.0 spec/helpers/render_constraints_helper_spec.rb
blacklight-5.0.0.pre4 spec/helpers/render_constraints_helper_spec.rb
blacklight-5.0.0.pre3 spec/helpers/render_constraints_helper_spec.rb
blacklight-5.0.0.pre2 spec/helpers/render_constraints_helper_spec.rb