Sha256: 641c421fd7224bcbd4db35aa5af7e190b411cab1b687f7561b79e87f1d5f8297

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

JS.ENV.FayeSpec = JS.Test.describe("Faye", function() { with(this) {
  include(JS.Test.Helpers)
  
  describe("random", function() { with(this) {
    it("returns a 128-bit random number in base 36", function() { with(this) {
      assertMatch( /^[a-z0-9]+$/, Faye.random() )
    }})
    
    it("always produces the same length of string", function() { with(this) {
      var ids = $R(1,100).map(function() { return Faye.random().length })
      var expected = $R(1,100).map(function() { return 35 })
      assertEqual( expected, ids )
    }})
  }})
  
  describe("copyObject", function() { with(this) {
    before(function() { with(this) {
      this.object = {foo: "bar", qux: 42, hey: null, obj: {bar: 67}}
    }})
    
    it("returns an equal object", function() { with(this) {
      assertEqual( {foo: "bar", qux: 42, hey: null, obj: {bar: 67}},
                   Faye.copyObject(object) )
    }})
    
    it("does not return the same object", function() { with(this) {
      assertNotSame( object, Faye.copyObject(object) )
    }})
    
    it("performs a deep clone", function() { with(this) {
      assertNotSame( object.obj, Faye.copyObject(object).obj )
    }})
  }})
}})

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
faye-0.8.8 spec/javascript/faye_spec.js
faye-0.8.6 spec/javascript/faye_spec.js
faye-0.8.5 spec/javascript/faye_spec.js
faye-0.8.4 spec/javascript/faye_spec.js