Sha256: 1634db60dc5a7a466b23dc41b023b5205bc0c05129be9e21ff861077f6d02ff2

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe RenderConstraintsHelper do

  before do
    ## Pretend that we're in a controller at /advanced_search
    Journey::Route.any_instance.stub(:format).and_return('/advanced_search')
  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='/advanced_search?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'})
      result.size.should == 1
      # I'm not certain how the ampersand gets in there. It's not important.
      result.first.should have_selector "a[href='/advanced_search?&q=biz']"
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blacklight-3.3.2 test_support/spec/helpers/render_constraints_helper_spec.rb
blacklight-3.3.1 test_support/spec/helpers/render_constraints_helper_spec.rb
blacklight-3.3.0 test_support/spec/helpers/render_constraints_helper_spec.rb