                 pusher.subscribe("test-channel")
                 pusher.unsubscribe("test-channel")
                 expect(socket.stubber.calls.last?.name).to(equal("writeString"))
-                expect(socket.stubber.calls.last?.args!.first as? String).to(equal("{\"data\":{\"channel\":\"test-channel\"},\"event\":\"pusher:unsubscribe\"}"))
+                let parsedSubscribeArgs = convertStringToDictionary(socket.stubber.calls.last?.args!.first as! String)
+                let expectedDict = ["data": ["channel": "test-channel"], "event": "pusher:unsubscribe"]
+                let parsedEqualsExpected = NSDictionary(dictionary: parsedSubscribeArgs!).isEqualToDictionary(NSDictionary(dictionary: expectedDict) as [NSObject : AnyObject])
+                expect(parsedEqualsExpected).to(beTrue())
             }
         }
 

    }
}

class PusherClientInitializationSpec: QuickSpec {
    override func spec() {
        describe("creating the connection") {

                let chan = PusherChannel(name: "private-channel", connection: connection)
                chan.subscribed = true
                chan.trigger("client-test-event", data: ["data": "testing client events"])
                let parsedSubscribeArgs = convertStringToDictionary(socket.stubber.calls.first?.args!.first as! String)
                let expectedDict = ["data": ["data": "testing client events"], "event": "client-test-event", "channel": "private-channel"]
                let parsedEqualsExpected = NSDictionary(dictionary: parsedSubscribeArgs!).isEqualToDictionary(NSDictionary(dictionary: expectedDict) as [NSObject : AnyObject])
                expect(parsedEqualsExpected).to(beTrue())
            }

            it("should send any client events that were triggered before subscription was successful") {
