{"action":"created","comment":{"url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/comments/44775236","id":44775236,"diff_hunk":"@@ -0,0 +1,86 @@\n+require 'rails_helper'\n+\n+RSpec.describe Course::Forum::TopicsController, type: :controller do\n+  let!(:instance) { create(:instance) }\n+\n+  with_tenant(:instance) do\n+    let(:user) { create(:administrator) }\n+    let(:course) { create(:course) }\n+    let(:forum) { create(:forum, course: course) }\n+    let!(:topic_stub) do\n+      stub = create(:forum_topic, forum: forum)\n+      allow(stub).to receive(:save).and_return(false)\n+      allow(stub).to receive(:destroy).and_return(false)\n+      allow(stub.subscriptions).to receive(:create).and_return(false)\n+      allow(stub.subscriptions).to receive_message_chain(:where, destroy_all: false)\n+      stub\n+    end\n+\n+    before { sign_in(user) }\n+\n+    describe '#destroy' do\n+      subject { delete :destroy, course_id: course, forum_id: forum, id: topic_stub }\n+\n+      context 'when destroy fails' do\n+        before do\n+          controller.instance_variable_set(:@topic, topic_stub)\n+          subject\n+        end\n+\n+        it { is_expected.to redirect_to(course_forum_topic_path(course, forum, topic_stub)) }\n+      end\n+    end\n+\n+    describe '#subscribe' do\n+      subject { post :subscribe, course_id: course, forum_id: forum, id: topic_stub }\n+\n+      context 'when subscribe fails' do\n+        before do\n+          controller.instance_variable_set(:@topic, topic_stub)\n+          subject\n+        end\n+\n+        it { is_expected.to redirect_to(course_forum_topic_path(course, forum, topic_stub)) }\n+      end\n+    end\n+\n+    describe '#unsubscribe' do\n+      subject { delete :unsubscribe, course_id: course, forum_id: forum, id: topic_stub }\n+\n+      context 'when unsubscribe fails' do\n+        before do\n+          controller.instance_variable_set(:@topic, topic_stub)\n+          subject\n+        end\n+\n+        it { is_expected.to redirect_to(course_forum_topic_path(course, forum, topic_stub)) }\n+      end\n+    end\n+\n+    describe '#locked' do\n+      subject { put :set_locked, course_id: course, forum_id: forum, id: topic_stub, option: true }\n+\n+      context 'when set locked fails' do\n+        before do\n+          controller.instance_variable_set(:@topic, topic_stub)\n+          subject\n+        end\n+\n+        it { is_expected.to redirect_to(course_forum_topic_path(course, forum, topic_stub)) }\n+      end\n+    end\n+\n+    describe '#hidden' do\n+      subject { put :set_hidden, course_id: course, forum_id: forum, id: topic_stub, option: true }\n+\n+      context 'when set hidden fails' do\n+        before do\n+          controller.instance_variable_set(:@topic, topic_stub)\n+          subject\n+        end\n+\n+        it { is_expected.to redirect_to(course_forum_topic_path(course, forum, topic_stub)) }","path":"spec/controllers/course/forum/topics_controller_spec.rb","position":82,"original_position":82,"commit_id":"0259adfb2d881e8e2b32dd72cf1be9677c2177ae","original_commit_id":"0259adfb2d881e8e2b32dd72cf1be9677c2177ae","user":{"login":"lowjoel","id":2505070,"avatar_url":"https://avatars.githubusercontent.com/u/2505070?v=3","gravatar_id":"","url":"https://api.github.com/users/lowjoel","html_url":"https://github.com/lowjoel","followers_url":"https://api.github.com/users/lowjoel/followers","following_url":"https://api.github.com/users/lowjoel/following{/other_user}","gists_url":"https://api.github.com/users/lowjoel/gists{/gist_id}","starred_url":"https://api.github.com/users/lowjoel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lowjoel/subscriptions","organizations_url":"https://api.github.com/users/lowjoel/orgs","repos_url":"https://api.github.com/users/lowjoel/repos","events_url":"https://api.github.com/users/lowjoel/events{/privacy}","received_events_url":"https://api.github.com/users/lowjoel/received_events","type":"User","site_admin":false},"body":"Maybe you should check the flash also?","created_at":"2015-11-13T12:00:19Z","updated_at":"2015-11-13T12:00:19Z","html_url":"https://github.com/Coursemology/coursemology2/pull/539#discussion_r44775236","pull_request_url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/539","_links":{"self":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/comments/44775236"},"html":{"href":"https://github.com/Coursemology/coursemology2/pull/539#discussion_r44775236"},"pull_request":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/539"}}},"pull_request":{"url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/539","id":48863276,"html_url":"https://github.com/Coursemology/coursemology2/pull/539","diff_url":"https://github.com/Coursemology/coursemology2/pull/539.diff","patch_url":"https://github.com/Coursemology/coursemology2/pull/539.patch","issue_url":"https://api.github.com/repos/Coursemology/coursemology2/issues/539","number":539,"state":"open","locked":false,"title":"Topic controller","user":{"login":"xzhflying","id":8858295,"avatar_url":"https://avatars.githubusercontent.com/u/8858295?v=3","gravatar_id":"","url":"https://api.github.com/users/xzhflying","html_url":"https://github.com/xzhflying","followers_url":"https://api.github.com/users/xzhflying/followers","following_url":"https://api.github.com/users/xzhflying/following{/other_user}","gists_url":"https://api.github.com/users/xzhflying/gists{/gist_id}","starred_url":"https://api.github.com/users/xzhflying/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xzhflying/subscriptions","organizations_url":"https://api.github.com/users/xzhflying/orgs","repos_url":"https://api.github.com/users/xzhflying/repos","events_url":"https://api.github.com/users/xzhflying/events{/privacy}","received_events_url":"https://api.github.com/users/xzhflying/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-27T12:22:34Z","updated_at":"2015-11-13T12:00:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3b788139f9e5a87b6d6f65ea0f7e3d4d20f8b2cf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/539/commits","review_comments_url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/539/comments","review_comment_url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Coursemology/coursemology2/issues/539/comments","statuses_url":"https://api.github.com/repos/Coursemology/coursemology2/statuses/0259adfb2d881e8e2b32dd72cf1be9677c2177ae","head":{"label":"xzhflying:topic_controller","ref":"topic_controller","sha":"0259adfb2d881e8e2b32dd72cf1be9677c2177ae","user":{"login":"xzhflying","id":8858295,"avatar_url":"https://avatars.githubusercontent.com/u/8858295?v=3","gravatar_id":"","url":"https://api.github.com/users/xzhflying","html_url":"https://github.com/xzhflying","followers_url":"https://api.github.com/users/xzhflying/followers","following_url":"https://api.github.com/users/xzhflying/following{/other_user}","gists_url":"https://api.github.com/users/xzhflying/gists{/gist_id}","starred_url":"https://api.github.com/users/xzhflying/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xzhflying/subscriptions","organizations_url":"https://api.github.com/users/xzhflying/orgs","repos_url":"https://api.github.com/users/xzhflying/repos","events_url":"https://api.github.com/users/xzhflying/events{/privacy}","received_events_url":"https://api.github.com/users/xzhflying/received_events","type":"User","site_admin":false},"repo":{"id":31704878,"name":"coursemology2","full_name":"xzhflying/coursemology2","owner":{"login":"xzhflying","id":8858295,"avatar_url":"https://avatars.githubusercontent.com/u/8858295?v=3","gravatar_id":"","url":"https://api.github.com/users/xzhflying","html_url":"https://github.com/xzhflying","followers_url":"https://api.github.com/users/xzhflying/followers","following_url":"https://api.github.com/users/xzhflying/following{/other_user}","gists_url":"https://api.github.com/users/xzhflying/gists{/gist_id}","starred_url":"https://api.github.com/users/xzhflying/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xzhflying/subscriptions","organizations_url":"https://api.github.com/users/xzhflying/orgs","repos_url":"https://api.github.com/users/xzhflying/repos","events_url":"https://api.github.com/users/xzhflying/events{/privacy}","received_events_url":"https://api.github.com/users/xzhflying/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xzhflying/coursemology2","description":"Rails 4 re-write of Coursemology","fork":true,"url":"https://api.github.com/repos/xzhflying/coursemology2","forks_url":"https://api.github.com/repos/xzhflying/coursemology2/forks","keys_url":"https://api.github.com/repos/xzhflying/coursemology2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xzhflying/coursemology2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xzhflying/coursemology2/teams","hooks_url":"https://api.github.com/repos/xzhflying/coursemology2/hooks","issue_events_url":"https://api.github.com/repos/xzhflying/coursemology2/issues/events{/number}","events_url":"https://api.github.com/repos/xzhflying/coursemology2/events","assignees_url":"https://api.github.com/repos/xzhflying/coursemology2/assignees{/user}","branches_url":"https://api.github.com/repos/xzhflying/coursemology2/branches{/branch}","tags_url":"https://api.github.com/repos/xzhflying/coursemology2/tags","blobs_url":"https://api.github.com/repos/xzhflying/coursemology2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xzhflying/coursemology2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xzhflying/coursemology2/git/refs{/sha}","trees_url":"https://api.github.com/repos/xzhflying/coursemology2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xzhflying/coursemology2/statuses/{sha}","languages_url":"https://api.github.com/repos/xzhflying/coursemology2/languages","stargazers_url":"https://api.github.com/repos/xzhflying/coursemology2/stargazers","contributors_url":"https://api.github.com/repos/xzhflying/coursemology2/contributors","subscribers_url":"https://api.github.com/repos/xzhflying/coursemology2/subscribers","subscription_url":"https://api.github.com/repos/xzhflying/coursemology2/subscription","commits_url":"https://api.github.com/repos/xzhflying/coursemology2/commits{/sha}","git_commits_url":"https://api.github.com/repos/xzhflying/coursemology2/git/commits{/sha}","comments_url":"https://api.github.com/repos/xzhflying/coursemology2/comments{/number}","issue_comment_url":"https://api.github.com/repos/xzhflying/coursemology2/issues/comments{/number}","contents_url":"https://api.github.com/repos/xzhflying/coursemology2/contents/{+path}","compare_url":"https://api.github.com/repos/xzhflying/coursemology2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xzhflying/coursemology2/merges","archive_url":"https://api.github.com/repos/xzhflying/coursemology2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xzhflying/coursemology2/downloads","issues_url":"https://api.github.com/repos/xzhflying/coursemology2/issues{/number}","pulls_url":"https://api.github.com/repos/xzhflying/coursemology2/pulls{/number}","milestones_url":"https://api.github.com/repos/xzhflying/coursemology2/milestones{/number}","notifications_url":"https://api.github.com/repos/xzhflying/coursemology2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xzhflying/coursemology2/labels{/name}","releases_url":"https://api.github.com/repos/xzhflying/coursemology2/releases{/id}","created_at":"2015-03-05T09:01:00Z","updated_at":"2015-03-30T12:53:21Z","pushed_at":"2015-11-09T07:13:19Z","git_url":"git://github.com/xzhflying/coursemology2.git","ssh_url":"git@github.com:xzhflying/coursemology2.git","clone_url":"https://github.com/xzhflying/coursemology2.git","svn_url":"https://github.com/xzhflying/coursemology2","homepage":null,"size":2352,"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":"7e2d924279efd7ad6008918ca744507451a9f519","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-07-29T08:51:36Z","pushed_at":"2015-11-12T16:43:49Z","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":7362,"stargazers_count":13,"watchers_count":13,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":51,"forks":11,"open_issues":51,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/539"},"html":{"href":"https://github.com/Coursemology/coursemology2/pull/539"},"issue":{"href":"https://api.github.com/repos/Coursemology/coursemology2/issues/539"},"comments":{"href":"https://api.github.com/repos/Coursemology/coursemology2/issues/539/comments"},"review_comments":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/539/comments"},"review_comment":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/539/commits"},"statuses":{"href":"https://api.github.com/repos/Coursemology/coursemology2/statuses/0259adfb2d881e8e2b32dd72cf1be9677c2177ae"}}}}