{"action":"created","comment":{"url":"https://api.github.com/repos/isnoto/flashcards/pulls/comments/47798576","id":47798576,"diff_hunk":"@@ -0,0 +1,102 @@\n+require 'rails_helper'\n+\n+describe SuperMemo do\n+  let(:card) { build(:card) }\n+  let(:review_time) { 5_000 }\n+  let(:correct_answer) { card.check_answer('Hello', review_time) }\n+  subject { SuperMemo.new(2.5, 'Hello', card.original_text, 0, review_time, 0) }\n+\n+  describe '#calculate_interval' do\n+    context 'when answer is correct' do\n+      let(:first_check) { subject.calculate_interval }\n+\n+      it 'increments field repetitions_number by 1' do\n+        expect(first_check[:repetitions_number]).to eq 1\n+      end\n+\n+      it 'sets the review date of \"Time.zone.now + 1.day\"' do\n+        expect(first_check[:review_date].to_date).to eq (Time.zone.now + 1.day).to_date\n+      end\n+\n+      context 'after two repetitions' do\n+        before do\n+          correct_answer\n+        end\n+\n+        let!(:another_check) { card.check_answer('Hello', review_time) }\n+\n+        it 'field repetitions_number equals 2' do\n+          expect(card.repetitions_number).to eq 2\n+        end\n+\n+        it 'field interval equals 6' do\n+          expect(card.interval).to eq 6\n+        end\n+\n+        it 'sets the review date of \"Time.zone.now + 6.days\"' do\n+          expect(card.review_date).to eq (Time.zone.now + 6.days).to_date\n+        end\n+      end\n+\n+      context 'when answer is incorrect' do\n+        let!(:incorrect_ans) { card.check_answer('Aloha', review_time) }\n+\n+        it 'user\\'s answer not equals to original text' do\n+          expect(incorrect_ans).to be :wrong_answer\n+        end\n+\n+        it 'not changes review date' do\n+          expect(card.review_date).to eq (Time.zone.now).to_date\n+        end\n+      end\n+\n+      context 'when answer is incorrect after correct answer' do\n+        let!(:correct_ans)   { card.check_answer('Hello', review_time) }\n+        let!(:incorrect_ans) { card.check_answer('Aloha', review_time) }\n+\n+        it 'review date equals \"Time.zone.now\"' do\n+          expect(card.review_date).to eq (Time.zone.now).to_date\n+        end\n+\n+        it 'reset repetitions_number to 0' do\n+          expect(card.repetitions_number).to eq 0\n+        end\n+      end\n+    end\n+  end\n+\n+  describe '#reset_repetitions_number' do\n+    subject { SuperMemo.new(2.5, 'Hello', card.original_text, 1, 16_000, 1) }\n+\n+    it 'resets repetitions number if quality is fewer than 3' do\n+      expect(subject.calculate_interval[:repetitions_number]).to eq 0\n+    end\n+  end\n+\n+  describe '#compare_words' do\n+    context 'when the answer is correct' do\n+      let!(:correct_answer) { card.check_answer(card.original_text, review_time) }","path":"spec/services/super_memo_spec.rb","position":78,"original_position":78,"commit_id":"edeeda1644232fd65adc846f666e3de9c8873b19","original_commit_id":"edeeda1644232fd65adc846f666e3de9c8873b19","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":"Line is too long. [82/80]","created_at":"2015-12-16T16:32:14Z","updated_at":"2015-12-16T16:32:14Z","html_url":"https://github.com/isnoto/flashcards/pull/20#discussion_r47798576","pull_request_url":"https://api.github.com/repos/isnoto/flashcards/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/isnoto/flashcards/pulls/comments/47798576"},"html":{"href":"https://github.com/isnoto/flashcards/pull/20#discussion_r47798576"},"pull_request":{"href":"https://api.github.com/repos/isnoto/flashcards/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/isnoto/flashcards/pulls/20","id":53864650,"html_url":"https://github.com/isnoto/flashcards/pull/20","diff_url":"https://github.com/isnoto/flashcards/pull/20.diff","patch_url":"https://github.com/isnoto/flashcards/pull/20.patch","issue_url":"https://api.github.com/repos/isnoto/flashcards/issues/20","number":20,"state":"open","locked":false,"title":"SuperMemo 2","user":{"login":"isnoto","id":10686712,"avatar_url":"https://avatars.githubusercontent.com/u/10686712?v=3","gravatar_id":"","url":"https://api.github.com/users/isnoto","html_url":"https://github.com/isnoto","followers_url":"https://api.github.com/users/isnoto/followers","following_url":"https://api.github.com/users/isnoto/following{/other_user}","gists_url":"https://api.github.com/users/isnoto/gists{/gist_id}","starred_url":"https://api.github.com/users/isnoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isnoto/subscriptions","organizations_url":"https://api.github.com/users/isnoto/orgs","repos_url":"https://api.github.com/users/isnoto/repos","events_url":"https://api.github.com/users/isnoto/events{/privacy}","received_events_url":"https://api.github.com/users/isnoto/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-16T16:32:09Z","updated_at":"2015-12-16T16:32:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae142ca1962fca569d78744bb7d306d9a85c96ce","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/isnoto/flashcards/pulls/20/commits","review_comments_url":"https://api.github.com/repos/isnoto/flashcards/pulls/20/comments","review_comment_url":"https://api.github.com/repos/isnoto/flashcards/pulls/comments{/number}","comments_url":"https://api.github.com/repos/isnoto/flashcards/issues/20/comments","statuses_url":"https://api.github.com/repos/isnoto/flashcards/statuses/edeeda1644232fd65adc846f666e3de9c8873b19","head":{"label":"isnoto:seventeenth-task","ref":"seventeenth-task","sha":"edeeda1644232fd65adc846f666e3de9c8873b19","user":{"login":"isnoto","id":10686712,"avatar_url":"https://avatars.githubusercontent.com/u/10686712?v=3","gravatar_id":"","url":"https://api.github.com/users/isnoto","html_url":"https://github.com/isnoto","followers_url":"https://api.github.com/users/isnoto/followers","following_url":"https://api.github.com/users/isnoto/following{/other_user}","gists_url":"https://api.github.com/users/isnoto/gists{/gist_id}","starred_url":"https://api.github.com/users/isnoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isnoto/subscriptions","organizations_url":"https://api.github.com/users/isnoto/orgs","repos_url":"https://api.github.com/users/isnoto/repos","events_url":"https://api.github.com/users/isnoto/events{/privacy}","received_events_url":"https://api.github.com/users/isnoto/received_events","type":"User","site_admin":false},"repo":{"id":42663356,"name":"flashcards","full_name":"isnoto/flashcards","owner":{"login":"isnoto","id":10686712,"avatar_url":"https://avatars.githubusercontent.com/u/10686712?v=3","gravatar_id":"","url":"https://api.github.com/users/isnoto","html_url":"https://github.com/isnoto","followers_url":"https://api.github.com/users/isnoto/followers","following_url":"https://api.github.com/users/isnoto/following{/other_user}","gists_url":"https://api.github.com/users/isnoto/gists{/gist_id}","starred_url":"https://api.github.com/users/isnoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isnoto/subscriptions","organizations_url":"https://api.github.com/users/isnoto/orgs","repos_url":"https://api.github.com/users/isnoto/repos","events_url":"https://api.github.com/users/isnoto/events{/privacy}","received_events_url":"https://api.github.com/users/isnoto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/isnoto/flashcards","description":"","fork":false,"url":"https://api.github.com/repos/isnoto/flashcards","forks_url":"https://api.github.com/repos/isnoto/flashcards/forks","keys_url":"https://api.github.com/repos/isnoto/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/isnoto/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/isnoto/flashcards/teams","hooks_url":"https://api.github.com/repos/isnoto/flashcards/hooks","issue_events_url":"https://api.github.com/repos/isnoto/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/isnoto/flashcards/events","assignees_url":"https://api.github.com/repos/isnoto/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/isnoto/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/isnoto/flashcards/tags","blobs_url":"https://api.github.com/repos/isnoto/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/isnoto/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/isnoto/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/isnoto/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/isnoto/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/isnoto/flashcards/languages","stargazers_url":"https://api.github.com/repos/isnoto/flashcards/stargazers","contributors_url":"https://api.github.com/repos/isnoto/flashcards/contributors","subscribers_url":"https://api.github.com/repos/isnoto/flashcards/subscribers","subscription_url":"https://api.github.com/repos/isnoto/flashcards/subscription","commits_url":"https://api.github.com/repos/isnoto/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/isnoto/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/isnoto/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/isnoto/flashcards/issues/comments{/number}","contents_url":"https://api.github.com/repos/isnoto/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/isnoto/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/isnoto/flashcards/merges","archive_url":"https://api.github.com/repos/isnoto/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/isnoto/flashcards/downloads","issues_url":"https://api.github.com/repos/isnoto/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/isnoto/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/isnoto/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/isnoto/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/isnoto/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/isnoto/flashcards/releases{/id}","created_at":"2015-09-17T15:09:40Z","updated_at":"2015-09-22T21:20:37Z","pushed_at":"2015-12-16T16:32:09Z","git_url":"git://github.com/isnoto/flashcards.git","ssh_url":"git@github.com:isnoto/flashcards.git","clone_url":"https://github.com/isnoto/flashcards.git","svn_url":"https://github.com/isnoto/flashcards","homepage":null,"size":208,"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":"isnoto:master","ref":"master","sha":"eadbb67ccd05fd2e772adc5c7741d4160aaaef75","user":{"login":"isnoto","id":10686712,"avatar_url":"https://avatars.githubusercontent.com/u/10686712?v=3","gravatar_id":"","url":"https://api.github.com/users/isnoto","html_url":"https://github.com/isnoto","followers_url":"https://api.github.com/users/isnoto/followers","following_url":"https://api.github.com/users/isnoto/following{/other_user}","gists_url":"https://api.github.com/users/isnoto/gists{/gist_id}","starred_url":"https://api.github.com/users/isnoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isnoto/subscriptions","organizations_url":"https://api.github.com/users/isnoto/orgs","repos_url":"https://api.github.com/users/isnoto/repos","events_url":"https://api.github.com/users/isnoto/events{/privacy}","received_events_url":"https://api.github.com/users/isnoto/received_events","type":"User","site_admin":false},"repo":{"id":42663356,"name":"flashcards","full_name":"isnoto/flashcards","owner":{"login":"isnoto","id":10686712,"avatar_url":"https://avatars.githubusercontent.com/u/10686712?v=3","gravatar_id":"","url":"https://api.github.com/users/isnoto","html_url":"https://github.com/isnoto","followers_url":"https://api.github.com/users/isnoto/followers","following_url":"https://api.github.com/users/isnoto/following{/other_user}","gists_url":"https://api.github.com/users/isnoto/gists{/gist_id}","starred_url":"https://api.github.com/users/isnoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isnoto/subscriptions","organizations_url":"https://api.github.com/users/isnoto/orgs","repos_url":"https://api.github.com/users/isnoto/repos","events_url":"https://api.github.com/users/isnoto/events{/privacy}","received_events_url":"https://api.github.com/users/isnoto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/isnoto/flashcards","description":"","fork":false,"url":"https://api.github.com/repos/isnoto/flashcards","forks_url":"https://api.github.com/repos/isnoto/flashcards/forks","keys_url":"https://api.github.com/repos/isnoto/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/isnoto/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/isnoto/flashcards/teams","hooks_url":"https://api.github.com/repos/isnoto/flashcards/hooks","issue_events_url":"https://api.github.com/repos/isnoto/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/isnoto/flashcards/events","assignees_url":"https://api.github.com/repos/isnoto/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/isnoto/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/isnoto/flashcards/tags","blobs_url":"https://api.github.com/repos/isnoto/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/isnoto/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/isnoto/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/isnoto/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/isnoto/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/isnoto/flashcards/languages","stargazers_url":"https://api.github.com/repos/isnoto/flashcards/stargazers","contributors_url":"https://api.github.com/repos/isnoto/flashcards/contributors","subscribers_url":"https://api.github.com/repos/isnoto/flashcards/subscribers","subscription_url":"https://api.github.com/repos/isnoto/flashcards/subscription","commits_url":"https://api.github.com/repos/isnoto/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/isnoto/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/isnoto/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/isnoto/flashcards/issues/comments{/number}","contents_url":"https://api.github.com/repos/isnoto/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/isnoto/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/isnoto/flashcards/merges","archive_url":"https://api.github.com/repos/isnoto/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/isnoto/flashcards/downloads","issues_url":"https://api.github.com/repos/isnoto/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/isnoto/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/isnoto/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/isnoto/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/isnoto/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/isnoto/flashcards/releases{/id}","created_at":"2015-09-17T15:09:40Z","updated_at":"2015-09-22T21:20:37Z","pushed_at":"2015-12-16T16:32:09Z","git_url":"git://github.com/isnoto/flashcards.git","ssh_url":"git@github.com:isnoto/flashcards.git","clone_url":"https://github.com/isnoto/flashcards.git","svn_url":"https://github.com/isnoto/flashcards","homepage":null,"size":208,"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/isnoto/flashcards/pulls/20"},"html":{"href":"https://github.com/isnoto/flashcards/pull/20"},"issue":{"href":"https://api.github.com/repos/isnoto/flashcards/issues/20"},"comments":{"href":"https://api.github.com/repos/isnoto/flashcards/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/isnoto/flashcards/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/isnoto/flashcards/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/isnoto/flashcards/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/isnoto/flashcards/statuses/edeeda1644232fd65adc846f666e3de9c8873b19"}}}}