{"action":"created","comment":{"url":"https://api.github.com/repos/ismop/dap/pulls/comments/72043003","id":72043003,"diff_hunk":"@@ -0,0 +1,172 @@\n+require 'rails_helper'\n+\n+describe ThreatLevel::AssessmentRunStatusDataBuilderService do\n+  context 'run is finished' do\n+    let!(:finished_run) { create(:threat_assessment_run, status: 'finished') }\n+    it 'returns status \"finished\"' do\n+      expect(ThreatLevel::AssessmentRunStatusDataBuilderService.get(finished_run)).\n+          to eq finished_run_status_data\n+    end\n+  end\n+  context 'run started less than 1 hour ago and is not finished' do\n+    let(:run) do\n+      create(\n+        :threat_assessment_run,\n+        threat_assessments: [create(:threat_assessment)],\n+        status: 'started',\n+        start_date: Time.now,\n+        end_date: nil\n+      )\n+    end\n+    context 'no results yet' do\n+      it 'returns status \"started\" with explanation' do\n+        expect(ThreatLevel::AssessmentRunStatusDataBuilderService.get(run)).\n+          to eq started_run_status_data\n+      end\n+    end\n+    context 'results present' do\n+      context 'results produced less than two hours ago' do\n+        before do\n+          create(:result, threat_assessment: run.threat_assessments.first, created_at: Time.now)\n+          create(:result, threat_assessment: run.threat_assessments.first, created_at: Time.now + 1.hours)\n+        end\n+        it 'return status \"running\" with explanation' do\n+          expect(ThreatLevel::AssessmentRunStatusDataBuilderService.get(run)).\n+            to eq running_run_status_data\n+        end\n+      end\n+    end\n+  end\n+\n+  context 'run started more hour ago and less than five hours ago' do","path":"spec/services/threat_level/assessment_run_status_data_builder_service_spec.rb","position":41,"original_position":41,"commit_id":"ca82e05ab6d92f8efb339f135519e9cd0ea62986","original_commit_id":"ca82e05ab6d92f8efb339f135519e9cd0ea62986","user":{"login":"nowakowski","id":4568385,"avatar_url":"https://avatars.githubusercontent.com/u/4568385?v=3","gravatar_id":"","url":"https://api.github.com/users/nowakowski","html_url":"https://github.com/nowakowski","followers_url":"https://api.github.com/users/nowakowski/followers","following_url":"https://api.github.com/users/nowakowski/following{/other_user}","gists_url":"https://api.github.com/users/nowakowski/gists{/gist_id}","starred_url":"https://api.github.com/users/nowakowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nowakowski/subscriptions","organizations_url":"https://api.github.com/users/nowakowski/orgs","repos_url":"https://api.github.com/users/nowakowski/repos","events_url":"https://api.github.com/users/nowakowski/events{/privacy}","received_events_url":"https://api.github.com/users/nowakowski/received_events","type":"User","site_admin":false},"body":"more than","created_at":"2016-07-25T10:44:37Z","updated_at":"2016-07-25T10:44:37Z","html_url":"https://github.com/ismop/dap/pull/121#discussion_r72043003","pull_request_url":"https://api.github.com/repos/ismop/dap/pulls/121","_links":{"self":{"href":"https://api.github.com/repos/ismop/dap/pulls/comments/72043003"},"html":{"href":"https://github.com/ismop/dap/pull/121#discussion_r72043003"},"pull_request":{"href":"https://api.github.com/repos/ismop/dap/pulls/121"}}},"pull_request":{"url":"https://api.github.com/repos/ismop/dap/pulls/121","id":76922421,"html_url":"https://github.com/ismop/dap/pull/121","diff_url":"https://github.com/ismop/dap/pull/121.diff","patch_url":"https://github.com/ismop/dap/pull/121.patch","issue_url":"https://api.github.com/repos/ismop/dap/issues/121","number":121,"state":"open","locked":false,"title":"Threat levels","user":{"login":"tbartynski","id":1744749,"avatar_url":"https://avatars.githubusercontent.com/u/1744749?v=3","gravatar_id":"","url":"https://api.github.com/users/tbartynski","html_url":"https://github.com/tbartynski","followers_url":"https://api.github.com/users/tbartynski/followers","following_url":"https://api.github.com/users/tbartynski/following{/other_user}","gists_url":"https://api.github.com/users/tbartynski/gists{/gist_id}","starred_url":"https://api.github.com/users/tbartynski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbartynski/subscriptions","organizations_url":"https://api.github.com/users/tbartynski/orgs","repos_url":"https://api.github.com/users/tbartynski/repos","events_url":"https://api.github.com/users/tbartynski/events{/privacy}","received_events_url":"https://api.github.com/users/tbartynski/received_events","type":"User","site_admin":false},"body":"Closes #115 ","created_at":"2016-07-11T09:20:13Z","updated_at":"2016-07-25T10:44:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"879fbe510688affdf9dc4ffdd5a4640505b47729","assignee":{"login":"bwilk","id":2674939,"avatar_url":"https://avatars.githubusercontent.com/u/2674939?v=3","gravatar_id":"","url":"https://api.github.com/users/bwilk","html_url":"https://github.com/bwilk","followers_url":"https://api.github.com/users/bwilk/followers","following_url":"https://api.github.com/users/bwilk/following{/other_user}","gists_url":"https://api.github.com/users/bwilk/gists{/gist_id}","starred_url":"https://api.github.com/users/bwilk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bwilk/subscriptions","organizations_url":"https://api.github.com/users/bwilk/orgs","repos_url":"https://api.github.com/users/bwilk/repos","events_url":"https://api.github.com/users/bwilk/events{/privacy}","received_events_url":"https://api.github.com/users/bwilk/received_events","type":"User","site_admin":false},"assignees":[{"login":"bwilk","id":2674939,"avatar_url":"https://avatars.githubusercontent.com/u/2674939?v=3","gravatar_id":"","url":"https://api.github.com/users/bwilk","html_url":"https://github.com/bwilk","followers_url":"https://api.github.com/users/bwilk/followers","following_url":"https://api.github.com/users/bwilk/following{/other_user}","gists_url":"https://api.github.com/users/bwilk/gists{/gist_id}","starred_url":"https://api.github.com/users/bwilk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bwilk/subscriptions","organizations_url":"https://api.github.com/users/bwilk/orgs","repos_url":"https://api.github.com/users/bwilk/repos","events_url":"https://api.github.com/users/bwilk/events{/privacy}","received_events_url":"https://api.github.com/users/bwilk/received_events","type":"User","site_admin":false},{"login":"nowakowski","id":4568385,"avatar_url":"https://avatars.githubusercontent.com/u/4568385?v=3","gravatar_id":"","url":"https://api.github.com/users/nowakowski","html_url":"https://github.com/nowakowski","followers_url":"https://api.github.com/users/nowakowski/followers","following_url":"https://api.github.com/users/nowakowski/following{/other_user}","gists_url":"https://api.github.com/users/nowakowski/gists{/gist_id}","starred_url":"https://api.github.com/users/nowakowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nowakowski/subscriptions","organizations_url":"https://api.github.com/users/nowakowski/orgs","repos_url":"https://api.github.com/users/nowakowski/repos","events_url":"https://api.github.com/users/nowakowski/events{/privacy}","received_events_url":"https://api.github.com/users/nowakowski/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ismop/dap/pulls/121/commits","review_comments_url":"https://api.github.com/repos/ismop/dap/pulls/121/comments","review_comment_url":"https://api.github.com/repos/ismop/dap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ismop/dap/issues/121/comments","statuses_url":"https://api.github.com/repos/ismop/dap/statuses/ca82e05ab6d92f8efb339f135519e9cd0ea62986","head":{"label":"ismop:threat_levels","ref":"threat_levels","sha":"ca82e05ab6d92f8efb339f135519e9cd0ea62986","user":{"login":"ismop","id":9445172,"avatar_url":"https://avatars.githubusercontent.com/u/9445172?v=3","gravatar_id":"","url":"https://api.github.com/users/ismop","html_url":"https://github.com/ismop","followers_url":"https://api.github.com/users/ismop/followers","following_url":"https://api.github.com/users/ismop/following{/other_user}","gists_url":"https://api.github.com/users/ismop/gists{/gist_id}","starred_url":"https://api.github.com/users/ismop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ismop/subscriptions","organizations_url":"https://api.github.com/users/ismop/orgs","repos_url":"https://api.github.com/users/ismop/repos","events_url":"https://api.github.com/users/ismop/events{/privacy}","received_events_url":"https://api.github.com/users/ismop/received_events","type":"Organization","site_admin":false},"repo":{"id":25922551,"name":"dap","full_name":"ismop/dap","owner":{"login":"ismop","id":9445172,"avatar_url":"https://avatars.githubusercontent.com/u/9445172?v=3","gravatar_id":"","url":"https://api.github.com/users/ismop","html_url":"https://github.com/ismop","followers_url":"https://api.github.com/users/ismop/followers","following_url":"https://api.github.com/users/ismop/following{/other_user}","gists_url":"https://api.github.com/users/ismop/gists{/gist_id}","starred_url":"https://api.github.com/users/ismop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ismop/subscriptions","organizations_url":"https://api.github.com/users/ismop/orgs","repos_url":"https://api.github.com/users/ismop/repos","events_url":"https://api.github.com/users/ismop/events{/privacy}","received_events_url":"https://api.github.com/users/ismop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ismop/dap","description":"","fork":false,"url":"https://api.github.com/repos/ismop/dap","forks_url":"https://api.github.com/repos/ismop/dap/forks","keys_url":"https://api.github.com/repos/ismop/dap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ismop/dap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ismop/dap/teams","hooks_url":"https://api.github.com/repos/ismop/dap/hooks","issue_events_url":"https://api.github.com/repos/ismop/dap/issues/events{/number}","events_url":"https://api.github.com/repos/ismop/dap/events","assignees_url":"https://api.github.com/repos/ismop/dap/assignees{/user}","branches_url":"https://api.github.com/repos/ismop/dap/branches{/branch}","tags_url":"https://api.github.com/repos/ismop/dap/tags","blobs_url":"https://api.github.com/repos/ismop/dap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ismop/dap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ismop/dap/git/refs{/sha}","trees_url":"https://api.github.com/repos/ismop/dap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ismop/dap/statuses/{sha}","languages_url":"https://api.github.com/repos/ismop/dap/languages","stargazers_url":"https://api.github.com/repos/ismop/dap/stargazers","contributors_url":"https://api.github.com/repos/ismop/dap/contributors","subscribers_url":"https://api.github.com/repos/ismop/dap/subscribers","subscription_url":"https://api.github.com/repos/ismop/dap/subscription","commits_url":"https://api.github.com/repos/ismop/dap/commits{/sha}","git_commits_url":"https://api.github.com/repos/ismop/dap/git/commits{/sha}","comments_url":"https://api.github.com/repos/ismop/dap/comments{/number}","issue_comment_url":"https://api.github.com/repos/ismop/dap/issues/comments{/number}","contents_url":"https://api.github.com/repos/ismop/dap/contents/{+path}","compare_url":"https://api.github.com/repos/ismop/dap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ismop/dap/merges","archive_url":"https://api.github.com/repos/ismop/dap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ismop/dap/downloads","issues_url":"https://api.github.com/repos/ismop/dap/issues{/number}","pulls_url":"https://api.github.com/repos/ismop/dap/pulls{/number}","milestones_url":"https://api.github.com/repos/ismop/dap/milestones{/number}","notifications_url":"https://api.github.com/repos/ismop/dap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ismop/dap/labels{/name}","releases_url":"https://api.github.com/repos/ismop/dap/releases{/id}","deployments_url":"https://api.github.com/repos/ismop/dap/deployments","created_at":"2014-10-29T13:39:44Z","updated_at":"2016-01-25T12:14:05Z","pushed_at":"2016-07-25T10:31:23Z","git_url":"git://github.com/ismop/dap.git","ssh_url":"git@github.com:ismop/dap.git","clone_url":"https://github.com/ismop/dap.git","svn_url":"https://github.com/ismop/dap","homepage":null,"size":475,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":15,"forks":0,"open_issues":15,"watchers":2,"default_branch":"master"}},"base":{"label":"ismop:master","ref":"master","sha":"cb9bc67f117fe35cda91c3487c86f0ca13bb343b","user":{"login":"ismop","id":9445172,"avatar_url":"https://avatars.githubusercontent.com/u/9445172?v=3","gravatar_id":"","url":"https://api.github.com/users/ismop","html_url":"https://github.com/ismop","followers_url":"https://api.github.com/users/ismop/followers","following_url":"https://api.github.com/users/ismop/following{/other_user}","gists_url":"https://api.github.com/users/ismop/gists{/gist_id}","starred_url":"https://api.github.com/users/ismop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ismop/subscriptions","organizations_url":"https://api.github.com/users/ismop/orgs","repos_url":"https://api.github.com/users/ismop/repos","events_url":"https://api.github.com/users/ismop/events{/privacy}","received_events_url":"https://api.github.com/users/ismop/received_events","type":"Organization","site_admin":false},"repo":{"id":25922551,"name":"dap","full_name":"ismop/dap","owner":{"login":"ismop","id":9445172,"avatar_url":"https://avatars.githubusercontent.com/u/9445172?v=3","gravatar_id":"","url":"https://api.github.com/users/ismop","html_url":"https://github.com/ismop","followers_url":"https://api.github.com/users/ismop/followers","following_url":"https://api.github.com/users/ismop/following{/other_user}","gists_url":"https://api.github.com/users/ismop/gists{/gist_id}","starred_url":"https://api.github.com/users/ismop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ismop/subscriptions","organizations_url":"https://api.github.com/users/ismop/orgs","repos_url":"https://api.github.com/users/ismop/repos","events_url":"https://api.github.com/users/ismop/events{/privacy}","received_events_url":"https://api.github.com/users/ismop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ismop/dap","description":"","fork":false,"url":"https://api.github.com/repos/ismop/dap","forks_url":"https://api.github.com/repos/ismop/dap/forks","keys_url":"https://api.github.com/repos/ismop/dap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ismop/dap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ismop/dap/teams","hooks_url":"https://api.github.com/repos/ismop/dap/hooks","issue_events_url":"https://api.github.com/repos/ismop/dap/issues/events{/number}","events_url":"https://api.github.com/repos/ismop/dap/events","assignees_url":"https://api.github.com/repos/ismop/dap/assignees{/user}","branches_url":"https://api.github.com/repos/ismop/dap/branches{/branch}","tags_url":"https://api.github.com/repos/ismop/dap/tags","blobs_url":"https://api.github.com/repos/ismop/dap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ismop/dap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ismop/dap/git/refs{/sha}","trees_url":"https://api.github.com/repos/ismop/dap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ismop/dap/statuses/{sha}","languages_url":"https://api.github.com/repos/ismop/dap/languages","stargazers_url":"https://api.github.com/repos/ismop/dap/stargazers","contributors_url":"https://api.github.com/repos/ismop/dap/contributors","subscribers_url":"https://api.github.com/repos/ismop/dap/subscribers","subscription_url":"https://api.github.com/repos/ismop/dap/subscription","commits_url":"https://api.github.com/repos/ismop/dap/commits{/sha}","git_commits_url":"https://api.github.com/repos/ismop/dap/git/commits{/sha}","comments_url":"https://api.github.com/repos/ismop/dap/comments{/number}","issue_comment_url":"https://api.github.com/repos/ismop/dap/issues/comments{/number}","contents_url":"https://api.github.com/repos/ismop/dap/contents/{+path}","compare_url":"https://api.github.com/repos/ismop/dap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ismop/dap/merges","archive_url":"https://api.github.com/repos/ismop/dap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ismop/dap/downloads","issues_url":"https://api.github.com/repos/ismop/dap/issues{/number}","pulls_url":"https://api.github.com/repos/ismop/dap/pulls{/number}","milestones_url":"https://api.github.com/repos/ismop/dap/milestones{/number}","notifications_url":"https://api.github.com/repos/ismop/dap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ismop/dap/labels{/name}","releases_url":"https://api.github.com/repos/ismop/dap/releases{/id}","deployments_url":"https://api.github.com/repos/ismop/dap/deployments","created_at":"2014-10-29T13:39:44Z","updated_at":"2016-01-25T12:14:05Z","pushed_at":"2016-07-25T10:31:23Z","git_url":"git://github.com/ismop/dap.git","ssh_url":"git@github.com:ismop/dap.git","clone_url":"https://github.com/ismop/dap.git","svn_url":"https://github.com/ismop/dap","homepage":null,"size":475,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":15,"forks":0,"open_issues":15,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ismop/dap/pulls/121"},"html":{"href":"https://github.com/ismop/dap/pull/121"},"issue":{"href":"https://api.github.com/repos/ismop/dap/issues/121"},"comments":{"href":"https://api.github.com/repos/ismop/dap/issues/121/comments"},"review_comments":{"href":"https://api.github.com/repos/ismop/dap/pulls/121/comments"},"review_comment":{"href":"https://api.github.com/repos/ismop/dap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ismop/dap/pulls/121/commits"},"statuses":{"href":"https://api.github.com/repos/ismop/dap/statuses/ca82e05ab6d92f8efb339f135519e9cd0ea62986"}}}}
{"actor":{"display_login":"nowakowski"}}