Sha256: c89643f26e081698db93207314ddea2420b390aa62812d0a42a1c54540655ed8

Contents?: true

Size: 1.78 KB

Versions: 24

Compression:

Stored size: 1.78 KB

Contents

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

describe Endeca::RefinementDimension do
  describe ".new" do
    it "should set the raw attribute" do
      dimension = Endeca::RefinementDimension.new(:raw)

      dimension.raw.should == :raw
    end
  end
  
  describe "#to_endeca_params" do
    before do
      @dimension = Endeca::RefinementDimension.new("ExpansionLink" => "expansion link")
    end
    
    it() {@dimension.to_endeca_params.should == "expansion link"}

  end

  describe "#inspect" do
    before do
      @dimension = Endeca::RefinementDimension.new
    end

    it "should include the class" do
      @dimension.inspect.should include(Endeca::RefinementDimension.name)
    end

    it "should include the hex formatted object_id" do
      id = 123
      @dimension.stub!(:object_id).and_return(id)
      @dimension.inspect.should include("0x#{id.to_s(16)}")
    end

    it "should include the id" do
      id = 123
      @dimension.stub!(:id).and_return(id)
      @dimension.inspect.should include("id=#{id}")
    end

    it "should include the inspected name" do
      name = 'name'
      @dimension.stub!(:name).and_return(name)
      @dimension.inspect.should include("name=#{name.inspect}")
    end
  end

  describe "#==" do
    it "should compare ids" do
      dim_1 = Endeca::RefinementDimension.new
      dim_2 = Endeca::RefinementDimension.new
      dim_2.stub!(:id).and_return(dim_1.id)

      (dim_1 == dim_2).should be_true
    end
  end

  describe "#<=>" do
    it "should compare names" do
      name = mock('name')

      dim_1 = Endeca::RefinementDimension.new
      dim_2 = Endeca::RefinementDimension.new

      dim_1.stub!(:name).and_return(name)
      dim_2.stub!(:name).and_return(name)

      name.should_receive(:<=>).with(name)

      dim_1 <=> dim_2
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
primedia-endeca-0.10.1 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-0.11.0 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-0.12.0 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-0.14.0 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-1.0.0 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-1.1.0 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-1.2.0 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-1.3.0 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-1.3.1 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-1.3.2 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-1.3.3 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-1.3.4 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-1.3.5 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-1.3.6 spec/endeca/refinement_dimension_spec.rb
primedia-endeca-1.3.7 spec/endeca/refinement_dimension_spec.rb
endeca-1.5.3 spec/endeca/refinement_dimension_spec.rb
endeca-1.5.2 spec/endeca/refinement_dimension_spec.rb
endeca-1.5.1 spec/endeca/refinement_dimension_spec.rb
endeca-1.5.0 spec/endeca/refinement_dimension_spec.rb
endeca-1.4.2 spec/endeca/refinement_dimension_spec.rb