Sha256: b9aef85e82a6cf5569c12ec45a8758454ca2641785e40cac2fadddad1732ae0c

Contents?: true

Size: 1.49 KB

Versions: 16

Compression:

Stored size: 1.49 KB

Contents

require File.join(File.dirname(__FILE__), %w[.. spec_helper])

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

      dimension.raw.should == :raw
    end
  end

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

    it "should include the class" do
      @dimension.inspect.should include(Endeca::Dimension.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::Dimension.new
      dim_2 = Endeca::Dimension.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::Dimension.new
      dim_2 = Endeca::Dimension.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

16 entries across 16 versions & 1 rubygems

Version Path
primedia-endeca-0.9.0 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.1 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.10 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.11 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.12 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.13 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.14 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.15 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.2 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.3 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.4 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.5 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.6 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.7 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.8 spec/endeca/dimension_spec.rb
primedia-endeca-0.9.9 spec/endeca/dimension_spec.rb