{"action":"created","comment":{"url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/comments/23011851","id":23011851,"diff_hunk":"@@ -0,0 +1,141 @@\n+require 'rails_helper'\n+\n+describe 'Announcement management' do\n+  subject { page }\n+\n+  let!(:instance) { create(:instance) }\n+\n+  with_tenant(:instance) do\n+    let!(:user) { create(:user, role: :administrator) }\n+    let!(:course) { create(:course) }\n+\n+    before do\n+      login_as(user, scope: :user)\n+    end\n+\n+    describe 'announcement creation' do\n+      before { visit new_course_announcement_path(course) }\n+\n+      context 'with invalid information' do\n+        before { click_button 'Create' }\n+\n+        it 'stays on the same page' do\n+          expect(page).to have_button('Create')\n+        end\n+\n+        it 'shows errors' do\n+          expect(page).to have_css('div.has-error')\n+        end\n+      end\n+\n+      context 'with valid information' do\n+        let(:announcement) { build(:course_announcement, course: course) }\n+\n+        before do\n+          fill_in 'course_announcement_title',    with: announcement.title\n+          fill_in 'course_announcement_content',  with: announcement.content\n+        end\n+\n+        it 'creates an announcement' do\n+          expect { click_button 'Create' }.to change(Course::Announcement, :count).by(1)\n+        end\n+\n+        context 'after creation' do\n+          before { click_button 'Create' }\n+\n+          it 'shows the success message' do\n+            expect(page).to have_selector('div',\n+                                          text: I18n.translate('course.announcements.create.notice',\n+                                                               title: announcement.title))\n+          end\n+\n+          it 'redirects the user to the index page' do\n+            expect(current_path).to eq(course_announcements_path(course))\n+          end\n+        end\n+      end\n+    end\n+\n+    describe 'announcement editing' do\n+      let!(:announcement) { create(:course_announcement, course: course) }\n+\n+      before { visit edit_course_announcement_path(course, announcement) }\n+\n+      context 'page rendering' do\n+        it { is_expected.to have_field('course_announcement_title', with: announcement.title) }\n+        it { is_expected.to have_field('course_announcement_content', with: announcement.content) }\n+        it { is_expected.to have_field('course_announcement[valid_from]', with: announcement.valid_from) }","path":"spec/features/announcement_management_spec.rb","position":67,"original_position":67,"commit_id":"ce686558100a2ea3fac586ef42017ee9874de8cf","original_commit_id":"ce686558100a2ea3fac586ef42017ee9874de8cf","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":"Line is too long. [106/100]","created_at":"2015-01-15T14:22:37Z","updated_at":"2015-01-15T14:22:37Z","html_url":"https://github.com/Coursemology/coursemology2/pull/62#discussion_r23011851","pull_request_url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/62","_links":{"self":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/comments/23011851"},"html":{"href":"https://github.com/Coursemology/coursemology2/pull/62#discussion_r23011851"},"pull_request":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/62"}}},"pull_request":{"url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/62","id":27335179,"html_url":"https://github.com/Coursemology/coursemology2/pull/62","diff_url":"https://github.com/Coursemology/coursemology2/pull/62.diff","patch_url":"https://github.com/Coursemology/coursemology2/pull/62.patch","issue_url":"https://api.github.com/repos/Coursemology/coursemology2/issues/62","number":62,"state":"open","locked":false,"title":"announcement pages","user":{"login":"wangqiang1208","id":4983239,"avatar_url":"https://avatars.githubusercontent.com/u/4983239?v=3","gravatar_id":"","url":"https://api.github.com/users/wangqiang1208","html_url":"https://github.com/wangqiang1208","followers_url":"https://api.github.com/users/wangqiang1208/followers","following_url":"https://api.github.com/users/wangqiang1208/following{/other_user}","gists_url":"https://api.github.com/users/wangqiang1208/gists{/gist_id}","starred_url":"https://api.github.com/users/wangqiang1208/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangqiang1208/subscriptions","organizations_url":"https://api.github.com/users/wangqiang1208/orgs","repos_url":"https://api.github.com/users/wangqiang1208/repos","events_url":"https://api.github.com/users/wangqiang1208/events{/privacy}","received_events_url":"https://api.github.com/users/wangqiang1208/received_events","type":"User","site_admin":false},"body":"Depends on #57 \r\n\r\nNot ready for review yet","created_at":"2015-01-14T09:07:49Z","updated_at":"2015-01-15T14:22:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4bbbb51f5d5db3a9437b2cc703727a591275f0a3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/62/commits","review_comments_url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/62/comments","review_comment_url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/comments/{number}","comments_url":"https://api.github.com/repos/Coursemology/coursemology2/issues/62/comments","statuses_url":"https://api.github.com/repos/Coursemology/coursemology2/statuses/ce686558100a2ea3fac586ef42017ee9874de8cf","head":{"label":"coursemology-collab:wangqiang/announcement-module-declaration","ref":"wangqiang/announcement-module-declaration","sha":"ce686558100a2ea3fac586ef42017ee9874de8cf","user":{"login":"coursemology-collab","id":8666458,"avatar_url":"https://avatars.githubusercontent.com/u/8666458?v=3","gravatar_id":"","url":"https://api.github.com/users/coursemology-collab","html_url":"https://github.com/coursemology-collab","followers_url":"https://api.github.com/users/coursemology-collab/followers","following_url":"https://api.github.com/users/coursemology-collab/following{/other_user}","gists_url":"https://api.github.com/users/coursemology-collab/gists{/gist_id}","starred_url":"https://api.github.com/users/coursemology-collab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coursemology-collab/subscriptions","organizations_url":"https://api.github.com/users/coursemology-collab/orgs","repos_url":"https://api.github.com/users/coursemology-collab/repos","events_url":"https://api.github.com/users/coursemology-collab/events{/privacy}","received_events_url":"https://api.github.com/users/coursemology-collab/received_events","type":"Organization","site_admin":false},"repo":{"id":23697674,"name":"coursemology2","full_name":"coursemology-collab/coursemology2","owner":{"login":"coursemology-collab","id":8666458,"avatar_url":"https://avatars.githubusercontent.com/u/8666458?v=3","gravatar_id":"","url":"https://api.github.com/users/coursemology-collab","html_url":"https://github.com/coursemology-collab","followers_url":"https://api.github.com/users/coursemology-collab/followers","following_url":"https://api.github.com/users/coursemology-collab/following{/other_user}","gists_url":"https://api.github.com/users/coursemology-collab/gists{/gist_id}","starred_url":"https://api.github.com/users/coursemology-collab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coursemology-collab/subscriptions","organizations_url":"https://api.github.com/users/coursemology-collab/orgs","repos_url":"https://api.github.com/users/coursemology-collab/repos","events_url":"https://api.github.com/users/coursemology-collab/events{/privacy}","received_events_url":"https://api.github.com/users/coursemology-collab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coursemology-collab/coursemology2","description":"Rails 4 re-write of Coursemology","fork":true,"url":"https://api.github.com/repos/coursemology-collab/coursemology2","forks_url":"https://api.github.com/repos/coursemology-collab/coursemology2/forks","keys_url":"https://api.github.com/repos/coursemology-collab/coursemology2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coursemology-collab/coursemology2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coursemology-collab/coursemology2/teams","hooks_url":"https://api.github.com/repos/coursemology-collab/coursemology2/hooks","issue_events_url":"https://api.github.com/repos/coursemology-collab/coursemology2/issues/events{/number}","events_url":"https://api.github.com/repos/coursemology-collab/coursemology2/events","assignees_url":"https://api.github.com/repos/coursemology-collab/coursemology2/assignees{/user}","branches_url":"https://api.github.com/repos/coursemology-collab/coursemology2/branches{/branch}","tags_url":"https://api.github.com/repos/coursemology-collab/coursemology2/tags","blobs_url":"https://api.github.com/repos/coursemology-collab/coursemology2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coursemology-collab/coursemology2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coursemology-collab/coursemology2/git/refs{/sha}","trees_url":"https://api.github.com/repos/coursemology-collab/coursemology2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coursemology-collab/coursemology2/statuses/{sha}","languages_url":"https://api.github.com/repos/coursemology-collab/coursemology2/languages","stargazers_url":"https://api.github.com/repos/coursemology-collab/coursemology2/stargazers","contributors_url":"https://api.github.com/repos/coursemology-collab/coursemology2/contributors","subscribers_url":"https://api.github.com/repos/coursemology-collab/coursemology2/subscribers","subscription_url":"https://api.github.com/repos/coursemology-collab/coursemology2/subscription","commits_url":"https://api.github.com/repos/coursemology-collab/coursemology2/commits{/sha}","git_commits_url":"https://api.github.com/repos/coursemology-collab/coursemology2/git/commits{/sha}","comments_url":"https://api.github.com/repos/coursemology-collab/coursemology2/comments{/number}","issue_comment_url":"https://api.github.com/repos/coursemology-collab/coursemology2/issues/comments/{number}","contents_url":"https://api.github.com/repos/coursemology-collab/coursemology2/contents/{+path}","compare_url":"https://api.github.com/repos/coursemology-collab/coursemology2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coursemology-collab/coursemology2/merges","archive_url":"https://api.github.com/repos/coursemology-collab/coursemology2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coursemology-collab/coursemology2/downloads","issues_url":"https://api.github.com/repos/coursemology-collab/coursemology2/issues{/number}","pulls_url":"https://api.github.com/repos/coursemology-collab/coursemology2/pulls{/number}","milestones_url":"https://api.github.com/repos/coursemology-collab/coursemology2/milestones{/number}","notifications_url":"https://api.github.com/repos/coursemology-collab/coursemology2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coursemology-collab/coursemology2/labels{/name}","releases_url":"https://api.github.com/repos/coursemology-collab/coursemology2/releases{/id}","created_at":"2014-09-05T09:32:07Z","updated_at":"2015-01-12T08:07:08Z","pushed_at":"2015-01-15T14:22:28Z","git_url":"git://github.com/coursemology-collab/coursemology2.git","ssh_url":"git@github.com:coursemology-collab/coursemology2.git","clone_url":"https://github.com/coursemology-collab/coursemology2.git","svn_url":"https://github.com/coursemology-collab/coursemology2","homepage":null,"size":1876,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"Coursemology:master","ref":"master","sha":"31008a2b77950a275e6d6dfc64691f9f684bc598","user":{"login":"Coursemology","id":4427741,"avatar_url":"https://avatars.githubusercontent.com/u/4427741?v=3","gravatar_id":"","url":"https://api.github.com/users/Coursemology","html_url":"https://github.com/Coursemology","followers_url":"https://api.github.com/users/Coursemology/followers","following_url":"https://api.github.com/users/Coursemology/following{/other_user}","gists_url":"https://api.github.com/users/Coursemology/gists{/gist_id}","starred_url":"https://api.github.com/users/Coursemology/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Coursemology/subscriptions","organizations_url":"https://api.github.com/users/Coursemology/orgs","repos_url":"https://api.github.com/users/Coursemology/repos","events_url":"https://api.github.com/users/Coursemology/events{/privacy}","received_events_url":"https://api.github.com/users/Coursemology/received_events","type":"Organization","site_admin":false},"repo":{"id":22155032,"name":"coursemology2","full_name":"Coursemology/coursemology2","owner":{"login":"Coursemology","id":4427741,"avatar_url":"https://avatars.githubusercontent.com/u/4427741?v=3","gravatar_id":"","url":"https://api.github.com/users/Coursemology","html_url":"https://github.com/Coursemology","followers_url":"https://api.github.com/users/Coursemology/followers","following_url":"https://api.github.com/users/Coursemology/following{/other_user}","gists_url":"https://api.github.com/users/Coursemology/gists{/gist_id}","starred_url":"https://api.github.com/users/Coursemology/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Coursemology/subscriptions","organizations_url":"https://api.github.com/users/Coursemology/orgs","repos_url":"https://api.github.com/users/Coursemology/repos","events_url":"https://api.github.com/users/Coursemology/events{/privacy}","received_events_url":"https://api.github.com/users/Coursemology/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Coursemology/coursemology2","description":"Rails 4 re-write of Coursemology","fork":false,"url":"https://api.github.com/repos/Coursemology/coursemology2","forks_url":"https://api.github.com/repos/Coursemology/coursemology2/forks","keys_url":"https://api.github.com/repos/Coursemology/coursemology2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Coursemology/coursemology2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Coursemology/coursemology2/teams","hooks_url":"https://api.github.com/repos/Coursemology/coursemology2/hooks","issue_events_url":"https://api.github.com/repos/Coursemology/coursemology2/issues/events{/number}","events_url":"https://api.github.com/repos/Coursemology/coursemology2/events","assignees_url":"https://api.github.com/repos/Coursemology/coursemology2/assignees{/user}","branches_url":"https://api.github.com/repos/Coursemology/coursemology2/branches{/branch}","tags_url":"https://api.github.com/repos/Coursemology/coursemology2/tags","blobs_url":"https://api.github.com/repos/Coursemology/coursemology2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Coursemology/coursemology2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Coursemology/coursemology2/git/refs{/sha}","trees_url":"https://api.github.com/repos/Coursemology/coursemology2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Coursemology/coursemology2/statuses/{sha}","languages_url":"https://api.github.com/repos/Coursemology/coursemology2/languages","stargazers_url":"https://api.github.com/repos/Coursemology/coursemology2/stargazers","contributors_url":"https://api.github.com/repos/Coursemology/coursemology2/contributors","subscribers_url":"https://api.github.com/repos/Coursemology/coursemology2/subscribers","subscription_url":"https://api.github.com/repos/Coursemology/coursemology2/subscription","commits_url":"https://api.github.com/repos/Coursemology/coursemology2/commits{/sha}","git_commits_url":"https://api.github.com/repos/Coursemology/coursemology2/git/commits{/sha}","comments_url":"https://api.github.com/repos/Coursemology/coursemology2/comments{/number}","issue_comment_url":"https://api.github.com/repos/Coursemology/coursemology2/issues/comments/{number}","contents_url":"https://api.github.com/repos/Coursemology/coursemology2/contents/{+path}","compare_url":"https://api.github.com/repos/Coursemology/coursemology2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Coursemology/coursemology2/merges","archive_url":"https://api.github.com/repos/Coursemology/coursemology2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Coursemology/coursemology2/downloads","issues_url":"https://api.github.com/repos/Coursemology/coursemology2/issues{/number}","pulls_url":"https://api.github.com/repos/Coursemology/coursemology2/pulls{/number}","milestones_url":"https://api.github.com/repos/Coursemology/coursemology2/milestones{/number}","notifications_url":"https://api.github.com/repos/Coursemology/coursemology2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Coursemology/coursemology2/labels{/name}","releases_url":"https://api.github.com/repos/Coursemology/coursemology2/releases{/id}","created_at":"2014-07-23T14:57:06Z","updated_at":"2015-01-14T06:40:33Z","pushed_at":"2015-01-14T06:40:32Z","git_url":"git://github.com/Coursemology/coursemology2.git","ssh_url":"git@github.com:Coursemology/coursemology2.git","clone_url":"https://github.com/Coursemology/coursemology2.git","svn_url":"https://github.com/Coursemology/coursemology2","homepage":null,"size":1800,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":6,"forks":6,"open_issues":6,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/62"},"html":{"href":"https://github.com/Coursemology/coursemology2/pull/62"},"issue":{"href":"https://api.github.com/repos/Coursemology/coursemology2/issues/62"},"comments":{"href":"https://api.github.com/repos/Coursemology/coursemology2/issues/62/comments"},"review_comments":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/62/comments"},"review_comment":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/62/commits"},"statuses":{"href":"https://api.github.com/repos/Coursemology/coursemology2/statuses/ce686558100a2ea3fac586ef42017ee9874de8cf"}}}}