require 'spec_helper' describe Curate::CatalogHelper do field = 'generic_type_sim' before do helper.stub(:blacklight_config => double(:facet_fields => {})) helper.params[:controller] = :catalog helper.params[:action] = :index helper.params[:q] = 'exceptional deposits' end describe "type_tab" do describe "when #{field} equals the specified value" do before { params[:f] = {field => ['Collection']}} it "should be active" do helper.type_tab("Collections", "Collection").should == "
  • Collections
  • " end end describe "when #{field} is not equal to the specified value" do before { params[:f] = {field => ['Person']}} it "should have a link" do helper.type_tab("Collections", "Collection").should == "
  • Collections
  • " end end describe "when #{field} is not set" do it "should have a link" do helper.type_tab("Collections", "Collection").should == "
  • Collections
  • " end end end describe "all_type_tab" do describe "when #{field} is not set" do it "should be active" do helper.all_type_tab.should == "
  • All
  • " end end describe "when #{field} is set" do before { params[:f] = {field => ['Person']}} it "should have a link" do helper.all_type_tab.should == "
  • All
  • " end end end end