{"action":"created","comment":{"url":"https://api.github.com/repos/krutman/flashcards/pulls/comments/39346593","id":39346593,"diff_hunk":"@@ -0,0 +1,113 @@\n+require 'rails_helper'\n+\n+RSpec.describe Card, type: :model do\n+  \n+  before { @card = Card.new(:original_text => \"кот\", :translated_text => \"cat\") }\n+  subject { @card }\n+  \n+  it { should respond_to(:original_text) }\n+  it { should respond_to(:translated_text) }\n+  it { should respond_to(:review_date) }\n+  it { should respond_to(:check_translation) }\n+  it { should be_valid }\n+  \n+  it \"has none to begin with\" do\n+    expect(Card.count).to eq 0\n+  end\n+  \n+  it \"has one after adding one\" do\n+    @card.save!\n+    expect(Card.count).to eq 1\n+  end\n+  \n+  it \"not be valid when original_text is not present\" do\n+    @card.original_text = nil\n+    should_not be_valid\n+  end\n+  \n+  it \"not be valid when original_text is too long\" do\n+    @card.original_text = \"a\" * 101\n+    should_not be_valid\n+  end\n+  \n+  it \"not be valid when translated_text is not present\" do\n+    @card.translated_text = nil\n+    should_not be_valid\n+  end\n+  \n+  it \"not be valid when translated_text is too long\" do\n+    @card.translated_text = \"a\" * 151\n+    should_not be_valid\n+  end\n+  \n+  it \"has review_date\" do\n+    @card.review_date = Date.today - 2.days\n+    expect(@card.review_date).to eq Date.today - 2.days\n+  end\n+  \n+  it \"has default review_date on create\" do\n+    @card.save!\n+    expect(@card.review_date).to eq Date.today + 3.days\n+  end\n+  \n+  describe \"when translated_text and original_text\" do\n+    before { @card.original_text = \"cat\" }\n+    \n+    describe \"has a strict equal\" do\n+      before { @card.translated_text = \"cat\" }\n+      it { should_not be_valid }\n+    end\n+    \n+    describe \"has a not strict equal\" do\n+      before { @card.translated_text = \" CaT \" }\n+      it { should_not be_valid }\n+    end\n+  end\n+  \n+  describe \"scopes presence and\" do\n+    before do\n+      @card1 = Card.create!(:original_text => \"собака\", :translated_text => \"dog\", :review_date => Date.today - 2.days)\n+      @card2 = Card.create!(:original_text => \"птица\", :translated_text => \"bird\", :review_date => Date.today + 2.days)\n+    end\n+  \n+    it \"has default desc scope\" do\n+      expect(Card.all.reload).to eq([@card2, @card1])\n+    end\n+  \n+    it \"has for_review scope\" do\n+      expect(Card.for_review.reload).to eq([@card1])\n+    end\n+    ","path":"spec/models/card_spec.rb","position":80,"original_position":80,"commit_id":"3b1b936b896046e57a92036653d396a60434618b","original_commit_id":"3b1b936b896046e57a92036653d396a60434618b","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":"Trailing whitespace detected.","created_at":"2015-09-13T10:57:40Z","updated_at":"2015-09-13T10:57:40Z","html_url":"https://github.com/krutman/flashcards/pull/7#discussion_r39346593","pull_request_url":"https://api.github.com/repos/krutman/flashcards/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/krutman/flashcards/pulls/comments/39346593"},"html":{"href":"https://github.com/krutman/flashcards/pull/7#discussion_r39346593"},"pull_request":{"href":"https://api.github.com/repos/krutman/flashcards/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/krutman/flashcards/pulls/7","id":44870906,"html_url":"https://github.com/krutman/flashcards/pull/7","diff_url":"https://github.com/krutman/flashcards/pull/7.diff","patch_url":"https://github.com/krutman/flashcards/pull/7.patch","issue_url":"https://api.github.com/repos/krutman/flashcards/issues/7","number":7,"state":"open","locked":false,"title":"Add first tests","user":{"login":"krutman","id":8046696,"avatar_url":"https://avatars.githubusercontent.com/u/8046696?v=3","gravatar_id":"","url":"https://api.github.com/users/krutman","html_url":"https://github.com/krutman","followers_url":"https://api.github.com/users/krutman/followers","following_url":"https://api.github.com/users/krutman/following{/other_user}","gists_url":"https://api.github.com/users/krutman/gists{/gist_id}","starred_url":"https://api.github.com/users/krutman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krutman/subscriptions","organizations_url":"https://api.github.com/users/krutman/orgs","repos_url":"https://api.github.com/users/krutman/repos","events_url":"https://api.github.com/users/krutman/events{/privacy}","received_events_url":"https://api.github.com/users/krutman/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-13T10:57:33Z","updated_at":"2015-09-13T10:57:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b6271f3b70bb17e3c11592fa677c0fbe0a06a780","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/krutman/flashcards/pulls/7/commits","review_comments_url":"https://api.github.com/repos/krutman/flashcards/pulls/7/comments","review_comment_url":"https://api.github.com/repos/krutman/flashcards/pulls/comments{/number}","comments_url":"https://api.github.com/repos/krutman/flashcards/issues/7/comments","statuses_url":"https://api.github.com/repos/krutman/flashcards/statuses/3b1b936b896046e57a92036653d396a60434618b","head":{"label":"krutman:task-6","ref":"task-6","sha":"3b1b936b896046e57a92036653d396a60434618b","user":{"login":"krutman","id":8046696,"avatar_url":"https://avatars.githubusercontent.com/u/8046696?v=3","gravatar_id":"","url":"https://api.github.com/users/krutman","html_url":"https://github.com/krutman","followers_url":"https://api.github.com/users/krutman/followers","following_url":"https://api.github.com/users/krutman/following{/other_user}","gists_url":"https://api.github.com/users/krutman/gists{/gist_id}","starred_url":"https://api.github.com/users/krutman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krutman/subscriptions","organizations_url":"https://api.github.com/users/krutman/orgs","repos_url":"https://api.github.com/users/krutman/repos","events_url":"https://api.github.com/users/krutman/events{/privacy}","received_events_url":"https://api.github.com/users/krutman/received_events","type":"User","site_admin":false},"repo":{"id":40921031,"name":"flashcards","full_name":"krutman/flashcards","owner":{"login":"krutman","id":8046696,"avatar_url":"https://avatars.githubusercontent.com/u/8046696?v=3","gravatar_id":"","url":"https://api.github.com/users/krutman","html_url":"https://github.com/krutman","followers_url":"https://api.github.com/users/krutman/followers","following_url":"https://api.github.com/users/krutman/following{/other_user}","gists_url":"https://api.github.com/users/krutman/gists{/gist_id}","starred_url":"https://api.github.com/users/krutman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krutman/subscriptions","organizations_url":"https://api.github.com/users/krutman/orgs","repos_url":"https://api.github.com/users/krutman/repos","events_url":"https://api.github.com/users/krutman/events{/privacy}","received_events_url":"https://api.github.com/users/krutman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/krutman/flashcards","description":"","fork":false,"url":"https://api.github.com/repos/krutman/flashcards","forks_url":"https://api.github.com/repos/krutman/flashcards/forks","keys_url":"https://api.github.com/repos/krutman/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/krutman/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/krutman/flashcards/teams","hooks_url":"https://api.github.com/repos/krutman/flashcards/hooks","issue_events_url":"https://api.github.com/repos/krutman/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/krutman/flashcards/events","assignees_url":"https://api.github.com/repos/krutman/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/krutman/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/krutman/flashcards/tags","blobs_url":"https://api.github.com/repos/krutman/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/krutman/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/krutman/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/krutman/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/krutman/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/krutman/flashcards/languages","stargazers_url":"https://api.github.com/repos/krutman/flashcards/stargazers","contributors_url":"https://api.github.com/repos/krutman/flashcards/contributors","subscribers_url":"https://api.github.com/repos/krutman/flashcards/subscribers","subscription_url":"https://api.github.com/repos/krutman/flashcards/subscription","commits_url":"https://api.github.com/repos/krutman/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/krutman/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/krutman/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/krutman/flashcards/issues/comments{/number}","contents_url":"https://api.github.com/repos/krutman/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/krutman/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/krutman/flashcards/merges","archive_url":"https://api.github.com/repos/krutman/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/krutman/flashcards/downloads","issues_url":"https://api.github.com/repos/krutman/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/krutman/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/krutman/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/krutman/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/krutman/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/krutman/flashcards/releases{/id}","created_at":"2015-08-17T19:05:54Z","updated_at":"2015-08-17T19:26:12Z","pushed_at":"2015-09-13T10:57:33Z","git_url":"git://github.com/krutman/flashcards.git","ssh_url":"git@github.com:krutman/flashcards.git","clone_url":"https://github.com/krutman/flashcards.git","svn_url":"https://github.com/krutman/flashcards","homepage":null,"size":368,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"krutman:master","ref":"master","sha":"56083b0c1d4523e9276a5de2f0e297a82d7f6605","user":{"login":"krutman","id":8046696,"avatar_url":"https://avatars.githubusercontent.com/u/8046696?v=3","gravatar_id":"","url":"https://api.github.com/users/krutman","html_url":"https://github.com/krutman","followers_url":"https://api.github.com/users/krutman/followers","following_url":"https://api.github.com/users/krutman/following{/other_user}","gists_url":"https://api.github.com/users/krutman/gists{/gist_id}","starred_url":"https://api.github.com/users/krutman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krutman/subscriptions","organizations_url":"https://api.github.com/users/krutman/orgs","repos_url":"https://api.github.com/users/krutman/repos","events_url":"https://api.github.com/users/krutman/events{/privacy}","received_events_url":"https://api.github.com/users/krutman/received_events","type":"User","site_admin":false},"repo":{"id":40921031,"name":"flashcards","full_name":"krutman/flashcards","owner":{"login":"krutman","id":8046696,"avatar_url":"https://avatars.githubusercontent.com/u/8046696?v=3","gravatar_id":"","url":"https://api.github.com/users/krutman","html_url":"https://github.com/krutman","followers_url":"https://api.github.com/users/krutman/followers","following_url":"https://api.github.com/users/krutman/following{/other_user}","gists_url":"https://api.github.com/users/krutman/gists{/gist_id}","starred_url":"https://api.github.com/users/krutman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krutman/subscriptions","organizations_url":"https://api.github.com/users/krutman/orgs","repos_url":"https://api.github.com/users/krutman/repos","events_url":"https://api.github.com/users/krutman/events{/privacy}","received_events_url":"https://api.github.com/users/krutman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/krutman/flashcards","description":"","fork":false,"url":"https://api.github.com/repos/krutman/flashcards","forks_url":"https://api.github.com/repos/krutman/flashcards/forks","keys_url":"https://api.github.com/repos/krutman/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/krutman/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/krutman/flashcards/teams","hooks_url":"https://api.github.com/repos/krutman/flashcards/hooks","issue_events_url":"https://api.github.com/repos/krutman/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/krutman/flashcards/events","assignees_url":"https://api.github.com/repos/krutman/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/krutman/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/krutman/flashcards/tags","blobs_url":"https://api.github.com/repos/krutman/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/krutman/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/krutman/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/krutman/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/krutman/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/krutman/flashcards/languages","stargazers_url":"https://api.github.com/repos/krutman/flashcards/stargazers","contributors_url":"https://api.github.com/repos/krutman/flashcards/contributors","subscribers_url":"https://api.github.com/repos/krutman/flashcards/subscribers","subscription_url":"https://api.github.com/repos/krutman/flashcards/subscription","commits_url":"https://api.github.com/repos/krutman/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/krutman/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/krutman/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/krutman/flashcards/issues/comments{/number}","contents_url":"https://api.github.com/repos/krutman/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/krutman/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/krutman/flashcards/merges","archive_url":"https://api.github.com/repos/krutman/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/krutman/flashcards/downloads","issues_url":"https://api.github.com/repos/krutman/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/krutman/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/krutman/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/krutman/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/krutman/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/krutman/flashcards/releases{/id}","created_at":"2015-08-17T19:05:54Z","updated_at":"2015-08-17T19:26:12Z","pushed_at":"2015-09-13T10:57:33Z","git_url":"git://github.com/krutman/flashcards.git","ssh_url":"git@github.com:krutman/flashcards.git","clone_url":"https://github.com/krutman/flashcards.git","svn_url":"https://github.com/krutman/flashcards","homepage":null,"size":368,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/krutman/flashcards/pulls/7"},"html":{"href":"https://github.com/krutman/flashcards/pull/7"},"issue":{"href":"https://api.github.com/repos/krutman/flashcards/issues/7"},"comments":{"href":"https://api.github.com/repos/krutman/flashcards/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/krutman/flashcards/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/krutman/flashcards/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/krutman/flashcards/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/krutman/flashcards/statuses/3b1b936b896046e57a92036653d396a60434618b"}}}}