{"action":"created","comment":{"url":"https://api.github.com/repos/Freika/ruby_courses/pulls/comments/99534591","pull_request_review_id":20212424,"id":99534591,"diff_hunk":"@@ -0,0 +1,317 @@\n+require 'rails_helper'\n+\n+RSpec.describe \"Courses\", type: :request do\n+  describe 'listring courses' do\n+    before(:all) do\n+      FactoryGirl.create(:course, \n+        title: 'ruby-course for juniors',\n+        language: 'Русский',\n+        approved: true,\n+        paid: false        \n+      )\n+      FactoryGirl.create(:course, \n+        title: 'ruby-course for middle developers',\n+        language: 'Русский',\n+        approved: true,\n+        paid: true\n+      )\n+      FactoryGirl.create(:course, \n+        title: 'ruby-course for middle seniors',\n+        language: 'Русский',\n+        approved: true,\n+        paid: true\n+      )\n+      FactoryGirl.create(:course, \n+        title: 'ruby for zombie',\n+        language: \"English\",\n+        approved: true,\n+        paid: false\n+      )\n+      FactoryGirl.create(:course, \n+        title: 'ruby for zombie 2',\n+        language: \"English\",\n+        approved: true,\n+        paid: true\n+      )\n+      FactoryGirl.create(:course, \n+        title: 'RoR for one week',\n+        language: \"English\",\n+        approved: true,\n+        paid: true\n+      )\n+      FactoryGirl.create(:course, \n+        title: 'unapproved course',\n+        language: \"English\",\n+        approved: false\n+      )\n+    end\n+    \n+    it 'show only approved courses' do\n+      get '/courses'\n+\n+      expect(response.code).to eq(\"200\")\n+      expect(response.body).to include(\"ruby-course for juniors\")\n+      expect(response.body).to include(\"ruby-course for middle developers\")\n+      expect(response.body).to include(\"ruby-course for middle seniors\")\n+      expect(response.body).to include(\"ruby for zombie\")\n+      expect(response.body).to include(\"ruby for zombie 2\")\n+      expect(response.body).to include(\"RoR for one week\")\n+      expect(response.body).not_to include(\"unapproved course\")\n+    end\n+\n+    describe 'searching courses' do\n+      it 'searching by title' do\n+        get '/courses?title=ruby-course'\n+\n+        expect(response.code).to eq(\"200\")\n+        expect(response.body).to include(\"ruby-course for juniors\")\n+        expect(response.body).to include(\"ruby-course for middle developers\")\n+        expect(response.body).to include(\"ruby-course for middle seniors\")\n+        expect(response.body).not_to include(\"ruby for zombie\")\n+        expect(response.body).not_to include(\"ruby for zombie 2\")\n+        expect(response.body).not_to include(\"RoR for one week\")\n+      end\n+\n+      it 'searching by language' do\n+        get '/courses?language=English'\n+\n+        expect(response.code).to eq(\"200\")\n+        expect(response.body).not_to include(\"ruby-course for juniors\")\n+        expect(response.body).not_to include(\"ruby-course for middle developers\")\n+        expect(response.body).not_to include(\"ruby-course for middle seniors\")\n+        expect(response.body).to include(\"ruby for zombie\")\n+        expect(response.body).to include(\"ruby for zombie 2\")\n+        expect(response.body).to include(\"RoR for one week\")\n+      end\n+\n+      it 'searching by paid' do\n+        get '/courses?paid=1'\n+\n+        expect(response.code).to eq(\"200\")\n+        expect(response.body).not_to include(\"ruby-course for juniors\")\n+        expect(response.body).to include(\"ruby-course for middle developers\")\n+        expect(response.body).to include('ruby-course for middle seniors')\n+        expect(response.body).not_to include('ruby for zombie</a>')\n+        expect(response.body).to include('ruby for zombie 2')\n+        expect(response.body).to include('RoR for one week')\n+      end\n+    end\n+  end\n+\n+  describe 'show course' do\n+    before(:all){\n+      @course = FactoryGirl.create(:course, \n+        title: 'ruby-course for juniors part two',\n+        url: 'http://www.some_site.org/courses/ruby_course_for_juniors',\n+        language: 'Русский',\n+        approved: true,\n+        paid: false        \n+      )\n+\n+      FactoryGirl.create(:comment,\n+        kind: 2,\n+        graduate: true,\n+        rating: 3,\n+        content: 'good course',\n+        course_id: @course.id\n+      )\n+      FactoryGirl.create(:comment,\n+        kind: 2,\n+        graduate: true,\n+        rating: 5,\n+        content: 'perfect course, I need one more',\n+        course_id: @course.id\n+      )\n+      FactoryGirl.create(:comment,\n+        kind: 2,\n+        graduate: true,\n+        content: 'i really like it',\n+        rating: 4,\n+        course_id: @course.id\n+      )\n+    }\n+    \n+    it 'contain course title, url, description and language' do\n+      get \"/courses/#{@course.id}\"\n+      \n+      expect(response.code).to eq(\"200\")\n+      expect(response.body).to include(@course.title)\n+      expect(response.body).to include(@course.url)\n+      expect(response.body).to include(@course.description)\n+      expect(response.body).to include('<dd itemprop=\"inLanguage\">'+@course.language+'</dd>')\n+    end\n+    \n+    it 'show graduates count' do\n+      get \"/courses/#{@course.id}\"\n+\n+      expect(response.code).to eq(\"200\")\n+      expect(response.body).to include('<dt>Количество учеников:</dt><dd>3</dd>')\n+    end\n+    \n+    it 'show rating' do\n+      get \"/courses/#{@course.id}\"\n+\n+      expect(response.code).to eq(\"200\")\n+      expect(response.body).to include('<dt>Средняя оценка:</dt><dd itemprop=\"aggregateRating\">4.0</dd>')\n+    end\n+  end\n+\n+  describe 'create course' do\n+    let(:user){\n+      FactoryGirl.create(:user,\n+        role: 'admin'\n+      )\n+    }\n+    before(:each){\n+      sign_in user\n+    }\n+    it 'create course by admin with valid params' do\n+      post \"/courses\", :course => {","path":"spec/requests/courses_spec.rb","position":169,"original_position":169,"commit_id":"52f6a87a80356b5c04424513accc9a9bc7253f58","original_commit_id":"52f6a87a80356b5c04424513accc9a9bc7253f58","user":{"login":"Freika","id":3738638,"avatar_url":"https://avatars.githubusercontent.com/u/3738638?v=3","gravatar_id":"","url":"https://api.github.com/users/Freika","html_url":"https://github.com/Freika","followers_url":"https://api.github.com/users/Freika/followers","following_url":"https://api.github.com/users/Freika/following{/other_user}","gists_url":"https://api.github.com/users/Freika/gists{/gist_id}","starred_url":"https://api.github.com/users/Freika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Freika/subscriptions","organizations_url":"https://api.github.com/users/Freika/orgs","repos_url":"https://api.github.com/users/Freika/repos","events_url":"https://api.github.com/users/Freika/events{/privacy}","received_events_url":"https://api.github.com/users/Freika/received_events","type":"User","site_admin":false},"body":"Символы без ракет","created_at":"2017-02-06T08:25:13Z","updated_at":"2017-02-06T08:29:07Z","html_url":"https://github.com/Freika/ruby_courses/pull/38#discussion_r99534591","pull_request_url":"https://api.github.com/repos/Freika/ruby_courses/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/Freika/ruby_courses/pulls/comments/99534591"},"html":{"href":"https://github.com/Freika/ruby_courses/pull/38#discussion_r99534591"},"pull_request":{"href":"https://api.github.com/repos/Freika/ruby_courses/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/Freika/ruby_courses/pulls/38","id":104665045,"html_url":"https://github.com/Freika/ruby_courses/pull/38","diff_url":"https://github.com/Freika/ruby_courses/pull/38.diff","patch_url":"https://github.com/Freika/ruby_courses/pull/38.patch","issue_url":"https://api.github.com/repos/Freika/ruby_courses/issues/38","number":38,"state":"open","locked":false,"title":"Integration tests","user":{"login":"kopylovvlad","id":8026710,"avatar_url":"https://avatars.githubusercontent.com/u/8026710?v=3","gravatar_id":"","url":"https://api.github.com/users/kopylovvlad","html_url":"https://github.com/kopylovvlad","followers_url":"https://api.github.com/users/kopylovvlad/followers","following_url":"https://api.github.com/users/kopylovvlad/following{/other_user}","gists_url":"https://api.github.com/users/kopylovvlad/gists{/gist_id}","starred_url":"https://api.github.com/users/kopylovvlad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kopylovvlad/subscriptions","organizations_url":"https://api.github.com/users/kopylovvlad/orgs","repos_url":"https://api.github.com/users/kopylovvlad/repos","events_url":"https://api.github.com/users/kopylovvlad/events{/privacy}","received_events_url":"https://api.github.com/users/kopylovvlad/received_events","type":"User","site_admin":false},"body":"Написал request-тесты","created_at":"2017-02-04T15:49:16Z","updated_at":"2017-02-06T08:29:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cbdfd534fee7b718151bbe842423c3ef580e3faf","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Freika/ruby_courses/pulls/38/commits","review_comments_url":"https://api.github.com/repos/Freika/ruby_courses/pulls/38/comments","review_comment_url":"https://api.github.com/repos/Freika/ruby_courses/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Freika/ruby_courses/issues/38/comments","statuses_url":"https://api.github.com/repos/Freika/ruby_courses/statuses/52f6a87a80356b5c04424513accc9a9bc7253f58","head":{"label":"kopylovvlad:integration_tests","ref":"integration_tests","sha":"52f6a87a80356b5c04424513accc9a9bc7253f58","user":{"login":"kopylovvlad","id":8026710,"avatar_url":"https://avatars.githubusercontent.com/u/8026710?v=3","gravatar_id":"","url":"https://api.github.com/users/kopylovvlad","html_url":"https://github.com/kopylovvlad","followers_url":"https://api.github.com/users/kopylovvlad/followers","following_url":"https://api.github.com/users/kopylovvlad/following{/other_user}","gists_url":"https://api.github.com/users/kopylovvlad/gists{/gist_id}","starred_url":"https://api.github.com/users/kopylovvlad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kopylovvlad/subscriptions","organizations_url":"https://api.github.com/users/kopylovvlad/orgs","repos_url":"https://api.github.com/users/kopylovvlad/repos","events_url":"https://api.github.com/users/kopylovvlad/events{/privacy}","received_events_url":"https://api.github.com/users/kopylovvlad/received_events","type":"User","site_admin":false},"repo":{"id":79671481,"name":"ruby_courses","full_name":"kopylovvlad/ruby_courses","owner":{"login":"kopylovvlad","id":8026710,"avatar_url":"https://avatars.githubusercontent.com/u/8026710?v=3","gravatar_id":"","url":"https://api.github.com/users/kopylovvlad","html_url":"https://github.com/kopylovvlad","followers_url":"https://api.github.com/users/kopylovvlad/followers","following_url":"https://api.github.com/users/kopylovvlad/following{/other_user}","gists_url":"https://api.github.com/users/kopylovvlad/gists{/gist_id}","starred_url":"https://api.github.com/users/kopylovvlad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kopylovvlad/subscriptions","organizations_url":"https://api.github.com/users/kopylovvlad/orgs","repos_url":"https://api.github.com/users/kopylovvlad/repos","events_url":"https://api.github.com/users/kopylovvlad/events{/privacy}","received_events_url":"https://api.github.com/users/kopylovvlad/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kopylovvlad/ruby_courses","description":null,"fork":true,"url":"https://api.github.com/repos/kopylovvlad/ruby_courses","forks_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/forks","keys_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/teams","hooks_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/hooks","issue_events_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/issues/events{/number}","events_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/events","assignees_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/assignees{/user}","branches_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/branches{/branch}","tags_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/tags","blobs_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/git/refs{/sha}","trees_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/statuses/{sha}","languages_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/languages","stargazers_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/stargazers","contributors_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/contributors","subscribers_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/subscribers","subscription_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/subscription","commits_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/commits{/sha}","git_commits_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/git/commits{/sha}","comments_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/comments{/number}","issue_comment_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/issues/comments{/number}","contents_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/contents/{+path}","compare_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/merges","archive_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/downloads","issues_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/issues{/number}","pulls_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/pulls{/number}","milestones_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/milestones{/number}","notifications_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/labels{/name}","releases_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/releases{/id}","deployments_url":"https://api.github.com/repos/kopylovvlad/ruby_courses/deployments","created_at":"2017-01-21T20:39:52Z","updated_at":"2017-01-21T20:39:55Z","pushed_at":"2017-02-04T15:47:36Z","git_url":"git://github.com/kopylovvlad/ruby_courses.git","ssh_url":"git@github.com:kopylovvlad/ruby_courses.git","clone_url":"https://github.com/kopylovvlad/ruby_courses.git","svn_url":"https://github.com/kopylovvlad/ruby_courses","homepage":"http://rubycourses.ru","size":15879,"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":"Freika:master","ref":"master","sha":"36b9620d1b8744504278cea008da01d087404c5e","user":{"login":"Freika","id":3738638,"avatar_url":"https://avatars.githubusercontent.com/u/3738638?v=3","gravatar_id":"","url":"https://api.github.com/users/Freika","html_url":"https://github.com/Freika","followers_url":"https://api.github.com/users/Freika/followers","following_url":"https://api.github.com/users/Freika/following{/other_user}","gists_url":"https://api.github.com/users/Freika/gists{/gist_id}","starred_url":"https://api.github.com/users/Freika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Freika/subscriptions","organizations_url":"https://api.github.com/users/Freika/orgs","repos_url":"https://api.github.com/users/Freika/repos","events_url":"https://api.github.com/users/Freika/events{/privacy}","received_events_url":"https://api.github.com/users/Freika/received_events","type":"User","site_admin":false},"repo":{"id":52619661,"name":"ruby_courses","full_name":"Freika/ruby_courses","owner":{"login":"Freika","id":3738638,"avatar_url":"https://avatars.githubusercontent.com/u/3738638?v=3","gravatar_id":"","url":"https://api.github.com/users/Freika","html_url":"https://github.com/Freika","followers_url":"https://api.github.com/users/Freika/followers","following_url":"https://api.github.com/users/Freika/following{/other_user}","gists_url":"https://api.github.com/users/Freika/gists{/gist_id}","starred_url":"https://api.github.com/users/Freika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Freika/subscriptions","organizations_url":"https://api.github.com/users/Freika/orgs","repos_url":"https://api.github.com/users/Freika/repos","events_url":"https://api.github.com/users/Freika/events{/privacy}","received_events_url":"https://api.github.com/users/Freika/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Freika/ruby_courses","description":null,"fork":false,"url":"https://api.github.com/repos/Freika/ruby_courses","forks_url":"https://api.github.com/repos/Freika/ruby_courses/forks","keys_url":"https://api.github.com/repos/Freika/ruby_courses/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Freika/ruby_courses/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Freika/ruby_courses/teams","hooks_url":"https://api.github.com/repos/Freika/ruby_courses/hooks","issue_events_url":"https://api.github.com/repos/Freika/ruby_courses/issues/events{/number}","events_url":"https://api.github.com/repos/Freika/ruby_courses/events","assignees_url":"https://api.github.com/repos/Freika/ruby_courses/assignees{/user}","branches_url":"https://api.github.com/repos/Freika/ruby_courses/branches{/branch}","tags_url":"https://api.github.com/repos/Freika/ruby_courses/tags","blobs_url":"https://api.github.com/repos/Freika/ruby_courses/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Freika/ruby_courses/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Freika/ruby_courses/git/refs{/sha}","trees_url":"https://api.github.com/repos/Freika/ruby_courses/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Freika/ruby_courses/statuses/{sha}","languages_url":"https://api.github.com/repos/Freika/ruby_courses/languages","stargazers_url":"https://api.github.com/repos/Freika/ruby_courses/stargazers","contributors_url":"https://api.github.com/repos/Freika/ruby_courses/contributors","subscribers_url":"https://api.github.com/repos/Freika/ruby_courses/subscribers","subscription_url":"https://api.github.com/repos/Freika/ruby_courses/subscription","commits_url":"https://api.github.com/repos/Freika/ruby_courses/commits{/sha}","git_commits_url":"https://api.github.com/repos/Freika/ruby_courses/git/commits{/sha}","comments_url":"https://api.github.com/repos/Freika/ruby_courses/comments{/number}","issue_comment_url":"https://api.github.com/repos/Freika/ruby_courses/issues/comments{/number}","contents_url":"https://api.github.com/repos/Freika/ruby_courses/contents/{+path}","compare_url":"https://api.github.com/repos/Freika/ruby_courses/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Freika/ruby_courses/merges","archive_url":"https://api.github.com/repos/Freika/ruby_courses/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Freika/ruby_courses/downloads","issues_url":"https://api.github.com/repos/Freika/ruby_courses/issues{/number}","pulls_url":"https://api.github.com/repos/Freika/ruby_courses/pulls{/number}","milestones_url":"https://api.github.com/repos/Freika/ruby_courses/milestones{/number}","notifications_url":"https://api.github.com/repos/Freika/ruby_courses/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Freika/ruby_courses/labels{/name}","releases_url":"https://api.github.com/repos/Freika/ruby_courses/releases{/id}","deployments_url":"https://api.github.com/repos/Freika/ruby_courses/deployments","created_at":"2016-02-26T17:05:26Z","updated_at":"2016-11-19T13:42:45Z","pushed_at":"2017-02-04T15:49:17Z","git_url":"git://github.com/Freika/ruby_courses.git","ssh_url":"git@github.com:Freika/ruby_courses.git","clone_url":"https://github.com/Freika/ruby_courses.git","svn_url":"https://github.com/Freika/ruby_courses","homepage":"http://rubycourses.ru","size":15874,"stargazers_count":19,"watchers_count":19,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":3,"forks":8,"open_issues":3,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Freika/ruby_courses/pulls/38"},"html":{"href":"https://github.com/Freika/ruby_courses/pull/38"},"issue":{"href":"https://api.github.com/repos/Freika/ruby_courses/issues/38"},"comments":{"href":"https://api.github.com/repos/Freika/ruby_courses/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/Freika/ruby_courses/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/Freika/ruby_courses/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Freika/ruby_courses/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/Freika/ruby_courses/statuses/52f6a87a80356b5c04424513accc9a9bc7253f58"}}}}
{"actor":{"display_login":"Freika"}}