{"action":"created","comment":{"url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/comments/31991385","id":31991385,"diff_hunk":"@@ -0,0 +1,48 @@\n+require 'rails_helper'\n+\n+RSpec.describe Course::SettingsController, type: :controller do\n+  let(:instance) { create(:instance) }\n+  with_tenant(:instance) do\n+    let(:user) { create(:user) }\n+    let(:course) { create(:course, creator: user) }\n+    before { sign_in(user) }\n+\n+    describe '#components' do\n+      subject { get :components, course_id: course }\n+      it { is_expected.to render_template(:components) }\n+    end\n+\n+    describe '#update_components' do\n+      let(:ids_to_enable) do\n+        allow(controller).to receive(:current_course).and_return(course)\n+        all_components = controller.current_component_host.instance_components\n+        all_component_ids = all_components.map { |c| c.key.to_s }\n+        all_component_ids.sample(1 + rand(all_component_ids.count))\n+      end\n+      let(:components_params) { { enabled_component_ids: ids_to_enable } }\n+\n+      subject do\n+        post :update_components, course_settings_effective: components_params, course_id: course\n+      end\n+\n+      context 'enable/disable components' do\n+        let(:settings) { Course::Settings.new(course.reload) }\n+\n+        it 'enables the specified component and disables all other components' do\n+          subject\n+          expect(settings.enabled_component_ids).to eq(ids_to_enable)\n+        end\n+      end\n+\n+      context 'when course cannot save' do","path":"spec/controllers/course/settings_controller_spec.rb","position":37,"original_position":37,"commit_id":"abb0280dd983180a8cd129f733b940d830a167fc","original_commit_id":"9082ca56f7144a6a47fc0862c0442b9af7421432","user":{"login":"allenwq","id":4983239,"avatar_url":"https://avatars.githubusercontent.com/u/4983239?v=3","gravatar_id":"","url":"https://api.github.com/users/allenwq","html_url":"https://github.com/allenwq","followers_url":"https://api.github.com/users/allenwq/followers","following_url":"https://api.github.com/users/allenwq/following{/other_user}","gists_url":"https://api.github.com/users/allenwq/gists{/gist_id}","starred_url":"https://api.github.com/users/allenwq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allenwq/subscriptions","organizations_url":"https://api.github.com/users/allenwq/orgs","repos_url":"https://api.github.com/users/allenwq/repos","events_url":"https://api.github.com/users/allenwq/events{/privacy}","received_events_url":"https://api.github.com/users/allenwq/received_events","type":"User","site_admin":false},"body":"OK !","created_at":"2015-06-09T08:20:16Z","updated_at":"2015-06-09T08:20:16Z","html_url":"https://github.com/Coursemology/coursemology2/pull/157#discussion_r31991385","pull_request_url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/157","_links":{"self":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/comments/31991385"},"html":{"href":"https://github.com/Coursemology/coursemology2/pull/157#discussion_r31991385"},"pull_request":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/157"}}},"pull_request":{"url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/157","id":32382119,"html_url":"https://github.com/Coursemology/coursemology2/pull/157","diff_url":"https://github.com/Coursemology/coursemology2/pull/157.diff","patch_url":"https://github.com/Coursemology/coursemology2/pull/157.patch","issue_url":"https://api.github.com/repos/Coursemology/coursemology2/issues/157","number":157,"state":"open","locked":false,"title":"Course module settings page","user":{"login":"allenwq","id":4983239,"avatar_url":"https://avatars.githubusercontent.com/u/4983239?v=3","gravatar_id":"","url":"https://api.github.com/users/allenwq","html_url":"https://github.com/allenwq","followers_url":"https://api.github.com/users/allenwq/followers","following_url":"https://api.github.com/users/allenwq/following{/other_user}","gists_url":"https://api.github.com/users/allenwq/gists{/gist_id}","starred_url":"https://api.github.com/users/allenwq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allenwq/subscriptions","organizations_url":"https://api.github.com/users/allenwq/orgs","repos_url":"https://api.github.com/users/allenwq/repos","events_url":"https://api.github.com/users/allenwq/events{/privacy}","received_events_url":"https://api.github.com/users/allenwq/received_events","type":"User","site_admin":false},"body":"Similar to #156, Depends on #294","created_at":"2015-04-01T01:29:04Z","updated_at":"2015-06-09T08:20:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e6eb5255d454c0f0846f0a3e5c022dc73999338","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/157/commits","review_comments_url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/157/comments","review_comment_url":"https://api.github.com/repos/Coursemology/coursemology2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Coursemology/coursemology2/issues/157/comments","statuses_url":"https://api.github.com/repos/Coursemology/coursemology2/statuses/abb0280dd983180a8cd129f733b940d830a167fc","head":{"label":"coursemology-collab:wangqiang/course-module-pages","ref":"wangqiang/course-module-pages","sha":"abb0280dd983180a8cd129f733b940d830a167fc","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-04-24T08:37:06Z","pushed_at":"2015-06-09T08:16: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":3950,"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":"e1a72ac753b81e107ebfdd41cbe89dd3f8139157","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-05-13T05:02:47Z","pushed_at":"2015-06-09T08:16:28Z","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":4654,"stargazers_count":12,"watchers_count":12,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":50,"forks":9,"open_issues":50,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/157"},"html":{"href":"https://github.com/Coursemology/coursemology2/pull/157"},"issue":{"href":"https://api.github.com/repos/Coursemology/coursemology2/issues/157"},"comments":{"href":"https://api.github.com/repos/Coursemology/coursemology2/issues/157/comments"},"review_comments":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/157/comments"},"review_comment":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Coursemology/coursemology2/pulls/157/commits"},"statuses":{"href":"https://api.github.com/repos/Coursemology/coursemology2/statuses/abb0280dd983180a8cd129f733b940d830a167fc"}}}}