{"action":"created","comment":{"url":"https://api.github.com/repos/openmcac/mcac-js/pulls/comments/32997730","id":32997730,"diff_hunk":"@@ -4,125 +4,115 @@ import Pretender from 'pretender';\n import { test, module } from 'qunit';\n import mockServer from '../../helpers/server';\n \n-var application;\n+let application, server;\n \n-var announcements = {\n-  \"1\": {\n-    \"id\": \"1\",\n-    \"description\": \"This is the first announcement\",\n-    \"position\": 1,\n-    \"links\": {\n-      \"bulletin\": \"1\",\n-      \"post\": null\n-    }\n-  },\n-  \"2\": {\n-    \"id\": \"2\",\n-    \"description\": \"This is the second announcement\",\n-    \"position\": 2,\n-    \"url\": \"http://nba.com\",\n-    \"links\": {\n-      \"bulletin\": \"1\",\n-      \"post\": null\n-    }\n-  },\n-  \"3\": {\n-    \"id\": \"3\",\n-    \"description\": \"This is the third announcement\",\n-    \"position\": 3,\n-    \"links\": {\n-      \"bulletin\": \"1\",\n-      \"post\": null\n-    }\n-  }\n-};\n-\n-module('Acceptance: View bulletin', {\n-  setup: function() {\n+module('Acceptance: BulletinsIndex', {\n+  beforeEach: function() {\n     application = startApp();\n+    server = createServer();\n   },\n-  teardown: function() {\n+\n+  afterEach: function() {\n     Ember.run(application, 'destroy');\n   }\n });\n \n-test('visiting /english-service/bulletin/1', function(assert) {\n+function createServer() {\n   var server = mockServer();\n-  server.get('/api/v1/announcements/:id', function(request) {\n-    var announcement = {\n-      \"announcements\": announcements[request.params.id]\n-    };\n-    return [200, {\"Content-Type\": \"application/vnd.api+json\"}, JSON.stringify(announcement)];\n+  server.get('/api/v1/bulletins', function(request) {\n+    if (request.queryParams.group === '1') {\n+      let bulletin1 = {\n+        id: 1,\n+        name: \"Sunday Worship Service 1\",\n+        publishedAt: \"2014-10-07T03:58:00+00:00\"\n+      };\n+\n+      let bulletin2 = {\n+        id: 2,\n+        name: \"Sunday Worship Service 2\",\n+        publishedAt: \"2015-06-07T03:58:00+00:00\"\n+      };\n+\n+      let bulletin3 = {\n+        id: 3,\n+        name: \"Sunday Worship Service 3b\",\n+        publishedAt: \"2015-03-07T03:58:00+00:00\"\n+      };\n+\n+      let bulletin4 = {\n+        id: 4,\n+        name: \"Sunday Worship Service 3a\",\n+        publishedAt: \"2015-03-07T03:58:00+00:00\"\n+      };\n+\n+      var response = {\n+        \"bulletins\": [\n+          createJsonForBulletin(bulletin1),\n+          createJsonForBulletin(bulletin2),\n+          createJsonForBulletin(bulletin3),\n+          createJsonForBulletin(bulletin4)\n+        ]\n+      };\n+\n+      return [200, {\"Content-Type\": \"application/vnd.api+json\"}, JSON.stringify(response)];\n+    }\n   });\n \n-  server.get('/api/v1/bulletins/1', function(request) {\n-    var response = {\n-      \"bulletins\": {\n-        \"id\": \"1\",\n-        \"description\": \"This is a service bulletin.\",\n-        \"name\": \"Sunday Service\",\n-        \"serviceOrder\": \"This is the service order.\",\n-        \"publishedAt\": \"2014-12-21T13:58:27-05:00\",\n-        \"links\": {\n-          \"group\": \"1\",\n-          \"announcements\": [\"1\", \"2\", \"3\"]\n-        }\n-      }\n+  return server;\n+}\n+\n+function createJsonForBulletin(bulletin) {\n+  let response = {\n+    \"id\": bulletin.id,\n+    \"description\": bulletin.description,\n+    \"name\": bulletin.name,\n+    \"serviceOrder\": bulletin.serviceOrder,\n+    \"publishedAt\": bulletin.publishedAt,\n+    \"links\": {\n+      \"group\": \"1\",\n+      \"announcements\": bulletin.announcements\n+    }\n+  };\n+\n+  if (bulletin[\"bannerUrl\"]) {\n+    response[\"bannerUrl\"] = bulletin[\"bannerUrl\"];\n+  }\n+\n+  return response;\n+}\n+\n+function createResponseForBulletin(bulletin) {\n+  server.get(`/api/v1/bulletins/${bulletin.id}`, function(request) {\n+    let response = {\n+      bulletins: createJsonForBulletin(bulletin)\n     };\n-    return [200, {\"Content-Type\": \"application/vnd.api+json\"}, JSON.stringify(response)];\n+\n+    return [\n+      200,\n+      { \"Content-Type\": \"application/vnd.api+json\" },\n+      JSON.stringify(response)\n+    ];\n   });\n+}\n \n-  visit('/english-service/bulletins/1');\n+test('Requires authentication', function(assert) {\n+  visit('/english-service/bulletins');\n \n   andThen(function() {\n-    // bulletin name is displayed\n-    assert.equal(find('.bulletin-info .name').text(), 'Sunday Service');\n-\n-    // announcement descriptions are displayed\n-    assert.equal(find('.announcements li:nth-child(1) .announcement').text().trim(),\n-                 'This is the first announcement');\n-    assert.equal(find('.announcements li:nth-child(2) .announcement').text().trim(),\n-                 'This is the second announcement');\n-    assert.equal(find('.announcements li:nth-child(3) .announcement').text().trim(),\n-                 'This is the third announcement');\n-\n-    // announcement external link placeholders are not rendered if they do\n-    // not have external links\n-    assert.equal(find('.announcements li:nth-child(1) .external-link').length, 0);\n-    assert.equal(find('.announcements li:nth-child(3) .external-link').length, 0);\n-\n-    // announcement external links are rendered when present\n-    assert.equal(find('.announcements li:nth-child(2) .external-link').attr('href'),\n-                 'http://nba.com');\n-\n-    assert.equal(find(\".sermon-notes .no-notes\").length, 1);\n+    assert.equal(currentURL(), '/login');\n   });\n });\n \n-test(\"when there are sermon notes\", function(assert) {\n-  var server = mockServer();\n-\n-  server.get(\"/api/v1/bulletins/1\", function(request) {\n-    var response = {\n-      \"bulletins\": {\n-        \"id\": \"1\",\n-        \"description\": \"This is a service bulletin.\",\n-        \"name\": \"Sunday Service\",\n-        \"serviceOrder\": \"This is the service order.\",\n-        \"publishedAt\": \"2014-12-21T13:58:27-05:00\",\n-        \"sermonNotes\": \"Here are sermon notes\",\n-        \"links\": {\n-          \"group\": \"1\",\n-          \"announcements\": []\n-        }\n-      }\n-    };\n-    return [200, {\"Content-Type\": \"application/vnd.api+json\"}, JSON.stringify(response)];\n-  });\n+test('visiting /english-service/bulletins', function(assert) {\n+  authenticateSession();\n \n-  visit(\"/english-service/bulletins/1\");\n+  visit('/english-service/bulletins');","path":"tests/acceptance/bulletins/index-test.js","position":204,"original_position":204,"commit_id":"cda837ecad1b90f9965aefba2ad44e7f4e81439e","original_commit_id":"cda837ecad1b90f9965aefba2ad44e7f4e81439e","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"'visit' is not defined.","created_at":"2015-06-22T23:55:34Z","updated_at":"2015-06-22T23:55:34Z","html_url":"https://github.com/openmcac/mcac-js/pull/84#discussion_r32997730","pull_request_url":"https://api.github.com/repos/openmcac/mcac-js/pulls/84","_links":{"self":{"href":"https://api.github.com/repos/openmcac/mcac-js/pulls/comments/32997730"},"html":{"href":"https://github.com/openmcac/mcac-js/pull/84#discussion_r32997730"},"pull_request":{"href":"https://api.github.com/repos/openmcac/mcac-js/pulls/84"}}},"pull_request":{"url":"https://api.github.com/repos/openmcac/mcac-js/pulls/84","id":36691021,"html_url":"https://github.com/openmcac/mcac-js/pull/84","diff_url":"https://github.com/openmcac/mcac-js/pull/84.diff","patch_url":"https://github.com/openmcac/mcac-js/pull/84.patch","issue_url":"https://api.github.com/repos/openmcac/mcac-js/issues/84","number":84,"state":"open","locked":false,"title":"Sort posts and bulletins in admin dashboard","user":{"login":"achan","id":549222,"avatar_url":"https://avatars.githubusercontent.com/u/549222?v=3","gravatar_id":"","url":"https://api.github.com/users/achan","html_url":"https://github.com/achan","followers_url":"https://api.github.com/users/achan/followers","following_url":"https://api.github.com/users/achan/following{/other_user}","gists_url":"https://api.github.com/users/achan/gists{/gist_id}","starred_url":"https://api.github.com/users/achan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/achan/subscriptions","organizations_url":"https://api.github.com/users/achan/orgs","repos_url":"https://api.github.com/users/achan/repos","events_url":"https://api.github.com/users/achan/events{/privacy}","received_events_url":"https://api.github.com/users/achan/received_events","type":"User","site_admin":false},"body":"- Sort posts by\r\n - [ ] Published At desc\r\n - [ ] Name asc\r\n- Sort bulletins by\r\n - [x] Published At desc\r\n - [ ] Name asc\r\n- [ ] Write tests for posts\r\n- [ ] Write tests for bulletins","created_at":"2015-06-02T03:06:51Z","updated_at":"2015-06-22T23:55:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b43d98a490b0cb0def9f7b292691ec0e875581c5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openmcac/mcac-js/pulls/84/commits","review_comments_url":"https://api.github.com/repos/openmcac/mcac-js/pulls/84/comments","review_comment_url":"https://api.github.com/repos/openmcac/mcac-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openmcac/mcac-js/issues/84/comments","statuses_url":"https://api.github.com/repos/openmcac/mcac-js/statuses/cda837ecad1b90f9965aefba2ad44e7f4e81439e","head":{"label":"openmcac:jl_sort","ref":"jl_sort","sha":"cda837ecad1b90f9965aefba2ad44e7f4e81439e","user":{"login":"openmcac","id":9523304,"avatar_url":"https://avatars.githubusercontent.com/u/9523304?v=3","gravatar_id":"","url":"https://api.github.com/users/openmcac","html_url":"https://github.com/openmcac","followers_url":"https://api.github.com/users/openmcac/followers","following_url":"https://api.github.com/users/openmcac/following{/other_user}","gists_url":"https://api.github.com/users/openmcac/gists{/gist_id}","starred_url":"https://api.github.com/users/openmcac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmcac/subscriptions","organizations_url":"https://api.github.com/users/openmcac/orgs","repos_url":"https://api.github.com/users/openmcac/repos","events_url":"https://api.github.com/users/openmcac/events{/privacy}","received_events_url":"https://api.github.com/users/openmcac/received_events","type":"Organization","site_admin":false},"repo":{"id":28379334,"name":"mcac-js","full_name":"openmcac/mcac-js","owner":{"login":"openmcac","id":9523304,"avatar_url":"https://avatars.githubusercontent.com/u/9523304?v=3","gravatar_id":"","url":"https://api.github.com/users/openmcac","html_url":"https://github.com/openmcac","followers_url":"https://api.github.com/users/openmcac/followers","following_url":"https://api.github.com/users/openmcac/following{/other_user}","gists_url":"https://api.github.com/users/openmcac/gists{/gist_id}","starred_url":"https://api.github.com/users/openmcac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmcac/subscriptions","organizations_url":"https://api.github.com/users/openmcac/orgs","repos_url":"https://api.github.com/users/openmcac/repos","events_url":"https://api.github.com/users/openmcac/events{/privacy}","received_events_url":"https://api.github.com/users/openmcac/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openmcac/mcac-js","description":"The MCAC webapp.","fork":false,"url":"https://api.github.com/repos/openmcac/mcac-js","forks_url":"https://api.github.com/repos/openmcac/mcac-js/forks","keys_url":"https://api.github.com/repos/openmcac/mcac-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openmcac/mcac-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openmcac/mcac-js/teams","hooks_url":"https://api.github.com/repos/openmcac/mcac-js/hooks","issue_events_url":"https://api.github.com/repos/openmcac/mcac-js/issues/events{/number}","events_url":"https://api.github.com/repos/openmcac/mcac-js/events","assignees_url":"https://api.github.com/repos/openmcac/mcac-js/assignees{/user}","branches_url":"https://api.github.com/repos/openmcac/mcac-js/branches{/branch}","tags_url":"https://api.github.com/repos/openmcac/mcac-js/tags","blobs_url":"https://api.github.com/repos/openmcac/mcac-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openmcac/mcac-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openmcac/mcac-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/openmcac/mcac-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openmcac/mcac-js/statuses/{sha}","languages_url":"https://api.github.com/repos/openmcac/mcac-js/languages","stargazers_url":"https://api.github.com/repos/openmcac/mcac-js/stargazers","contributors_url":"https://api.github.com/repos/openmcac/mcac-js/contributors","subscribers_url":"https://api.github.com/repos/openmcac/mcac-js/subscribers","subscription_url":"https://api.github.com/repos/openmcac/mcac-js/subscription","commits_url":"https://api.github.com/repos/openmcac/mcac-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/openmcac/mcac-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/openmcac/mcac-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/openmcac/mcac-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/openmcac/mcac-js/contents/{+path}","compare_url":"https://api.github.com/repos/openmcac/mcac-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openmcac/mcac-js/merges","archive_url":"https://api.github.com/repos/openmcac/mcac-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openmcac/mcac-js/downloads","issues_url":"https://api.github.com/repos/openmcac/mcac-js/issues{/number}","pulls_url":"https://api.github.com/repos/openmcac/mcac-js/pulls{/number}","milestones_url":"https://api.github.com/repos/openmcac/mcac-js/milestones{/number}","notifications_url":"https://api.github.com/repos/openmcac/mcac-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openmcac/mcac-js/labels{/name}","releases_url":"https://api.github.com/repos/openmcac/mcac-js/releases{/id}","created_at":"2014-12-23T05:27:08Z","updated_at":"2015-05-07T03:49:29Z","pushed_at":"2015-06-22T23:55:26Z","git_url":"git://github.com/openmcac/mcac-js.git","ssh_url":"git@github.com:openmcac/mcac-js.git","clone_url":"https://github.com/openmcac/mcac-js.git","svn_url":"https://github.com/openmcac/mcac-js","homepage":"mcac.church","size":2125,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"openmcac:master","ref":"master","sha":"ef0d6784509ba66513c241d26a87dbbc5ebc1072","user":{"login":"openmcac","id":9523304,"avatar_url":"https://avatars.githubusercontent.com/u/9523304?v=3","gravatar_id":"","url":"https://api.github.com/users/openmcac","html_url":"https://github.com/openmcac","followers_url":"https://api.github.com/users/openmcac/followers","following_url":"https://api.github.com/users/openmcac/following{/other_user}","gists_url":"https://api.github.com/users/openmcac/gists{/gist_id}","starred_url":"https://api.github.com/users/openmcac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmcac/subscriptions","organizations_url":"https://api.github.com/users/openmcac/orgs","repos_url":"https://api.github.com/users/openmcac/repos","events_url":"https://api.github.com/users/openmcac/events{/privacy}","received_events_url":"https://api.github.com/users/openmcac/received_events","type":"Organization","site_admin":false},"repo":{"id":28379334,"name":"mcac-js","full_name":"openmcac/mcac-js","owner":{"login":"openmcac","id":9523304,"avatar_url":"https://avatars.githubusercontent.com/u/9523304?v=3","gravatar_id":"","url":"https://api.github.com/users/openmcac","html_url":"https://github.com/openmcac","followers_url":"https://api.github.com/users/openmcac/followers","following_url":"https://api.github.com/users/openmcac/following{/other_user}","gists_url":"https://api.github.com/users/openmcac/gists{/gist_id}","starred_url":"https://api.github.com/users/openmcac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmcac/subscriptions","organizations_url":"https://api.github.com/users/openmcac/orgs","repos_url":"https://api.github.com/users/openmcac/repos","events_url":"https://api.github.com/users/openmcac/events{/privacy}","received_events_url":"https://api.github.com/users/openmcac/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openmcac/mcac-js","description":"The MCAC webapp.","fork":false,"url":"https://api.github.com/repos/openmcac/mcac-js","forks_url":"https://api.github.com/repos/openmcac/mcac-js/forks","keys_url":"https://api.github.com/repos/openmcac/mcac-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openmcac/mcac-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openmcac/mcac-js/teams","hooks_url":"https://api.github.com/repos/openmcac/mcac-js/hooks","issue_events_url":"https://api.github.com/repos/openmcac/mcac-js/issues/events{/number}","events_url":"https://api.github.com/repos/openmcac/mcac-js/events","assignees_url":"https://api.github.com/repos/openmcac/mcac-js/assignees{/user}","branches_url":"https://api.github.com/repos/openmcac/mcac-js/branches{/branch}","tags_url":"https://api.github.com/repos/openmcac/mcac-js/tags","blobs_url":"https://api.github.com/repos/openmcac/mcac-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openmcac/mcac-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openmcac/mcac-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/openmcac/mcac-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openmcac/mcac-js/statuses/{sha}","languages_url":"https://api.github.com/repos/openmcac/mcac-js/languages","stargazers_url":"https://api.github.com/repos/openmcac/mcac-js/stargazers","contributors_url":"https://api.github.com/repos/openmcac/mcac-js/contributors","subscribers_url":"https://api.github.com/repos/openmcac/mcac-js/subscribers","subscription_url":"https://api.github.com/repos/openmcac/mcac-js/subscription","commits_url":"https://api.github.com/repos/openmcac/mcac-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/openmcac/mcac-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/openmcac/mcac-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/openmcac/mcac-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/openmcac/mcac-js/contents/{+path}","compare_url":"https://api.github.com/repos/openmcac/mcac-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openmcac/mcac-js/merges","archive_url":"https://api.github.com/repos/openmcac/mcac-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openmcac/mcac-js/downloads","issues_url":"https://api.github.com/repos/openmcac/mcac-js/issues{/number}","pulls_url":"https://api.github.com/repos/openmcac/mcac-js/pulls{/number}","milestones_url":"https://api.github.com/repos/openmcac/mcac-js/milestones{/number}","notifications_url":"https://api.github.com/repos/openmcac/mcac-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openmcac/mcac-js/labels{/name}","releases_url":"https://api.github.com/repos/openmcac/mcac-js/releases{/id}","created_at":"2014-12-23T05:27:08Z","updated_at":"2015-05-07T03:49:29Z","pushed_at":"2015-06-22T23:55:26Z","git_url":"git://github.com/openmcac/mcac-js.git","ssh_url":"git@github.com:openmcac/mcac-js.git","clone_url":"https://github.com/openmcac/mcac-js.git","svn_url":"https://github.com/openmcac/mcac-js","homepage":"mcac.church","size":2125,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openmcac/mcac-js/pulls/84"},"html":{"href":"https://github.com/openmcac/mcac-js/pull/84"},"issue":{"href":"https://api.github.com/repos/openmcac/mcac-js/issues/84"},"comments":{"href":"https://api.github.com/repos/openmcac/mcac-js/issues/84/comments"},"review_comments":{"href":"https://api.github.com/repos/openmcac/mcac-js/pulls/84/comments"},"review_comment":{"href":"https://api.github.com/repos/openmcac/mcac-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openmcac/mcac-js/pulls/84/commits"},"statuses":{"href":"https://api.github.com/repos/openmcac/mcac-js/statuses/cda837ecad1b90f9965aefba2ad44e7f4e81439e"}}}}