Sha256: b7598c57f834e706ec33e0b5dfd28b36fd1986416fd6c06c71793d2d656c04cd

Contents?: true

Size: 1008 Bytes

Versions: 1

Compression:

Stored size: 1008 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../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
      helper.render_constraints_query(:q=>'foobar', :f=>{:type=>'journal'}).should 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.
      result.should have_selector "a[href='/?&q=biz']"
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-5.0.0.pre1 spec/helpers/render_constraints_helper_spec.rb