Sha256: fbacccd9d8eb4f816c12ba065ea0ef671034644962e7d5dc4c5392a2bf998ecc

Contents?: true

Size: 850 Bytes

Versions: 4

Compression:

Stored size: 850 Bytes

Contents

require "spec_helper"

describe Faye do
  describe :random do
    it "returns a 128-bit random number in base 36" do
      Faye.random.should =~ /^[a-z0-9]+$/
    end
    
    it "always produces the same length of string" do
      ids = (1..100).map { Faye.random }
      ids.should be_all { |id| id.size == 31 }
    end
  end
  
  describe :copy_obect do
    let(:object) { {"foo" => "bar", "qux" => 42, "hey" => nil, "obj" => {"bar" => 67}} }
    
    it "returns an equal object" do
      Faye.copy_object(object).should == {"foo" => "bar", "qux" => 42, "hey" => nil, "obj" => {"bar" => 67}}
    end
    
    it "does not return the same object" do
      Faye.copy_object(object).should_not be_equal(object)
    end
    
    it "performs a deep clone" do
      Faye.copy_object(object)["obj"].should_not be_equal(object["obj"])
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
faye-0.8.8 spec/ruby/faye_spec.rb
faye-0.8.6 spec/ruby/faye_spec.rb
faye-0.8.5 spec/ruby/faye_spec.rb
faye-0.8.4 spec/ruby/faye_spec.rb