       config: Config
       oauth_host: "auth.escemo.com"
     expect(rest._oauth._options.host).toBe "auth.escemo.com"
+
+  it "should pass 'user_agent' option", ->
+    rest = new Rest
+      config: Config
+      user_agent: "commercetools"
+    expect(rest._options.headers["User-Agent"]).toBe "commercetools"
 
 describe "exports", ->
 

    expect(rest._options.uri).toBe "https://api.sphere.io/#{Config.project_key}"
    expect(rest._options.timeout).toBe 20000
    expect(rest._options.rejectUnauthorized).toBe true

  it "should throw error if no credentials are given", ->
    rest = -> new Rest

    spyOn(rest._oauth, "getAccessToken").andCallFake((callback)-> callback("Connection read timeout", null, null))
    req = -> rest.preRequest(rest._oauth, {}, {}, ->)
    expect(req).toThrow new Error "Error on retrieving access_token after 10 attempts.\n" +
      "Error: Connection read timeout\n"
