{"action":"created","comment":{"url":"https://api.github.com/repos/segmentio/analytics.js-integrations/pulls/comments/31770001","id":31770001,"diff_hunk":"@@ -0,0 +1,152 @@\n+\n+var Analytics = require('analytics.js').constructor;\n+var integration = require('analytics.js-integration');\n+var sandbox = require('clear-env');\n+var tester = require('analytics.js-integration-tester');\n+var Ramen = require('./');\n+\n+describe('Ramen', function(){\n+  var analytics;\n+  var ramen;\n+  var options = {\n+    organization_id: '6389149'\n+  };\n+\n+  beforeEach(function(){\n+    analytics = new Analytics();\n+    ramen = new Ramen(options);\n+    analytics.use(Ramen);\n+    analytics.use(tester);\n+    analytics.add(ramen);\n+  });\n+\n+  afterEach(function(){\n+    analytics.restore();\n+    analytics.reset();\n+    ramen.reset();\n+    sandbox();\n+  });\n+\n+  it('should have the right settings', function(){\n+    analytics.compare(Ramen, integration('Ramen')\n+      .global('Ramen')\n+      .global('ramenSettings')\n+      .option('organization_id', '')\n+      .tag('<script src=\"//cdn.ramen.is/assets/ramen.js\">'));\n+  });\n+\n+  describe('before loading', function(){\n+    beforeEach(function(){\n+      analytics.stub(ramen, 'load');\n+    });\n+\n+    describe('#initialize', function(){\n+      it('should not create window.Ramen', function(){\n+        analytics.assert(!window.ramenSettings);\n+        analytics.assert(!window.Ramen);\n+        analytics.initialize();\n+        analytics.page();\n+        analytics.assert(!window.ramenSettings);\n+        analytics.assert(!window.Ramen);\n+      });\n+\n+      it('should call #load', function(){\n+        analytics.initialize();\n+        analytics.page();\n+        analytics.called(ramen.load);\n+      });\n+    });\n+  });\n+\n+  describe('loading', function(){\n+    it('should load', function(done){\n+      analytics.load(ramen, done);\n+    });\n+  });\n+\n+  describe('after loading', function(){\n+    beforeEach(function(done){\n+      analytics.once('ready', done);\n+      analytics.initialize();\n+    });\n+\n+    describe('#identify', function(){\n+      beforeEach(function(){\n+        analytics.stub(window.Ramen, 'go');\n+      });\n+\n+      it('should not call Ramen.go if only id is passed', function(){\n+        analytics.identify('id');\n+        analytics.assert(!window.ramenSettings);\n+        analytics.didNotCall(window.Ramen.go);\n+\n+        analytics.identify('id');\n+        analytics.assert(!window.ramenSettings);\n+        analytics.didNotCall(window.Ramen.go);\n+      });\n+\n+      it('should call Ramen.go and set correct attributes if just email passed', function(){\n+        var email = 'email@example.com';\n+        analytics.identify('id', { email: email });\n+        analytics.assert(window.ramenSettings.organization_id === '6389149');\n+        analytics.assert(window.ramenSettings.user.id === 'id');\n+        analytics.assert(window.ramenSettings.user.name === email);\n+        analytics.assert(window.ramenSettings.user.email === email);\n+        analytics.called(window.Ramen.go);\n+      });\n+\n+      it('should call Ramen.go and set correct attributes if email & name passed', function(){\n+        var email = 'email@example.com';\n+        var name = 'ryan+segment@ramen.is';\n+        analytics.identify('id', { email: email, name: name });\n+        analytics.assert(window.ramenSettings.organization_id === '6389149');\n+        analytics.assert(window.ramenSettings.user.id === 'id');\n+        analytics.assert(window.ramenSettings.user.name === name);\n+        analytics.assert(window.ramenSettings.user.email === email);\n+        analytics.called(window.Ramen.go);\n+      });\n+\n+      it('should pass along integration options', function(){\n+        var email = 'email@example.com';\n+        var name = 'ryan+segment@ramen.is';\n+        var auth_hash = 'authy_hasy';\n+        var timestamp = new Date() / 1000;\n+        var custom_links = [{href: 'https://ramen.is/support', title: 'Hello'}];\n+        var labels = ['use', 'ramen!'];\n+        var environment = 'staging';\n+        var logged_in_url = 'https://align.ramen.is/manage';\n+        var unknown_future_opt = '11';\n+        var unknown_future_user_opt = 'user 11';\n+\n+        analytics.identify('id', {email: email, name: name},\n+          {\n+            integrations: {\n+              Ramen: {\n+                unknown_future_opt: unknown_future_opt,\n+                environment: environment,\n+                timestamp: timestamp,","path":"lib/ramen/test.js","position":127,"original_position":127,"commit_id":"938a0e58f6ea02f422b7a713ada1fba5739fed16","original_commit_id":"938a0e58f6ea02f422b7a713ada1fba5739fed16","user":{"login":"ryana","id":16389,"avatar_url":"https://avatars.githubusercontent.com/u/16389?v=3","gravatar_id":"","url":"https://api.github.com/users/ryana","html_url":"https://github.com/ryana","followers_url":"https://api.github.com/users/ryana/followers","following_url":"https://api.github.com/users/ryana/following{/other_user}","gists_url":"https://api.github.com/users/ryana/gists{/gist_id}","starred_url":"https://api.github.com/users/ryana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryana/subscriptions","organizations_url":"https://api.github.com/users/ryana/orgs","repos_url":"https://api.github.com/users/ryana/repos","events_url":"https://api.github.com/users/ryana/events{/privacy}","received_events_url":"https://api.github.com/users/ryana/received_events","type":"User","site_admin":false},"body":"Actually as I went to do this, I realized that we need to let them pass in `timestamp` here since it factors into the `auth_hash` and the timestamp when analytics.identify() fires will not be the same as the time the `auth_hash` is generated server-side.","created_at":"2015-06-04T21:55:58Z","updated_at":"2015-06-04T21:55:58Z","html_url":"https://github.com/segmentio/analytics.js-integrations/pull/640#discussion_r31770001","pull_request_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/pulls/640","_links":{"self":{"href":"https://api.github.com/repos/segmentio/analytics.js-integrations/pulls/comments/31770001"},"html":{"href":"https://github.com/segmentio/analytics.js-integrations/pull/640#discussion_r31770001"},"pull_request":{"href":"https://api.github.com/repos/segmentio/analytics.js-integrations/pulls/640"}}},"pull_request":{"url":"https://api.github.com/repos/segmentio/analytics.js-integrations/pulls/640","id":36558565,"html_url":"https://github.com/segmentio/analytics.js-integrations/pull/640","diff_url":"https://github.com/segmentio/analytics.js-integrations/pull/640.diff","patch_url":"https://github.com/segmentio/analytics.js-integrations/pull/640.patch","issue_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/issues/640","number":640,"state":"open","locked":false,"title":"Add support for Ramen","user":{"login":"ryana","id":16389,"avatar_url":"https://avatars.githubusercontent.com/u/16389?v=3","gravatar_id":"","url":"https://api.github.com/users/ryana","html_url":"https://github.com/ryana","followers_url":"https://api.github.com/users/ryana/followers","following_url":"https://api.github.com/users/ryana/following{/other_user}","gists_url":"https://api.github.com/users/ryana/gists{/gist_id}","starred_url":"https://api.github.com/users/ryana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryana/subscriptions","organizations_url":"https://api.github.com/users/ryana/orgs","repos_url":"https://api.github.com/users/ryana/repos","events_url":"https://api.github.com/users/ryana/events{/privacy}","received_events_url":"https://api.github.com/users/ryana/received_events","type":"User","site_admin":false},"body":"Allows Segment customers to load [Ramen's](https://ramen.is) JS widget. Currently only supporting the `identify` method.\r\n\r\nThanks!","created_at":"2015-05-30T02:39:06Z","updated_at":"2015-06-04T21:55:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c83c224dd836f82dc1dbae977d157d267d24a94d","assignee":{"login":"ndhoule","id":1863990,"avatar_url":"https://avatars.githubusercontent.com/u/1863990?v=3","gravatar_id":"","url":"https://api.github.com/users/ndhoule","html_url":"https://github.com/ndhoule","followers_url":"https://api.github.com/users/ndhoule/followers","following_url":"https://api.github.com/users/ndhoule/following{/other_user}","gists_url":"https://api.github.com/users/ndhoule/gists{/gist_id}","starred_url":"https://api.github.com/users/ndhoule/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndhoule/subscriptions","organizations_url":"https://api.github.com/users/ndhoule/orgs","repos_url":"https://api.github.com/users/ndhoule/repos","events_url":"https://api.github.com/users/ndhoule/events{/privacy}","received_events_url":"https://api.github.com/users/ndhoule/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/pulls/640/commits","review_comments_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/pulls/640/comments","review_comment_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/pulls/comments{/number}","comments_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/issues/640/comments","statuses_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/statuses/938a0e58f6ea02f422b7a713ada1fba5739fed16","head":{"label":"ramen-dev:master","ref":"master","sha":"938a0e58f6ea02f422b7a713ada1fba5739fed16","user":{"login":"ramen-dev","id":8561238,"avatar_url":"https://avatars.githubusercontent.com/u/8561238?v=3","gravatar_id":"","url":"https://api.github.com/users/ramen-dev","html_url":"https://github.com/ramen-dev","followers_url":"https://api.github.com/users/ramen-dev/followers","following_url":"https://api.github.com/users/ramen-dev/following{/other_user}","gists_url":"https://api.github.com/users/ramen-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/ramen-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramen-dev/subscriptions","organizations_url":"https://api.github.com/users/ramen-dev/orgs","repos_url":"https://api.github.com/users/ramen-dev/repos","events_url":"https://api.github.com/users/ramen-dev/events{/privacy}","received_events_url":"https://api.github.com/users/ramen-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":36464003,"name":"analytics.js-integrations","full_name":"ramen-dev/analytics.js-integrations","owner":{"login":"ramen-dev","id":8561238,"avatar_url":"https://avatars.githubusercontent.com/u/8561238?v=3","gravatar_id":"","url":"https://api.github.com/users/ramen-dev","html_url":"https://github.com/ramen-dev","followers_url":"https://api.github.com/users/ramen-dev/followers","following_url":"https://api.github.com/users/ramen-dev/following{/other_user}","gists_url":"https://api.github.com/users/ramen-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/ramen-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramen-dev/subscriptions","organizations_url":"https://api.github.com/users/ramen-dev/orgs","repos_url":"https://api.github.com/users/ramen-dev/repos","events_url":"https://api.github.com/users/ramen-dev/events{/privacy}","received_events_url":"https://api.github.com/users/ramen-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ramen-dev/analytics.js-integrations","description":"All of the third-party analytics.js integrations.","fork":true,"url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations","forks_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/forks","keys_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/teams","hooks_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/hooks","issue_events_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/issues/events{/number}","events_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/events","assignees_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/assignees{/user}","branches_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/branches{/branch}","tags_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/tags","blobs_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/git/refs{/sha}","trees_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/statuses/{sha}","languages_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/languages","stargazers_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/stargazers","contributors_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/contributors","subscribers_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/subscribers","subscription_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/subscription","commits_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/commits{/sha}","git_commits_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/git/commits{/sha}","comments_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/comments{/number}","issue_comment_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/issues/comments{/number}","contents_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/contents/{+path}","compare_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/merges","archive_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/downloads","issues_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/issues{/number}","pulls_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/pulls{/number}","milestones_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/milestones{/number}","notifications_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/labels{/name}","releases_url":"https://api.github.com/repos/ramen-dev/analytics.js-integrations/releases{/id}","created_at":"2015-05-28T20:22:46Z","updated_at":"2015-05-28T20:22:48Z","pushed_at":"2015-05-30T02:31:42Z","git_url":"git://github.com/ramen-dev/analytics.js-integrations.git","ssh_url":"git@github.com:ramen-dev/analytics.js-integrations.git","clone_url":"https://github.com/ramen-dev/analytics.js-integrations.git","svn_url":"https://github.com/ramen-dev/analytics.js-integrations","homepage":null,"size":2912,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"segmentio:master","ref":"master","sha":"6d410feccc98c1bc518fd1b44f9807e771415309","user":{"login":"segmentio","id":819518,"avatar_url":"https://avatars.githubusercontent.com/u/819518?v=3","gravatar_id":"","url":"https://api.github.com/users/segmentio","html_url":"https://github.com/segmentio","followers_url":"https://api.github.com/users/segmentio/followers","following_url":"https://api.github.com/users/segmentio/following{/other_user}","gists_url":"https://api.github.com/users/segmentio/gists{/gist_id}","starred_url":"https://api.github.com/users/segmentio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/segmentio/subscriptions","organizations_url":"https://api.github.com/users/segmentio/orgs","repos_url":"https://api.github.com/users/segmentio/repos","events_url":"https://api.github.com/users/segmentio/events{/privacy}","received_events_url":"https://api.github.com/users/segmentio/received_events","type":"Organization","site_admin":false},"repo":{"id":14219761,"name":"analytics.js-integrations","full_name":"segmentio/analytics.js-integrations","owner":{"login":"segmentio","id":819518,"avatar_url":"https://avatars.githubusercontent.com/u/819518?v=3","gravatar_id":"","url":"https://api.github.com/users/segmentio","html_url":"https://github.com/segmentio","followers_url":"https://api.github.com/users/segmentio/followers","following_url":"https://api.github.com/users/segmentio/following{/other_user}","gists_url":"https://api.github.com/users/segmentio/gists{/gist_id}","starred_url":"https://api.github.com/users/segmentio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/segmentio/subscriptions","organizations_url":"https://api.github.com/users/segmentio/orgs","repos_url":"https://api.github.com/users/segmentio/repos","events_url":"https://api.github.com/users/segmentio/events{/privacy}","received_events_url":"https://api.github.com/users/segmentio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/segmentio/analytics.js-integrations","description":"All of the third-party analytics.js integrations.","fork":false,"url":"https://api.github.com/repos/segmentio/analytics.js-integrations","forks_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/forks","keys_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/keys{/key_id}","collaborators_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/teams","hooks_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/hooks","issue_events_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/issues/events{/number}","events_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/events","assignees_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/assignees{/user}","branches_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/branches{/branch}","tags_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/tags","blobs_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/git/refs{/sha}","trees_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/git/trees{/sha}","statuses_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/statuses/{sha}","languages_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/languages","stargazers_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/stargazers","contributors_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/contributors","subscribers_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/subscribers","subscription_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/subscription","commits_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/commits{/sha}","git_commits_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/git/commits{/sha}","comments_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/comments{/number}","issue_comment_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/issues/comments{/number}","contents_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/contents/{+path}","compare_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/compare/{base}...{head}","merges_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/merges","archive_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/downloads","issues_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/issues{/number}","pulls_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/pulls{/number}","milestones_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/milestones{/number}","notifications_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/labels{/name}","releases_url":"https://api.github.com/repos/segmentio/analytics.js-integrations/releases{/id}","created_at":"2013-11-08T00:09:00Z","updated_at":"2015-05-12T23:07:54Z","pushed_at":"2015-06-04T16:15:08Z","git_url":"git://github.com/segmentio/analytics.js-integrations.git","ssh_url":"git@github.com:segmentio/analytics.js-integrations.git","clone_url":"https://github.com/segmentio/analytics.js-integrations.git","svn_url":"https://github.com/segmentio/analytics.js-integrations","homepage":null,"size":13112,"stargazers_count":63,"watchers_count":63,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":147,"mirror_url":null,"open_issues_count":70,"forks":147,"open_issues":70,"watchers":63,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/segmentio/analytics.js-integrations/pulls/640"},"html":{"href":"https://github.com/segmentio/analytics.js-integrations/pull/640"},"issue":{"href":"https://api.github.com/repos/segmentio/analytics.js-integrations/issues/640"},"comments":{"href":"https://api.github.com/repos/segmentio/analytics.js-integrations/issues/640/comments"},"review_comments":{"href":"https://api.github.com/repos/segmentio/analytics.js-integrations/pulls/640/comments"},"review_comment":{"href":"https://api.github.com/repos/segmentio/analytics.js-integrations/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/segmentio/analytics.js-integrations/pulls/640/commits"},"statuses":{"href":"https://api.github.com/repos/segmentio/analytics.js-integrations/statuses/938a0e58f6ea02f422b7a713ada1fba5739fed16"}}}}