Sha256: 44a095f854070c478869d3d48d40d779f77cf9751269d14069397d88529d2234

Contents?: true

Size: 772 Bytes

Versions: 8

Compression:

Stored size: 772 Bytes

Contents

require "spec_helper"

describe Redistat::Label do
  include Redistat::Database
  
  before(:each) do
    db.flushdb
    @name = "about_us"
    @label = Redistat::Label.new(@name)
  end
  
  it "should initialize properly and SHA1 hash the label name" do
    @label.name.should == @name
    @label.hash.should == Digest::SHA1.hexdigest(@name)
  end
  
  it "should store a label hash lookup key" do
    label = Redistat::Label.new(@name, {:hashed_label => true}).save
    label.saved?.should be_true
    db.get("#{Redistat::KEY_LEBELS}#{label.hash}").should == @name
    
    name = "contact_us"
    label = Redistat::Label.create(name, {:hashed_label => true})
    label.saved?.should be_true
    db.get("#{Redistat::KEY_LEBELS}#{label.hash}").should == name
  end
  
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
redistat-0.0.9 spec/label_spec.rb
redistat-0.0.8 spec/label_spec.rb
redistat-0.0.7 spec/label_spec.rb
redistat-0.0.6 spec/label_spec.rb
redistat-0.0.5 spec/label_spec.rb
redistat-0.0.4 spec/label_spec.rb
redistat-0.0.3 spec/label_spec.rb
redistat-0.0.2 spec/label_spec.rb