{"action":"created","comment":{"url":"https://api.github.com/repos/bronislav/surnames_navigator/pulls/comments/34687535","id":34687535,"diff_hunk":"@@ -1,8 +1,101 @@\n require 'rails_helper'\n \n RSpec.describe Region, type: :model do\n-  it { is_expected.to have_db_column(:name) }\n-  it { is_expected.to validate_presence_of(:name) }\n+  let(:region) { Region.new(attributes) }\n+  let(:region_create) { Region.create (attributes) }\n+  \n+  describe \"validations\" do\n+    context \"on create\" do\n \n-  it { is_expected.to have_many(:researches).dependent(:destroy) }\n+      before { region.valid? }\n+\n+      context \"when neither #path nor #name are set\" do\n+        let(:attributes) { {} }\n+        it \"should be invalid\" do\n+          expect(region.errors.messages.keys).to eq([:name, :path])\n+        end\n+      end\n+\n+      context \"when #path to be set if #name is blank\" do\n+        let(:attributes) { { path: \"Moskow\" } }\n+        it \"should be valid\" do\n+          expect(region.errors[:path]).to be_empty\n+        end\n+      end\n+\n+      context \"when #name to be set if #path is blank\" do\n+        let(:attributes) { { name: \"Moskow\" } }\n+        it \"should be valid\" do\n+          expect(region.errors[:name]).to be_empty\n+        end\n+      end\n+    end\n+\n+    context \"on update\" do\n+      before do\n+        region_create.assign_attributes( invalid_attributes )\n+        region_create.valid?\n+      end\n+\n+      context \"when #name to be set if #path is blank\" do\n+        let(:attributes) { { name: \"Moskow\" } }\n+        let(:invalid_attributes) { { name: \"\" } }\n+        it \"should be invalid\" do\n+          expect(region_create.errors[:name]).to include(\"can't be blank\")\n+        end\n+      end\n+\n+      context \"when #name to be set if #path is not blank\" do\n+        let(:attributes) { { name: \"Moskow\"} }\n+        let(:invalid_attributes) { { name: \"\", path: \"Moskow\" } }\n+        it \"should be invalid\" do\n+          expect(region_create.errors[:name]).to include(\"can't be blank\")\n+        end\n+      end\n+    end\n+  end\n+\n+  context \"when update\" do\n+    before { region_create.update(valid_attrbutes) }\n+\n+    context \"ignore #path value\" do\n+      let(:attributes) { { name: \"Donetsk\"} }","path":"spec/models/region_spec.rb","position":65,"original_position":65,"commit_id":"3b124fb694c51372949068c01219b157481dd885","original_commit_id":"3b124fb694c51372949068c01219b157481dd885","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":"Space inside } missing.","created_at":"2015-07-15T15:02:33Z","updated_at":"2015-07-15T15:02:33Z","html_url":"https://github.com/bronislav/surnames_navigator/pull/56#discussion_r34687535","pull_request_url":"https://api.github.com/repos/bronislav/surnames_navigator/pulls/56","_links":{"self":{"href":"https://api.github.com/repos/bronislav/surnames_navigator/pulls/comments/34687535"},"html":{"href":"https://github.com/bronislav/surnames_navigator/pull/56#discussion_r34687535"},"pull_request":{"href":"https://api.github.com/repos/bronislav/surnames_navigator/pulls/56"}}},"pull_request":{"url":"https://api.github.com/repos/bronislav/surnames_navigator/pulls/56","id":39892590,"html_url":"https://github.com/bronislav/surnames_navigator/pull/56","diff_url":"https://github.com/bronislav/surnames_navigator/pull/56.diff","patch_url":"https://github.com/bronislav/surnames_navigator/pull/56.patch","issue_url":"https://api.github.com/repos/bronislav/surnames_navigator/issues/56","number":56,"state":"open","locked":false,"title":"Add ability to create researches","user":{"login":"bronislav","id":125880,"avatar_url":"https://avatars.githubusercontent.com/u/125880?v=3","gravatar_id":"","url":"https://api.github.com/users/bronislav","html_url":"https://github.com/bronislav","followers_url":"https://api.github.com/users/bronislav/followers","following_url":"https://api.github.com/users/bronislav/following{/other_user}","gists_url":"https://api.github.com/users/bronislav/gists{/gist_id}","starred_url":"https://api.github.com/users/bronislav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bronislav/subscriptions","organizations_url":"https://api.github.com/users/bronislav/orgs","repos_url":"https://api.github.com/users/bronislav/repos","events_url":"https://api.github.com/users/bronislav/events{/privacy}","received_events_url":"https://api.github.com/users/bronislav/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-14T08:27:48Z","updated_at":"2015-07-15T15:02:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"802095862a2ace17e26b7b1b6e2da42f363c2cce","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bronislav/surnames_navigator/pulls/56/commits","review_comments_url":"https://api.github.com/repos/bronislav/surnames_navigator/pulls/56/comments","review_comment_url":"https://api.github.com/repos/bronislav/surnames_navigator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bronislav/surnames_navigator/issues/56/comments","statuses_url":"https://api.github.com/repos/bronislav/surnames_navigator/statuses/3b124fb694c51372949068c01219b157481dd885","head":{"label":"bronislav:ai-add-ability-to-create-researches","ref":"ai-add-ability-to-create-researches","sha":"3b124fb694c51372949068c01219b157481dd885","user":{"login":"bronislav","id":125880,"avatar_url":"https://avatars.githubusercontent.com/u/125880?v=3","gravatar_id":"","url":"https://api.github.com/users/bronislav","html_url":"https://github.com/bronislav","followers_url":"https://api.github.com/users/bronislav/followers","following_url":"https://api.github.com/users/bronislav/following{/other_user}","gists_url":"https://api.github.com/users/bronislav/gists{/gist_id}","starred_url":"https://api.github.com/users/bronislav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bronislav/subscriptions","organizations_url":"https://api.github.com/users/bronislav/orgs","repos_url":"https://api.github.com/users/bronislav/repos","events_url":"https://api.github.com/users/bronislav/events{/privacy}","received_events_url":"https://api.github.com/users/bronislav/received_events","type":"User","site_admin":false},"repo":{"id":33669092,"name":"surnames_navigator","full_name":"bronislav/surnames_navigator","owner":{"login":"bronislav","id":125880,"avatar_url":"https://avatars.githubusercontent.com/u/125880?v=3","gravatar_id":"","url":"https://api.github.com/users/bronislav","html_url":"https://github.com/bronislav","followers_url":"https://api.github.com/users/bronislav/followers","following_url":"https://api.github.com/users/bronislav/following{/other_user}","gists_url":"https://api.github.com/users/bronislav/gists{/gist_id}","starred_url":"https://api.github.com/users/bronislav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bronislav/subscriptions","organizations_url":"https://api.github.com/users/bronislav/orgs","repos_url":"https://api.github.com/users/bronislav/repos","events_url":"https://api.github.com/users/bronislav/events{/privacy}","received_events_url":"https://api.github.com/users/bronislav/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bronislav/surnames_navigator","description":"Revamp of http://wiki.svrt.ru/","fork":false,"url":"https://api.github.com/repos/bronislav/surnames_navigator","forks_url":"https://api.github.com/repos/bronislav/surnames_navigator/forks","keys_url":"https://api.github.com/repos/bronislav/surnames_navigator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bronislav/surnames_navigator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bronislav/surnames_navigator/teams","hooks_url":"https://api.github.com/repos/bronislav/surnames_navigator/hooks","issue_events_url":"https://api.github.com/repos/bronislav/surnames_navigator/issues/events{/number}","events_url":"https://api.github.com/repos/bronislav/surnames_navigator/events","assignees_url":"https://api.github.com/repos/bronislav/surnames_navigator/assignees{/user}","branches_url":"https://api.github.com/repos/bronislav/surnames_navigator/branches{/branch}","tags_url":"https://api.github.com/repos/bronislav/surnames_navigator/tags","blobs_url":"https://api.github.com/repos/bronislav/surnames_navigator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bronislav/surnames_navigator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bronislav/surnames_navigator/git/refs{/sha}","trees_url":"https://api.github.com/repos/bronislav/surnames_navigator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bronislav/surnames_navigator/statuses/{sha}","languages_url":"https://api.github.com/repos/bronislav/surnames_navigator/languages","stargazers_url":"https://api.github.com/repos/bronislav/surnames_navigator/stargazers","contributors_url":"https://api.github.com/repos/bronislav/surnames_navigator/contributors","subscribers_url":"https://api.github.com/repos/bronislav/surnames_navigator/subscribers","subscription_url":"https://api.github.com/repos/bronislav/surnames_navigator/subscription","commits_url":"https://api.github.com/repos/bronislav/surnames_navigator/commits{/sha}","git_commits_url":"https://api.github.com/repos/bronislav/surnames_navigator/git/commits{/sha}","comments_url":"https://api.github.com/repos/bronislav/surnames_navigator/comments{/number}","issue_comment_url":"https://api.github.com/repos/bronislav/surnames_navigator/issues/comments{/number}","contents_url":"https://api.github.com/repos/bronislav/surnames_navigator/contents/{+path}","compare_url":"https://api.github.com/repos/bronislav/surnames_navigator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bronislav/surnames_navigator/merges","archive_url":"https://api.github.com/repos/bronislav/surnames_navigator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bronislav/surnames_navigator/downloads","issues_url":"https://api.github.com/repos/bronislav/surnames_navigator/issues{/number}","pulls_url":"https://api.github.com/repos/bronislav/surnames_navigator/pulls{/number}","milestones_url":"https://api.github.com/repos/bronislav/surnames_navigator/milestones{/number}","notifications_url":"https://api.github.com/repos/bronislav/surnames_navigator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bronislav/surnames_navigator/labels{/name}","releases_url":"https://api.github.com/repos/bronislav/surnames_navigator/releases{/id}","created_at":"2015-04-09T13:03:24Z","updated_at":"2015-05-07T19:43:38Z","pushed_at":"2015-07-15T15:02:20Z","git_url":"git://github.com/bronislav/surnames_navigator.git","ssh_url":"git@github.com:bronislav/surnames_navigator.git","clone_url":"https://github.com/bronislav/surnames_navigator.git","svn_url":"https://github.com/bronislav/surnames_navigator","homepage":"https://boiling-inlet-5599.herokuapp.com/","size":811,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"bronislav:master","ref":"master","sha":"f72119e20bade425e00c8fc6245ff244259a76b9","user":{"login":"bronislav","id":125880,"avatar_url":"https://avatars.githubusercontent.com/u/125880?v=3","gravatar_id":"","url":"https://api.github.com/users/bronislav","html_url":"https://github.com/bronislav","followers_url":"https://api.github.com/users/bronislav/followers","following_url":"https://api.github.com/users/bronislav/following{/other_user}","gists_url":"https://api.github.com/users/bronislav/gists{/gist_id}","starred_url":"https://api.github.com/users/bronislav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bronislav/subscriptions","organizations_url":"https://api.github.com/users/bronislav/orgs","repos_url":"https://api.github.com/users/bronislav/repos","events_url":"https://api.github.com/users/bronislav/events{/privacy}","received_events_url":"https://api.github.com/users/bronislav/received_events","type":"User","site_admin":false},"repo":{"id":33669092,"name":"surnames_navigator","full_name":"bronislav/surnames_navigator","owner":{"login":"bronislav","id":125880,"avatar_url":"https://avatars.githubusercontent.com/u/125880?v=3","gravatar_id":"","url":"https://api.github.com/users/bronislav","html_url":"https://github.com/bronislav","followers_url":"https://api.github.com/users/bronislav/followers","following_url":"https://api.github.com/users/bronislav/following{/other_user}","gists_url":"https://api.github.com/users/bronislav/gists{/gist_id}","starred_url":"https://api.github.com/users/bronislav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bronislav/subscriptions","organizations_url":"https://api.github.com/users/bronislav/orgs","repos_url":"https://api.github.com/users/bronislav/repos","events_url":"https://api.github.com/users/bronislav/events{/privacy}","received_events_url":"https://api.github.com/users/bronislav/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bronislav/surnames_navigator","description":"Revamp of http://wiki.svrt.ru/","fork":false,"url":"https://api.github.com/repos/bronislav/surnames_navigator","forks_url":"https://api.github.com/repos/bronislav/surnames_navigator/forks","keys_url":"https://api.github.com/repos/bronislav/surnames_navigator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bronislav/surnames_navigator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bronislav/surnames_navigator/teams","hooks_url":"https://api.github.com/repos/bronislav/surnames_navigator/hooks","issue_events_url":"https://api.github.com/repos/bronislav/surnames_navigator/issues/events{/number}","events_url":"https://api.github.com/repos/bronislav/surnames_navigator/events","assignees_url":"https://api.github.com/repos/bronislav/surnames_navigator/assignees{/user}","branches_url":"https://api.github.com/repos/bronislav/surnames_navigator/branches{/branch}","tags_url":"https://api.github.com/repos/bronislav/surnames_navigator/tags","blobs_url":"https://api.github.com/repos/bronislav/surnames_navigator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bronislav/surnames_navigator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bronislav/surnames_navigator/git/refs{/sha}","trees_url":"https://api.github.com/repos/bronislav/surnames_navigator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bronislav/surnames_navigator/statuses/{sha}","languages_url":"https://api.github.com/repos/bronislav/surnames_navigator/languages","stargazers_url":"https://api.github.com/repos/bronislav/surnames_navigator/stargazers","contributors_url":"https://api.github.com/repos/bronislav/surnames_navigator/contributors","subscribers_url":"https://api.github.com/repos/bronislav/surnames_navigator/subscribers","subscription_url":"https://api.github.com/repos/bronislav/surnames_navigator/subscription","commits_url":"https://api.github.com/repos/bronislav/surnames_navigator/commits{/sha}","git_commits_url":"https://api.github.com/repos/bronislav/surnames_navigator/git/commits{/sha}","comments_url":"https://api.github.com/repos/bronislav/surnames_navigator/comments{/number}","issue_comment_url":"https://api.github.com/repos/bronislav/surnames_navigator/issues/comments{/number}","contents_url":"https://api.github.com/repos/bronislav/surnames_navigator/contents/{+path}","compare_url":"https://api.github.com/repos/bronislav/surnames_navigator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bronislav/surnames_navigator/merges","archive_url":"https://api.github.com/repos/bronislav/surnames_navigator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bronislav/surnames_navigator/downloads","issues_url":"https://api.github.com/repos/bronislav/surnames_navigator/issues{/number}","pulls_url":"https://api.github.com/repos/bronislav/surnames_navigator/pulls{/number}","milestones_url":"https://api.github.com/repos/bronislav/surnames_navigator/milestones{/number}","notifications_url":"https://api.github.com/repos/bronislav/surnames_navigator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bronislav/surnames_navigator/labels{/name}","releases_url":"https://api.github.com/repos/bronislav/surnames_navigator/releases{/id}","created_at":"2015-04-09T13:03:24Z","updated_at":"2015-05-07T19:43:38Z","pushed_at":"2015-07-15T15:02:20Z","git_url":"git://github.com/bronislav/surnames_navigator.git","ssh_url":"git@github.com:bronislav/surnames_navigator.git","clone_url":"https://github.com/bronislav/surnames_navigator.git","svn_url":"https://github.com/bronislav/surnames_navigator","homepage":"https://boiling-inlet-5599.herokuapp.com/","size":811,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bronislav/surnames_navigator/pulls/56"},"html":{"href":"https://github.com/bronislav/surnames_navigator/pull/56"},"issue":{"href":"https://api.github.com/repos/bronislav/surnames_navigator/issues/56"},"comments":{"href":"https://api.github.com/repos/bronislav/surnames_navigator/issues/56/comments"},"review_comments":{"href":"https://api.github.com/repos/bronislav/surnames_navigator/pulls/56/comments"},"review_comment":{"href":"https://api.github.com/repos/bronislav/surnames_navigator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bronislav/surnames_navigator/pulls/56/commits"},"statuses":{"href":"https://api.github.com/repos/bronislav/surnames_navigator/statuses/3b124fb694c51372949068c01219b157481dd885"}}}}