{"action":"created","comment":{"url":"https://api.github.com/repos/skroutz/analytics.js/pulls/comments/49866968","id":49866968,"diff_hunk":"@@ -0,0 +1,51 @@\n+describe 'JSONP', ->\n+  before (done) ->\n+    require ['jsonp', 'promise', 'helpers/url_helper'], (JSONP, Promise, UrlHelper) =>\n+      @jsonp = JSONP\n+      @promise = Promise\n+      @url_helper = UrlHelper\n+\n+      done()\n+\n+  describe '#fetch', ->\n+    beforeEach ->\n+      @createElement = document.createElement\n+      document.createElement = sinon.stub().returns({})\n+      @nodeAppendChild = Node::appendChild\n+      Node::appendChild = sinon.stub()\n+\n+      @callbackName_stub = sinon.stub(@jsonp, '_callbackName').returns('callback_name')\n+      @load_spy = sinon.spy(@jsonp, 'load')\n+      @query_spy = sinon.spy(@jsonp, '_query')\n+\n+      @url = 'http://example.jsonp'\n+      @data = { param1: 'param1', param2: 'param2' }\n+      @subject = @jsonp.fetch(@url, @data)\n+\n+      @response = { root: {} }\n+      window.callback_name(@response)\n+\n+    afterEach ->\n+      document.createElement = @createElement\n+      Node::appendChild = @nodeAppendChild\n+\n+      @callbackName_stub.restore()\n+      @load_spy.restore()\n+      @query_spy.restore()\n+\n+    it 'loads the script', ->\n+      expect(@load_spy.withArgs(@url, @data).calledOnce).to.equal(true)\n+\n+    it 'appends the url params to script src', ->\n+      expect(@query_spy.withArgs(@url, @data).calledOnce).to.equal(true)\n+\n+    it 'serializes the params', ->\n+      expect(@query_spy.returned(@url_helper.appendData(@url, @url_helper.serialize(@data)))).to.equal(true)\n+\n+    it 'returns a Promise', ->\n+      expect(@subject).to.be.instanceof(@promise)\n+","path":"spec/jsonp_spec.coffee","position":null,"original_position":47,"commit_id":"0079d5452dc10a1bf3ba4290426c4031e474d645","original_commit_id":"8542ebd59920a1dca681212a5f19bc6241d14390","user":{"login":"Zorbash","id":645514,"avatar_url":"https://avatars.githubusercontent.com/u/645514?v=3","gravatar_id":"","url":"https://api.github.com/users/Zorbash","html_url":"https://github.com/Zorbash","followers_url":"https://api.github.com/users/Zorbash/followers","following_url":"https://api.github.com/users/Zorbash/following{/other_user}","gists_url":"https://api.github.com/users/Zorbash/gists{/gist_id}","starred_url":"https://api.github.com/users/Zorbash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zorbash/subscriptions","organizations_url":"https://api.github.com/users/Zorbash/orgs","repos_url":"https://api.github.com/users/Zorbash/repos","events_url":"https://api.github.com/users/Zorbash/events{/privacy}","received_events_url":"https://api.github.com/users/Zorbash/received_events","type":"User","site_admin":false},"body":"Add spec about each callback function uniqueness.","created_at":"2016-01-15T15:41:55Z","updated_at":"2016-01-15T15:41:55Z","html_url":"https://github.com/skroutz/analytics.js/pull/16#discussion_r49866968","pull_request_url":"https://api.github.com/repos/skroutz/analytics.js/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/skroutz/analytics.js/pulls/comments/49866968"},"html":{"href":"https://github.com/skroutz/analytics.js/pull/16#discussion_r49866968"},"pull_request":{"href":"https://api.github.com/repos/skroutz/analytics.js/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/skroutz/analytics.js/pulls/16","id":56153196,"html_url":"https://github.com/skroutz/analytics.js/pull/16","diff_url":"https://github.com/skroutz/analytics.js/pull/16.diff","patch_url":"https://github.com/skroutz/analytics.js/pull/16.patch","issue_url":"https://api.github.com/repos/skroutz/analytics.js/issues/16","number":16,"state":"open","locked":false,"title":"Implement PluginsManager","user":{"login":"kosdiamantis","id":6030161,"avatar_url":"https://avatars.githubusercontent.com/u/6030161?v=3","gravatar_id":"","url":"https://api.github.com/users/kosdiamantis","html_url":"https://github.com/kosdiamantis","followers_url":"https://api.github.com/users/kosdiamantis/followers","following_url":"https://api.github.com/users/kosdiamantis/following{/other_user}","gists_url":"https://api.github.com/users/kosdiamantis/gists{/gist_id}","starred_url":"https://api.github.com/users/kosdiamantis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kosdiamantis/subscriptions","organizations_url":"https://api.github.com/users/kosdiamantis/orgs","repos_url":"https://api.github.com/users/kosdiamantis/repos","events_url":"https://api.github.com/users/kosdiamantis/events{/privacy}","received_events_url":"https://api.github.com/users/kosdiamantis/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-15T10:32:31Z","updated_at":"2016-01-15T15:41:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f9208313d763648b0f3ad2992dbcd144fdc2cea2","assignee":{"login":"Zorbash","id":645514,"avatar_url":"https://avatars.githubusercontent.com/u/645514?v=3","gravatar_id":"","url":"https://api.github.com/users/Zorbash","html_url":"https://github.com/Zorbash","followers_url":"https://api.github.com/users/Zorbash/followers","following_url":"https://api.github.com/users/Zorbash/following{/other_user}","gists_url":"https://api.github.com/users/Zorbash/gists{/gist_id}","starred_url":"https://api.github.com/users/Zorbash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zorbash/subscriptions","organizations_url":"https://api.github.com/users/Zorbash/orgs","repos_url":"https://api.github.com/users/Zorbash/repos","events_url":"https://api.github.com/users/Zorbash/events{/privacy}","received_events_url":"https://api.github.com/users/Zorbash/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/skroutz/analytics.js/milestones/1","html_url":"https://github.com/skroutz/analytics.js/milestones/Plugins","labels_url":"https://api.github.com/repos/skroutz/analytics.js/milestones/1/labels","id":1506771,"number":1,"title":"Plugins","description":"We want to load and execute plugins based on a per Shop configuration residing in our beacon endpoint server.\r\n\r\nRequirements\r\n-------------------\r\n\r\n#### Plugin Management Module\r\nA plugin management module has to be implemented with the following functionality:\r\n\r\nOnly when running in a domain of an Analytics enabled shop with acquired user session, the list of enabled plugins with their URLs has to be retrieved from the beacon endpoint service.\r\n\r\n* Each plugin will be executed as soon as it's available.\r\n* Each plugin should only be executed once.\r\n\r\n#### Plugins\r\n\r\nA plugin may recognize other commands than the currently implemented (eg `ecommerce:addItem`, `ecommerce:addOrder`) and may even operate differently on already registered commands.\r\n\r\nThe Plugin Management module is responsible for providing the necessary context for each plugin.","creator":{"login":"Zorbash","id":645514,"avatar_url":"https://avatars.githubusercontent.com/u/645514?v=3","gravatar_id":"","url":"https://api.github.com/users/Zorbash","html_url":"https://github.com/Zorbash","followers_url":"https://api.github.com/users/Zorbash/followers","following_url":"https://api.github.com/users/Zorbash/following{/other_user}","gists_url":"https://api.github.com/users/Zorbash/gists{/gist_id}","starred_url":"https://api.github.com/users/Zorbash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zorbash/subscriptions","organizations_url":"https://api.github.com/users/Zorbash/orgs","repos_url":"https://api.github.com/users/Zorbash/repos","events_url":"https://api.github.com/users/Zorbash/events{/privacy}","received_events_url":"https://api.github.com/users/Zorbash/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":1,"state":"open","created_at":"2016-01-14T12:08:14Z","updated_at":"2016-01-15T14:29:04Z","due_on":"2016-01-14T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/skroutz/analytics.js/pulls/16/commits","review_comments_url":"https://api.github.com/repos/skroutz/analytics.js/pulls/16/comments","review_comment_url":"https://api.github.com/repos/skroutz/analytics.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/skroutz/analytics.js/issues/16/comments","statuses_url":"https://api.github.com/repos/skroutz/analytics.js/statuses/0079d5452dc10a1bf3ba4290426c4031e474d645","head":{"label":"skroutz:plugins/manager","ref":"plugins/manager","sha":"0079d5452dc10a1bf3ba4290426c4031e474d645","user":{"login":"skroutz","id":285550,"avatar_url":"https://avatars.githubusercontent.com/u/285550?v=3","gravatar_id":"","url":"https://api.github.com/users/skroutz","html_url":"https://github.com/skroutz","followers_url":"https://api.github.com/users/skroutz/followers","following_url":"https://api.github.com/users/skroutz/following{/other_user}","gists_url":"https://api.github.com/users/skroutz/gists{/gist_id}","starred_url":"https://api.github.com/users/skroutz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skroutz/subscriptions","organizations_url":"https://api.github.com/users/skroutz/orgs","repos_url":"https://api.github.com/users/skroutz/repos","events_url":"https://api.github.com/users/skroutz/events{/privacy}","received_events_url":"https://api.github.com/users/skroutz/received_events","type":"Organization","site_admin":false},"repo":{"id":20055159,"name":"analytics.js","full_name":"skroutz/analytics.js","owner":{"login":"skroutz","id":285550,"avatar_url":"https://avatars.githubusercontent.com/u/285550?v=3","gravatar_id":"","url":"https://api.github.com/users/skroutz","html_url":"https://github.com/skroutz","followers_url":"https://api.github.com/users/skroutz/followers","following_url":"https://api.github.com/users/skroutz/following{/other_user}","gists_url":"https://api.github.com/users/skroutz/gists{/gist_id}","starred_url":"https://api.github.com/users/skroutz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skroutz/subscriptions","organizations_url":"https://api.github.com/users/skroutz/orgs","repos_url":"https://api.github.com/users/skroutz/repos","events_url":"https://api.github.com/users/skroutz/events{/privacy}","received_events_url":"https://api.github.com/users/skroutz/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/skroutz/analytics.js","description":"Analytics client","fork":false,"url":"https://api.github.com/repos/skroutz/analytics.js","forks_url":"https://api.github.com/repos/skroutz/analytics.js/forks","keys_url":"https://api.github.com/repos/skroutz/analytics.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/skroutz/analytics.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/skroutz/analytics.js/teams","hooks_url":"https://api.github.com/repos/skroutz/analytics.js/hooks","issue_events_url":"https://api.github.com/repos/skroutz/analytics.js/issues/events{/number}","events_url":"https://api.github.com/repos/skroutz/analytics.js/events","assignees_url":"https://api.github.com/repos/skroutz/analytics.js/assignees{/user}","branches_url":"https://api.github.com/repos/skroutz/analytics.js/branches{/branch}","tags_url":"https://api.github.com/repos/skroutz/analytics.js/tags","blobs_url":"https://api.github.com/repos/skroutz/analytics.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/skroutz/analytics.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/skroutz/analytics.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/skroutz/analytics.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/skroutz/analytics.js/statuses/{sha}","languages_url":"https://api.github.com/repos/skroutz/analytics.js/languages","stargazers_url":"https://api.github.com/repos/skroutz/analytics.js/stargazers","contributors_url":"https://api.github.com/repos/skroutz/analytics.js/contributors","subscribers_url":"https://api.github.com/repos/skroutz/analytics.js/subscribers","subscription_url":"https://api.github.com/repos/skroutz/analytics.js/subscription","commits_url":"https://api.github.com/repos/skroutz/analytics.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/skroutz/analytics.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/skroutz/analytics.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/skroutz/analytics.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/skroutz/analytics.js/contents/{+path}","compare_url":"https://api.github.com/repos/skroutz/analytics.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/skroutz/analytics.js/merges","archive_url":"https://api.github.com/repos/skroutz/analytics.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/skroutz/analytics.js/downloads","issues_url":"https://api.github.com/repos/skroutz/analytics.js/issues{/number}","pulls_url":"https://api.github.com/repos/skroutz/analytics.js/pulls{/number}","milestones_url":"https://api.github.com/repos/skroutz/analytics.js/milestones{/number}","notifications_url":"https://api.github.com/repos/skroutz/analytics.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/skroutz/analytics.js/labels{/name}","releases_url":"https://api.github.com/repos/skroutz/analytics.js/releases{/id}","created_at":"2014-05-22T09:21:40Z","updated_at":"2016-01-15T12:54:21Z","pushed_at":"2016-01-15T15:40:58Z","git_url":"git://github.com/skroutz/analytics.js.git","ssh_url":"git@github.com:skroutz/analytics.js.git","clone_url":"https://github.com/skroutz/analytics.js.git","svn_url":"https://github.com/skroutz/analytics.js","homepage":"http://developer.skroutz.gr/analytics/","size":243,"stargazers_count":7,"watchers_count":7,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":7,"default_branch":"master"}},"base":{"label":"skroutz:master","ref":"master","sha":"2da4fbd27fe9732ef8857973914ade93a81e42f9","user":{"login":"skroutz","id":285550,"avatar_url":"https://avatars.githubusercontent.com/u/285550?v=3","gravatar_id":"","url":"https://api.github.com/users/skroutz","html_url":"https://github.com/skroutz","followers_url":"https://api.github.com/users/skroutz/followers","following_url":"https://api.github.com/users/skroutz/following{/other_user}","gists_url":"https://api.github.com/users/skroutz/gists{/gist_id}","starred_url":"https://api.github.com/users/skroutz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skroutz/subscriptions","organizations_url":"https://api.github.com/users/skroutz/orgs","repos_url":"https://api.github.com/users/skroutz/repos","events_url":"https://api.github.com/users/skroutz/events{/privacy}","received_events_url":"https://api.github.com/users/skroutz/received_events","type":"Organization","site_admin":false},"repo":{"id":20055159,"name":"analytics.js","full_name":"skroutz/analytics.js","owner":{"login":"skroutz","id":285550,"avatar_url":"https://avatars.githubusercontent.com/u/285550?v=3","gravatar_id":"","url":"https://api.github.com/users/skroutz","html_url":"https://github.com/skroutz","followers_url":"https://api.github.com/users/skroutz/followers","following_url":"https://api.github.com/users/skroutz/following{/other_user}","gists_url":"https://api.github.com/users/skroutz/gists{/gist_id}","starred_url":"https://api.github.com/users/skroutz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skroutz/subscriptions","organizations_url":"https://api.github.com/users/skroutz/orgs","repos_url":"https://api.github.com/users/skroutz/repos","events_url":"https://api.github.com/users/skroutz/events{/privacy}","received_events_url":"https://api.github.com/users/skroutz/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/skroutz/analytics.js","description":"Analytics client","fork":false,"url":"https://api.github.com/repos/skroutz/analytics.js","forks_url":"https://api.github.com/repos/skroutz/analytics.js/forks","keys_url":"https://api.github.com/repos/skroutz/analytics.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/skroutz/analytics.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/skroutz/analytics.js/teams","hooks_url":"https://api.github.com/repos/skroutz/analytics.js/hooks","issue_events_url":"https://api.github.com/repos/skroutz/analytics.js/issues/events{/number}","events_url":"https://api.github.com/repos/skroutz/analytics.js/events","assignees_url":"https://api.github.com/repos/skroutz/analytics.js/assignees{/user}","branches_url":"https://api.github.com/repos/skroutz/analytics.js/branches{/branch}","tags_url":"https://api.github.com/repos/skroutz/analytics.js/tags","blobs_url":"https://api.github.com/repos/skroutz/analytics.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/skroutz/analytics.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/skroutz/analytics.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/skroutz/analytics.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/skroutz/analytics.js/statuses/{sha}","languages_url":"https://api.github.com/repos/skroutz/analytics.js/languages","stargazers_url":"https://api.github.com/repos/skroutz/analytics.js/stargazers","contributors_url":"https://api.github.com/repos/skroutz/analytics.js/contributors","subscribers_url":"https://api.github.com/repos/skroutz/analytics.js/subscribers","subscription_url":"https://api.github.com/repos/skroutz/analytics.js/subscription","commits_url":"https://api.github.com/repos/skroutz/analytics.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/skroutz/analytics.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/skroutz/analytics.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/skroutz/analytics.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/skroutz/analytics.js/contents/{+path}","compare_url":"https://api.github.com/repos/skroutz/analytics.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/skroutz/analytics.js/merges","archive_url":"https://api.github.com/repos/skroutz/analytics.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/skroutz/analytics.js/downloads","issues_url":"https://api.github.com/repos/skroutz/analytics.js/issues{/number}","pulls_url":"https://api.github.com/repos/skroutz/analytics.js/pulls{/number}","milestones_url":"https://api.github.com/repos/skroutz/analytics.js/milestones{/number}","notifications_url":"https://api.github.com/repos/skroutz/analytics.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/skroutz/analytics.js/labels{/name}","releases_url":"https://api.github.com/repos/skroutz/analytics.js/releases{/id}","created_at":"2014-05-22T09:21:40Z","updated_at":"2016-01-15T12:54:21Z","pushed_at":"2016-01-15T15:40:58Z","git_url":"git://github.com/skroutz/analytics.js.git","ssh_url":"git@github.com:skroutz/analytics.js.git","clone_url":"https://github.com/skroutz/analytics.js.git","svn_url":"https://github.com/skroutz/analytics.js","homepage":"http://developer.skroutz.gr/analytics/","size":243,"stargazers_count":7,"watchers_count":7,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/skroutz/analytics.js/pulls/16"},"html":{"href":"https://github.com/skroutz/analytics.js/pull/16"},"issue":{"href":"https://api.github.com/repos/skroutz/analytics.js/issues/16"},"comments":{"href":"https://api.github.com/repos/skroutz/analytics.js/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/skroutz/analytics.js/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/skroutz/analytics.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/skroutz/analytics.js/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/skroutz/analytics.js/statuses/0079d5452dc10a1bf3ba4290426c4031e474d645"}}}}