{"action":"created","comment":{"url":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls/comments/47691148","id":47691148,"diff_hunk":"@@ -0,0 +1,83 @@\n+require 'rails_helper'\n+\n+describe Loan, :type => :model do\n+  it_should_behave_like 'translatable', ['Description', 'ShortDescription']\n+  it_should_behave_like 'mediable'\n+\n+  it 'has a valid factory' do\n+    expect(create(:loan)).to be_valid\n+  end\n+\n+  context 'model methods' do\n+    let(:loan) { create(:loan) }\n+\n+    describe '.name' do\n+      context 'with cooperative' do\n+        it 'uses cooperative name' do\n+          expect(loan.name).to eq I18n.t :project_with, name: loan.cooperative.name\n+        end\n+      end\n+\n+      context 'without cooperative' do\n+        let(:loan) { create(:loan, cooperative: nil) }\n+        it 'uses project id' do\n+          pending('is not currently possible given DB constraints')\n+          expect(loan.name).to eq I18n.t :project_id, id: loan.id.to_s\n+        end\n+      end\n+    end\n+\n+    describe '.country' do\n+      it 'gets country' do\n+        expect(loan.country).to eq Country.where(name: loan.division.super_division.country).first\n+      end\n+\n+      context 'without country' do\n+        before do\n+          @division = create(:division)\n+          @loan = create(:loan, source_division: @division.id)\n+          @us = create(:country, name: \"United States\")\n+        end\n+        it 'gets united states' do\n+          expect(@loan.country).to eq @us\n+        end\n+      end\n+    end\n+\n+    describe '.location' do\n+      it 'returns city and country' do\n+        expect(loan.location).to eq \"#{loan.cooperative.city}, #{loan.country.name}\"\n+      end\n+\n+      context 'without city' do\n+        let(:loan) { create(:loan, cooperative: create(:cooperative, city: \"\")) }\n+\n+        it 'returns country' do\n+          expect(loan.location).to eq loan.country.name\n+        end\n+      end\n+    end\n+\n+    describe '.signing_date_long' do\n+      it 'returns long formatted date' do\n+        expect(loan.signing_date_long).to eq I18n.l(loan.signing_date, format: :long)\n+      end\n+    end\n+\n+    describe '.status' do\n+      context 'with active loan' do\n+        let(:loan) { create(:loan, :active) }\n+        it 'returns active' do\n+          expect(loan.status).to eq I18n.t(:loan_active)\n+        end\n+      end\n+\n+      context 'with completed loan' do\n+        let(:loan) { create(:loan, :completed) }\n+        it 'returns complete' do\n+          expect(loan.status).to eq I18n.t(:loan_completed)\n+        end\n+      end\n+    end\n+  end\n+end","path":"spec/models/loan_spec.rb","position":83,"original_position":83,"commit_id":"8558401b8aacbe713e8933668d0b6b634249fa88","original_commit_id":"8558401b8aacbe713e8933668d0b6b634249fa88","user":{"login":"linesarefuzzy","id":1829213,"avatar_url":"https://avatars.githubusercontent.com/u/1829213?v=3","gravatar_id":"","url":"https://api.github.com/users/linesarefuzzy","html_url":"https://github.com/linesarefuzzy","followers_url":"https://api.github.com/users/linesarefuzzy/followers","following_url":"https://api.github.com/users/linesarefuzzy/following{/other_user}","gists_url":"https://api.github.com/users/linesarefuzzy/gists{/gist_id}","starred_url":"https://api.github.com/users/linesarefuzzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linesarefuzzy/subscriptions","organizations_url":"https://api.github.com/users/linesarefuzzy/orgs","repos_url":"https://api.github.com/users/linesarefuzzy/repos","events_url":"https://api.github.com/users/linesarefuzzy/events{/privacy}","received_events_url":"https://api.github.com/users/linesarefuzzy/received_events","type":"User","site_admin":false},"body":"What about #featured_pictures, #amount_formatted, maybe #project_events?","created_at":"2015-12-15T20:09:12Z","updated_at":"2015-12-15T20:09:12Z","html_url":"https://github.com/linesarefuzzy/cofunder/pull/2#discussion_r47691148","pull_request_url":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls/comments/47691148"},"html":{"href":"https://github.com/linesarefuzzy/cofunder/pull/2#discussion_r47691148"},"pull_request":{"href":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls/2","id":53592000,"html_url":"https://github.com/linesarefuzzy/cofunder/pull/2","diff_url":"https://github.com/linesarefuzzy/cofunder/pull/2.diff","patch_url":"https://github.com/linesarefuzzy/cofunder/pull/2.patch","issue_url":"https://api.github.com/repos/linesarefuzzy/cofunder/issues/2","number":2,"state":"open","locked":false,"title":"3169 test suite","user":{"login":"meltheadorable","id":10450274,"avatar_url":"https://avatars.githubusercontent.com/u/10450274?v=3","gravatar_id":"","url":"https://api.github.com/users/meltheadorable","html_url":"https://github.com/meltheadorable","followers_url":"https://api.github.com/users/meltheadorable/followers","following_url":"https://api.github.com/users/meltheadorable/following{/other_user}","gists_url":"https://api.github.com/users/meltheadorable/gists{/gist_id}","starred_url":"https://api.github.com/users/meltheadorable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meltheadorable/subscriptions","organizations_url":"https://api.github.com/users/meltheadorable/orgs","repos_url":"https://api.github.com/users/meltheadorable/repos","events_url":"https://api.github.com/users/meltheadorable/events{/privacy}","received_events_url":"https://api.github.com/users/meltheadorable/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-14T17:01:46Z","updated_at":"2015-12-15T20:09:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"298f24fcb368691256d32a0c5c53e83b8c6ce938","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls/2/commits","review_comments_url":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls/2/comments","review_comment_url":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/linesarefuzzy/cofunder/issues/2/comments","statuses_url":"https://api.github.com/repos/linesarefuzzy/cofunder/statuses/8558401b8aacbe713e8933668d0b6b634249fa88","head":{"label":"linesarefuzzy:3169_test_suite","ref":"3169_test_suite","sha":"8558401b8aacbe713e8933668d0b6b634249fa88","user":{"login":"linesarefuzzy","id":1829213,"avatar_url":"https://avatars.githubusercontent.com/u/1829213?v=3","gravatar_id":"","url":"https://api.github.com/users/linesarefuzzy","html_url":"https://github.com/linesarefuzzy","followers_url":"https://api.github.com/users/linesarefuzzy/followers","following_url":"https://api.github.com/users/linesarefuzzy/following{/other_user}","gists_url":"https://api.github.com/users/linesarefuzzy/gists{/gist_id}","starred_url":"https://api.github.com/users/linesarefuzzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linesarefuzzy/subscriptions","organizations_url":"https://api.github.com/users/linesarefuzzy/orgs","repos_url":"https://api.github.com/users/linesarefuzzy/repos","events_url":"https://api.github.com/users/linesarefuzzy/events{/privacy}","received_events_url":"https://api.github.com/users/linesarefuzzy/received_events","type":"User","site_admin":false},"repo":{"id":8347379,"name":"cofunder","full_name":"linesarefuzzy/cofunder","owner":{"login":"linesarefuzzy","id":1829213,"avatar_url":"https://avatars.githubusercontent.com/u/1829213?v=3","gravatar_id":"","url":"https://api.github.com/users/linesarefuzzy","html_url":"https://github.com/linesarefuzzy","followers_url":"https://api.github.com/users/linesarefuzzy/followers","following_url":"https://api.github.com/users/linesarefuzzy/following{/other_user}","gists_url":"https://api.github.com/users/linesarefuzzy/gists{/gist_id}","starred_url":"https://api.github.com/users/linesarefuzzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linesarefuzzy/subscriptions","organizations_url":"https://api.github.com/users/linesarefuzzy/orgs","repos_url":"https://api.github.com/users/linesarefuzzy/repos","events_url":"https://api.github.com/users/linesarefuzzy/events{/privacy}","received_events_url":"https://api.github.com/users/linesarefuzzy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/linesarefuzzy/cofunder","description":"TWW Cofunder in Ruby on Rails","fork":false,"url":"https://api.github.com/repos/linesarefuzzy/cofunder","forks_url":"https://api.github.com/repos/linesarefuzzy/cofunder/forks","keys_url":"https://api.github.com/repos/linesarefuzzy/cofunder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linesarefuzzy/cofunder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linesarefuzzy/cofunder/teams","hooks_url":"https://api.github.com/repos/linesarefuzzy/cofunder/hooks","issue_events_url":"https://api.github.com/repos/linesarefuzzy/cofunder/issues/events{/number}","events_url":"https://api.github.com/repos/linesarefuzzy/cofunder/events","assignees_url":"https://api.github.com/repos/linesarefuzzy/cofunder/assignees{/user}","branches_url":"https://api.github.com/repos/linesarefuzzy/cofunder/branches{/branch}","tags_url":"https://api.github.com/repos/linesarefuzzy/cofunder/tags","blobs_url":"https://api.github.com/repos/linesarefuzzy/cofunder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linesarefuzzy/cofunder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linesarefuzzy/cofunder/git/refs{/sha}","trees_url":"https://api.github.com/repos/linesarefuzzy/cofunder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linesarefuzzy/cofunder/statuses/{sha}","languages_url":"https://api.github.com/repos/linesarefuzzy/cofunder/languages","stargazers_url":"https://api.github.com/repos/linesarefuzzy/cofunder/stargazers","contributors_url":"https://api.github.com/repos/linesarefuzzy/cofunder/contributors","subscribers_url":"https://api.github.com/repos/linesarefuzzy/cofunder/subscribers","subscription_url":"https://api.github.com/repos/linesarefuzzy/cofunder/subscription","commits_url":"https://api.github.com/repos/linesarefuzzy/cofunder/commits{/sha}","git_commits_url":"https://api.github.com/repos/linesarefuzzy/cofunder/git/commits{/sha}","comments_url":"https://api.github.com/repos/linesarefuzzy/cofunder/comments{/number}","issue_comment_url":"https://api.github.com/repos/linesarefuzzy/cofunder/issues/comments{/number}","contents_url":"https://api.github.com/repos/linesarefuzzy/cofunder/contents/{+path}","compare_url":"https://api.github.com/repos/linesarefuzzy/cofunder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linesarefuzzy/cofunder/merges","archive_url":"https://api.github.com/repos/linesarefuzzy/cofunder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linesarefuzzy/cofunder/downloads","issues_url":"https://api.github.com/repos/linesarefuzzy/cofunder/issues{/number}","pulls_url":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls{/number}","milestones_url":"https://api.github.com/repos/linesarefuzzy/cofunder/milestones{/number}","notifications_url":"https://api.github.com/repos/linesarefuzzy/cofunder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linesarefuzzy/cofunder/labels{/name}","releases_url":"https://api.github.com/repos/linesarefuzzy/cofunder/releases{/id}","created_at":"2013-02-22T00:42:18Z","updated_at":"2014-09-07T22:58:38Z","pushed_at":"2015-12-14T17:02:13Z","git_url":"git://github.com/linesarefuzzy/cofunder.git","ssh_url":"git@github.com:linesarefuzzy/cofunder.git","clone_url":"https://github.com/linesarefuzzy/cofunder.git","svn_url":"https://github.com/linesarefuzzy/cofunder","homepage":null,"size":7073,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":3,"default_branch":"develop"}},"base":{"label":"linesarefuzzy:develop","ref":"develop","sha":"c2e27bc103a8b53756b213c3e2076a7c5a1e0c0a","user":{"login":"linesarefuzzy","id":1829213,"avatar_url":"https://avatars.githubusercontent.com/u/1829213?v=3","gravatar_id":"","url":"https://api.github.com/users/linesarefuzzy","html_url":"https://github.com/linesarefuzzy","followers_url":"https://api.github.com/users/linesarefuzzy/followers","following_url":"https://api.github.com/users/linesarefuzzy/following{/other_user}","gists_url":"https://api.github.com/users/linesarefuzzy/gists{/gist_id}","starred_url":"https://api.github.com/users/linesarefuzzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linesarefuzzy/subscriptions","organizations_url":"https://api.github.com/users/linesarefuzzy/orgs","repos_url":"https://api.github.com/users/linesarefuzzy/repos","events_url":"https://api.github.com/users/linesarefuzzy/events{/privacy}","received_events_url":"https://api.github.com/users/linesarefuzzy/received_events","type":"User","site_admin":false},"repo":{"id":8347379,"name":"cofunder","full_name":"linesarefuzzy/cofunder","owner":{"login":"linesarefuzzy","id":1829213,"avatar_url":"https://avatars.githubusercontent.com/u/1829213?v=3","gravatar_id":"","url":"https://api.github.com/users/linesarefuzzy","html_url":"https://github.com/linesarefuzzy","followers_url":"https://api.github.com/users/linesarefuzzy/followers","following_url":"https://api.github.com/users/linesarefuzzy/following{/other_user}","gists_url":"https://api.github.com/users/linesarefuzzy/gists{/gist_id}","starred_url":"https://api.github.com/users/linesarefuzzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linesarefuzzy/subscriptions","organizations_url":"https://api.github.com/users/linesarefuzzy/orgs","repos_url":"https://api.github.com/users/linesarefuzzy/repos","events_url":"https://api.github.com/users/linesarefuzzy/events{/privacy}","received_events_url":"https://api.github.com/users/linesarefuzzy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/linesarefuzzy/cofunder","description":"TWW Cofunder in Ruby on Rails","fork":false,"url":"https://api.github.com/repos/linesarefuzzy/cofunder","forks_url":"https://api.github.com/repos/linesarefuzzy/cofunder/forks","keys_url":"https://api.github.com/repos/linesarefuzzy/cofunder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linesarefuzzy/cofunder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linesarefuzzy/cofunder/teams","hooks_url":"https://api.github.com/repos/linesarefuzzy/cofunder/hooks","issue_events_url":"https://api.github.com/repos/linesarefuzzy/cofunder/issues/events{/number}","events_url":"https://api.github.com/repos/linesarefuzzy/cofunder/events","assignees_url":"https://api.github.com/repos/linesarefuzzy/cofunder/assignees{/user}","branches_url":"https://api.github.com/repos/linesarefuzzy/cofunder/branches{/branch}","tags_url":"https://api.github.com/repos/linesarefuzzy/cofunder/tags","blobs_url":"https://api.github.com/repos/linesarefuzzy/cofunder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linesarefuzzy/cofunder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linesarefuzzy/cofunder/git/refs{/sha}","trees_url":"https://api.github.com/repos/linesarefuzzy/cofunder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linesarefuzzy/cofunder/statuses/{sha}","languages_url":"https://api.github.com/repos/linesarefuzzy/cofunder/languages","stargazers_url":"https://api.github.com/repos/linesarefuzzy/cofunder/stargazers","contributors_url":"https://api.github.com/repos/linesarefuzzy/cofunder/contributors","subscribers_url":"https://api.github.com/repos/linesarefuzzy/cofunder/subscribers","subscription_url":"https://api.github.com/repos/linesarefuzzy/cofunder/subscription","commits_url":"https://api.github.com/repos/linesarefuzzy/cofunder/commits{/sha}","git_commits_url":"https://api.github.com/repos/linesarefuzzy/cofunder/git/commits{/sha}","comments_url":"https://api.github.com/repos/linesarefuzzy/cofunder/comments{/number}","issue_comment_url":"https://api.github.com/repos/linesarefuzzy/cofunder/issues/comments{/number}","contents_url":"https://api.github.com/repos/linesarefuzzy/cofunder/contents/{+path}","compare_url":"https://api.github.com/repos/linesarefuzzy/cofunder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linesarefuzzy/cofunder/merges","archive_url":"https://api.github.com/repos/linesarefuzzy/cofunder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linesarefuzzy/cofunder/downloads","issues_url":"https://api.github.com/repos/linesarefuzzy/cofunder/issues{/number}","pulls_url":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls{/number}","milestones_url":"https://api.github.com/repos/linesarefuzzy/cofunder/milestones{/number}","notifications_url":"https://api.github.com/repos/linesarefuzzy/cofunder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linesarefuzzy/cofunder/labels{/name}","releases_url":"https://api.github.com/repos/linesarefuzzy/cofunder/releases{/id}","created_at":"2013-02-22T00:42:18Z","updated_at":"2014-09-07T22:58:38Z","pushed_at":"2015-12-14T17:02:13Z","git_url":"git://github.com/linesarefuzzy/cofunder.git","ssh_url":"git@github.com:linesarefuzzy/cofunder.git","clone_url":"https://github.com/linesarefuzzy/cofunder.git","svn_url":"https://github.com/linesarefuzzy/cofunder","homepage":null,"size":7073,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":3,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls/2"},"html":{"href":"https://github.com/linesarefuzzy/cofunder/pull/2"},"issue":{"href":"https://api.github.com/repos/linesarefuzzy/cofunder/issues/2"},"comments":{"href":"https://api.github.com/repos/linesarefuzzy/cofunder/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/linesarefuzzy/cofunder/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/linesarefuzzy/cofunder/statuses/8558401b8aacbe713e8933668d0b6b634249fa88"}}}}