Sha256: 15ffa8b447137ce6604068b0779c92b9b4a994c433b794f67a2a83d0106bc1e8

Contents?: true

Size: 1.67 KB

Versions: 12

Compression:

Stored size: 1.67 KB

Contents

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 == "<li class=\"active\"><a href=\"#\">Collections</a></li>"
      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 == 
          "<li><a href=\"/catalog?f%5B#{field}%5D%5B%5D=Collection&amp;q=exceptional+deposits\">Collections</a></li>"
      end
    end
    describe "when #{field} is not set" do
      it "should have a link" do
        helper.type_tab("Collections", "Collection").should == 
          "<li><a href=\"/catalog?f%5B#{field}%5D%5B%5D=Collection&amp;q=exceptional+deposits\">Collections</a></li>"
      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 == "<li class=\"active\"><a href=\"#\">All</a></li>"
      end
    end
    describe "when #{field} is set" do
      before { params[:f] = {field => ['Person']}}
      it "should have a link" do
        helper.all_type_tab.should == 
          "<li><a href=\"/catalog?q=exceptional+deposits\">All</a></li>"
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
curate-0.6.5 spec/helpers/curate/catalog_helper.rb
curate-0.6.4 spec/helpers/curate/catalog_helper.rb
curate-0.6.3 spec/helpers/curate/catalog_helper.rb
curate-0.6.1 spec/helpers/curate/catalog_helper.rb
curate-0.6.0 spec/helpers/curate/catalog_helper.rb
curate-0.5.6 spec/helpers/curate/catalog_helper.rb
curate-0.5.5 spec/helpers/curate/catalog_helper.rb
curate-0.5.4 spec/helpers/curate/catalog_helper.rb
curate-0.5.2 spec/helpers/curate/catalog_helper.rb
curate-0.5.1 spec/helpers/curate/catalog_helper.rb
curate-0.5.0 spec/helpers/curate/catalog_helper.rb
curate-0.4.2 spec/helpers/curate/catalog_helper.rb