{"action":"created","comment":{"url":"https://api.github.com/repos/mkdevprogects/manager/pulls/comments/134124941","pull_request_review_id":57381008,"id":134124941,"diff_hunk":"@@ -1,54 +1,165 @@\n require 'rails_helper'\n \n RSpec.describe DiseasesController, type: :controller do\n+  render_views\n \n-  describe \"GET #index\" do\n-    it \"returns http success\" do\n-      get :index\n-      expect(response).to have_http_status(:success)\n+  let(:disease) {create(:disease)}\n+\n+  context 'signed in' do\n+    let(:admin) { create(:admin) }\n+\n+    before { sign_in admin }\n+\n+    describe \"GET #index\" do\n+      let!(:disease_1) { create(:disease) }\n+      let!(:disease_2) { create(:disease) }\n+\n+      before { get :index }\n+\n+      it \"returns http success\" do\n+        expect(response).to have_http_status(:success)\n+      end\n+\n+      it \"renders the index template\" do\n+        expect(response).to render_template(\"index\")\n+      end\n+\n+      it \"loads all diseases\" do\n+        expect(assigns(:diseases)).to match_array([disease_1, disease_2])\n+      end\n+\n+      it \"page have diseases title\" do\n+        expect(response.body).to include(\"#{disease_1.title}\",\"#{disease_2.title}\")\n+      end\n     end\n-  end\n \n-  describe \"GET #show\" do\n-    it \"returns http success\" do\n-      get :show\n-      expect(response).to have_http_status(:success)\n+    describe \"GET #show\" do\n+      let(:disease) { create(\n+                          :disease,\n+                          specializations: [create(:specialization)],\n+                          symptoms: [create(:symptom)]\n+      )}\n+\n+      before { get :show, { id: disease.id} }\n+\n+      it \"returns http success\" do\n+        expect(response).to have_http_status(:success)\n+      end\n+\n+      it \"renders the show template\" do\n+        expect(response).to render_template(\"show\")\n+      end\n+\n+      it \"load disease\" do\n+        expect(assigns(:disease)).to eq(disease)\n+      end\n+\n+      it \"page have diseases title\" do\n+        expect(response.body).to include(\"#{disease.title}\")\n+      end\n+\n+      it \"page have diseases description\" do\n+        expect(response.body).to include(\"#{disease.description}\")\n+      end\n+\n+      it \"page have diseases icd_code\" do\n+        expect(response.body).to include(\"#{disease.icd_code}\")\n+      end\n+\n+      it \"page have diseases specializations\" do\n+        expect(response.body).to include(\"#{disease.specializations.first.title}\")\n+      end\n+\n+      it \"page have diseases symptom\" do\n+        expect(response.body).to include(\"#{disease.symptoms.first.title}\")\n+      end\n     end\n-  end\n \n-  describe \"GET #new\" do\n-    it \"returns http success\" do\n-      get :new\n-      expect(response).to have_http_status(:success)\n+    describe \"GET #new\" do\n+      before { get :new }\n+\n+      it \"returns http success\" do\n+        expect(response).to have_http_status(:success)\n+      end\n+\n+      it \"renders the new template\" do\n+        expect(response).to render_template(\"new\")\n+      end\n     end\n-  end\n \n-  describe \"GET #edit\" do\n-    it \"returns http success\" do\n-      get :edit\n-      expect(response).to have_http_status(:success)\n+    describe \"GET #edit\" do\n+      before { get :edit, { id: disease.id} }\n+\n+      it \"returns http success\" do\n+        expect(response).to have_http_status(:success)\n+      end\n+\n+      it \"renders the edit template\" do\n+        expect(response).to render_template(\"edit\")\n+      end\n+\n+      it \"page have diseases title\" do\n+        expect(response.body).to include(\"#{disease.title}\")\n+      end\n+\n+      it \"page have diseases icd_code\" do\n+        expect(response.body).to include(\"#{disease.icd_code}\")\n+      end\n+\n+      it \"page have diseases description\" do\n+        expect(response.body).to include(\"#{disease.description}\")\n+      end\n     end\n-  end\n \n-  describe \"GET #create\" do\n-    it \"returns http success\" do\n-      get :create\n-      expect(response).to have_http_status(:success)\n+    describe \"GET #create\" do\n+      it \"returns http 200\" do\n+        post :create, { disease: {title: disease.title, icd_code: disease.icd_code }}\n+        expect(response).to have_http_status(200)\n+      end\n     end\n-  end\n \n-  describe \"GET #update\" do\n-    it \"returns http success\" do\n-      get :update\n-      expect(response).to have_http_status(:success)\n+    describe \"GET #update\" do\n+      it \"returns http 302\" do\n+        patch :update, { id: disease.id, disease: {title: disease.title, icd_code: disease.icd_code }}\n+        expect(response).to have_http_status(302)\n+      end\n     end\n-  end\n \n-  describe \"GET #destroy\" do\n-    it \"returns http success\" do\n-      get :destroy\n-      expect(response).to have_http_status(:success)\n+    describe \"GET #destroy\" do\n+      it \"returns http 302\" do\n+        delete :destroy, { id: disease.id}\n+        expect(response).to have_http_status(302)","path":"spec/controllers/diseases_controller_spec.rb","position":165,"original_position":165,"commit_id":"e4b50035ac5f37a29684db20c2f55c0dca88ac20","original_commit_id":"e4b50035ac5f37a29684db20c2f55c0dca88ac20","user":{"login":"Mehonoshin","id":525961,"avatar_url":"https://avatars3.githubusercontent.com/u/525961?v=4","gravatar_id":"","url":"https://api.github.com/users/Mehonoshin","html_url":"https://github.com/Mehonoshin","followers_url":"https://api.github.com/users/Mehonoshin/followers","following_url":"https://api.github.com/users/Mehonoshin/following{/other_user}","gists_url":"https://api.github.com/users/Mehonoshin/gists{/gist_id}","starred_url":"https://api.github.com/users/Mehonoshin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mehonoshin/subscriptions","organizations_url":"https://api.github.com/users/Mehonoshin/orgs","repos_url":"https://api.github.com/users/Mehonoshin/repos","events_url":"https://api.github.com/users/Mehonoshin/events{/privacy}","received_events_url":"https://api.github.com/users/Mehonoshin/received_events","type":"User","site_admin":false},"body":"Тут тоже лучше явно указывать куда редиректим","created_at":"2017-08-20T20:01:21Z","updated_at":"2017-08-20T20:02:06Z","html_url":"https://github.com/mkdevprogects/manager/pull/6#discussion_r134124941","pull_request_url":"https://api.github.com/repos/mkdevprogects/manager/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/mkdevprogects/manager/pulls/comments/134124941"},"html":{"href":"https://github.com/mkdevprogects/manager/pull/6#discussion_r134124941"},"pull_request":{"href":"https://api.github.com/repos/mkdevprogects/manager/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/mkdevprogects/manager/pulls/6","id":136647378,"html_url":"https://github.com/mkdevprogects/manager/pull/6","diff_url":"https://github.com/mkdevprogects/manager/pull/6.diff","patch_url":"https://github.com/mkdevprogects/manager/pull/6.patch","issue_url":"https://api.github.com/repos/mkdevprogects/manager/issues/6","number":6,"state":"open","locked":false,"title":"Tests","user":{"login":"ToshiDono","id":12114621,"avatar_url":"https://avatars0.githubusercontent.com/u/12114621?v=4","gravatar_id":"","url":"https://api.github.com/users/ToshiDono","html_url":"https://github.com/ToshiDono","followers_url":"https://api.github.com/users/ToshiDono/followers","following_url":"https://api.github.com/users/ToshiDono/following{/other_user}","gists_url":"https://api.github.com/users/ToshiDono/gists{/gist_id}","starred_url":"https://api.github.com/users/ToshiDono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ToshiDono/subscriptions","organizations_url":"https://api.github.com/users/ToshiDono/orgs","repos_url":"https://api.github.com/users/ToshiDono/repos","events_url":"https://api.github.com/users/ToshiDono/events{/privacy}","received_events_url":"https://api.github.com/users/ToshiDono/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-08-20T15:26:35Z","updated_at":"2017-08-20T20:02:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f562b5eefed6ede313c801cd3473a1a135149ad6","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/mkdevprogects/manager/pulls/6/commits","review_comments_url":"https://api.github.com/repos/mkdevprogects/manager/pulls/6/comments","review_comment_url":"https://api.github.com/repos/mkdevprogects/manager/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mkdevprogects/manager/issues/6/comments","statuses_url":"https://api.github.com/repos/mkdevprogects/manager/statuses/e4b50035ac5f37a29684db20c2f55c0dca88ac20","head":{"label":"mkdevprogects:tests","ref":"tests","sha":"e4b50035ac5f37a29684db20c2f55c0dca88ac20","user":{"login":"mkdevprogects","id":30317963,"avatar_url":"https://avatars3.githubusercontent.com/u/30317963?v=4","gravatar_id":"","url":"https://api.github.com/users/mkdevprogects","html_url":"https://github.com/mkdevprogects","followers_url":"https://api.github.com/users/mkdevprogects/followers","following_url":"https://api.github.com/users/mkdevprogects/following{/other_user}","gists_url":"https://api.github.com/users/mkdevprogects/gists{/gist_id}","starred_url":"https://api.github.com/users/mkdevprogects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkdevprogects/subscriptions","organizations_url":"https://api.github.com/users/mkdevprogects/orgs","repos_url":"https://api.github.com/users/mkdevprogects/repos","events_url":"https://api.github.com/users/mkdevprogects/events{/privacy}","received_events_url":"https://api.github.com/users/mkdevprogects/received_events","type":"Organization","site_admin":false},"repo":{"id":100249939,"name":"manager","full_name":"mkdevprogects/manager","owner":{"login":"mkdevprogects","id":30317963,"avatar_url":"https://avatars3.githubusercontent.com/u/30317963?v=4","gravatar_id":"","url":"https://api.github.com/users/mkdevprogects","html_url":"https://github.com/mkdevprogects","followers_url":"https://api.github.com/users/mkdevprogects/followers","following_url":"https://api.github.com/users/mkdevprogects/following{/other_user}","gists_url":"https://api.github.com/users/mkdevprogects/gists{/gist_id}","starred_url":"https://api.github.com/users/mkdevprogects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkdevprogects/subscriptions","organizations_url":"https://api.github.com/users/mkdevprogects/orgs","repos_url":"https://api.github.com/users/mkdevprogects/repos","events_url":"https://api.github.com/users/mkdevprogects/events{/privacy}","received_events_url":"https://api.github.com/users/mkdevprogects/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mkdevprogects/manager","description":"Application - the administrator panel for managing entities - dictionaries and users.","fork":false,"url":"https://api.github.com/repos/mkdevprogects/manager","forks_url":"https://api.github.com/repos/mkdevprogects/manager/forks","keys_url":"https://api.github.com/repos/mkdevprogects/manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mkdevprogects/manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mkdevprogects/manager/teams","hooks_url":"https://api.github.com/repos/mkdevprogects/manager/hooks","issue_events_url":"https://api.github.com/repos/mkdevprogects/manager/issues/events{/number}","events_url":"https://api.github.com/repos/mkdevprogects/manager/events","assignees_url":"https://api.github.com/repos/mkdevprogects/manager/assignees{/user}","branches_url":"https://api.github.com/repos/mkdevprogects/manager/branches{/branch}","tags_url":"https://api.github.com/repos/mkdevprogects/manager/tags","blobs_url":"https://api.github.com/repos/mkdevprogects/manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mkdevprogects/manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mkdevprogects/manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/mkdevprogects/manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mkdevprogects/manager/statuses/{sha}","languages_url":"https://api.github.com/repos/mkdevprogects/manager/languages","stargazers_url":"https://api.github.com/repos/mkdevprogects/manager/stargazers","contributors_url":"https://api.github.com/repos/mkdevprogects/manager/contributors","subscribers_url":"https://api.github.com/repos/mkdevprogects/manager/subscribers","subscription_url":"https://api.github.com/repos/mkdevprogects/manager/subscription","commits_url":"https://api.github.com/repos/mkdevprogects/manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/mkdevprogects/manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/mkdevprogects/manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/mkdevprogects/manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/mkdevprogects/manager/contents/{+path}","compare_url":"https://api.github.com/repos/mkdevprogects/manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mkdevprogects/manager/merges","archive_url":"https://api.github.com/repos/mkdevprogects/manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mkdevprogects/manager/downloads","issues_url":"https://api.github.com/repos/mkdevprogects/manager/issues{/number}","pulls_url":"https://api.github.com/repos/mkdevprogects/manager/pulls{/number}","milestones_url":"https://api.github.com/repos/mkdevprogects/manager/milestones{/number}","notifications_url":"https://api.github.com/repos/mkdevprogects/manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mkdevprogects/manager/labels{/name}","releases_url":"https://api.github.com/repos/mkdevprogects/manager/releases{/id}","deployments_url":"https://api.github.com/repos/mkdevprogects/manager/deployments","created_at":"2017-08-14T09:20:08Z","updated_at":"2017-08-14T09:40:34Z","pushed_at":"2017-08-20T19:47:14Z","git_url":"git://github.com/mkdevprogects/manager.git","ssh_url":"git@github.com:mkdevprogects/manager.git","clone_url":"https://github.com/mkdevprogects/manager.git","svn_url":"https://github.com/mkdevprogects/manager","homepage":null,"size":99,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"mkdevprogects:master","ref":"master","sha":"801a6bde4170417854b3280dfa1514d6d6f3aa62","user":{"login":"mkdevprogects","id":30317963,"avatar_url":"https://avatars3.githubusercontent.com/u/30317963?v=4","gravatar_id":"","url":"https://api.github.com/users/mkdevprogects","html_url":"https://github.com/mkdevprogects","followers_url":"https://api.github.com/users/mkdevprogects/followers","following_url":"https://api.github.com/users/mkdevprogects/following{/other_user}","gists_url":"https://api.github.com/users/mkdevprogects/gists{/gist_id}","starred_url":"https://api.github.com/users/mkdevprogects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkdevprogects/subscriptions","organizations_url":"https://api.github.com/users/mkdevprogects/orgs","repos_url":"https://api.github.com/users/mkdevprogects/repos","events_url":"https://api.github.com/users/mkdevprogects/events{/privacy}","received_events_url":"https://api.github.com/users/mkdevprogects/received_events","type":"Organization","site_admin":false},"repo":{"id":100249939,"name":"manager","full_name":"mkdevprogects/manager","owner":{"login":"mkdevprogects","id":30317963,"avatar_url":"https://avatars3.githubusercontent.com/u/30317963?v=4","gravatar_id":"","url":"https://api.github.com/users/mkdevprogects","html_url":"https://github.com/mkdevprogects","followers_url":"https://api.github.com/users/mkdevprogects/followers","following_url":"https://api.github.com/users/mkdevprogects/following{/other_user}","gists_url":"https://api.github.com/users/mkdevprogects/gists{/gist_id}","starred_url":"https://api.github.com/users/mkdevprogects/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkdevprogects/subscriptions","organizations_url":"https://api.github.com/users/mkdevprogects/orgs","repos_url":"https://api.github.com/users/mkdevprogects/repos","events_url":"https://api.github.com/users/mkdevprogects/events{/privacy}","received_events_url":"https://api.github.com/users/mkdevprogects/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mkdevprogects/manager","description":"Application - the administrator panel for managing entities - dictionaries and users.","fork":false,"url":"https://api.github.com/repos/mkdevprogects/manager","forks_url":"https://api.github.com/repos/mkdevprogects/manager/forks","keys_url":"https://api.github.com/repos/mkdevprogects/manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mkdevprogects/manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mkdevprogects/manager/teams","hooks_url":"https://api.github.com/repos/mkdevprogects/manager/hooks","issue_events_url":"https://api.github.com/repos/mkdevprogects/manager/issues/events{/number}","events_url":"https://api.github.com/repos/mkdevprogects/manager/events","assignees_url":"https://api.github.com/repos/mkdevprogects/manager/assignees{/user}","branches_url":"https://api.github.com/repos/mkdevprogects/manager/branches{/branch}","tags_url":"https://api.github.com/repos/mkdevprogects/manager/tags","blobs_url":"https://api.github.com/repos/mkdevprogects/manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mkdevprogects/manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mkdevprogects/manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/mkdevprogects/manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mkdevprogects/manager/statuses/{sha}","languages_url":"https://api.github.com/repos/mkdevprogects/manager/languages","stargazers_url":"https://api.github.com/repos/mkdevprogects/manager/stargazers","contributors_url":"https://api.github.com/repos/mkdevprogects/manager/contributors","subscribers_url":"https://api.github.com/repos/mkdevprogects/manager/subscribers","subscription_url":"https://api.github.com/repos/mkdevprogects/manager/subscription","commits_url":"https://api.github.com/repos/mkdevprogects/manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/mkdevprogects/manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/mkdevprogects/manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/mkdevprogects/manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/mkdevprogects/manager/contents/{+path}","compare_url":"https://api.github.com/repos/mkdevprogects/manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mkdevprogects/manager/merges","archive_url":"https://api.github.com/repos/mkdevprogects/manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mkdevprogects/manager/downloads","issues_url":"https://api.github.com/repos/mkdevprogects/manager/issues{/number}","pulls_url":"https://api.github.com/repos/mkdevprogects/manager/pulls{/number}","milestones_url":"https://api.github.com/repos/mkdevprogects/manager/milestones{/number}","notifications_url":"https://api.github.com/repos/mkdevprogects/manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mkdevprogects/manager/labels{/name}","releases_url":"https://api.github.com/repos/mkdevprogects/manager/releases{/id}","deployments_url":"https://api.github.com/repos/mkdevprogects/manager/deployments","created_at":"2017-08-14T09:20:08Z","updated_at":"2017-08-14T09:40:34Z","pushed_at":"2017-08-20T19:47:14Z","git_url":"git://github.com/mkdevprogects/manager.git","ssh_url":"git@github.com:mkdevprogects/manager.git","clone_url":"https://github.com/mkdevprogects/manager.git","svn_url":"https://github.com/mkdevprogects/manager","homepage":null,"size":99,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mkdevprogects/manager/pulls/6"},"html":{"href":"https://github.com/mkdevprogects/manager/pull/6"},"issue":{"href":"https://api.github.com/repos/mkdevprogects/manager/issues/6"},"comments":{"href":"https://api.github.com/repos/mkdevprogects/manager/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/mkdevprogects/manager/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/mkdevprogects/manager/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mkdevprogects/manager/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/mkdevprogects/manager/statuses/e4b50035ac5f37a29684db20c2f55c0dca88ac20"}}}}
{"actor":{"display_login":"Mehonoshin"}}