Sha256: f80e5c0e99d083d530ed0bdc89251747073f6423d2a769808bfaf08c729a3400

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 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

3 entries across 3 versions & 2 rubygems

Version Path
faye-0.8.11 spec/javascript/faye_spec.js
face-faye-0.8.9 spec/javascript/faye_spec.js
faye-0.8.9 spec/javascript/faye_spec.js