{"action":"created","comment":{"url":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls/comments/38073277","id":38073277,"diff_hunk":"@@ -17,6 +17,91 @@\n   let!(:openstack) { create(:openstack_with_flavors, funds: [fund]) }\n   let!(:tmpl_of_shareable_at) { create(:virtual_machine_template, appliance_type: shareable_appl_type, tenants: [openstack])}\n \n+  context '#assign fund' do\n+    let!(:t) { create(:openstack_with_flavors, active: true, funds: [fund]) }\n+    let!(:vmt) { create(:virtual_machine_template, tenants: [t]) }\n+    let!(:appliance_type) do\n+      create(\n+        :appliance_type,\n+        preference_cpu: 0,\n+        preference_disk: 0,\n+        preference_memory: 0,\n+        virtual_machine_templates: [vmt]\n+      )\n+    end\n+    let!(:appliance_set) { create(:appliance_set, user: u) }\n+    let!(:appliance) do\n+      create(:appliance,\n+             appliance_set: appliance_set,\n+             appliance_type: appliance_type,\n+             fund: nil)\n+    end\n+\n+    it 'does not change fund when externally assigned' do\n+      funded_appliance = create(:appliance)\n+      expect(funded_appliance.fund).not_to eq appliance.send(:default_fund)\n+    end\n+\n+    it 'gets default fund from its user if no fund is set' do\n+      appliance.reload\n+      Atmosphere::Cloud::SatisfyAppliance.new(appliance).execute\n+      expect(appliance.fund).to eq appliance.send(:default_fund)\n+    end\n+\n+    it 'prefers default fund if it supports relevant tenant' do\n+      appliance.reload\n+      default_t = create(\n+        :openstack_with_flavors,\n+        active: true,\n+        funds: [appliance_set.user.default_fund]\n+      )\n+      funded_t = create(:openstack_with_flavors, active: true, funds: [create(:fund)])","path":"spec/services/atmosphere/cloud/satisfy_appliance_spec.rb","position":42,"original_position":42,"commit_id":"f51ede90635c6edd5b00fb0e0c0e35f78b7fbc0f","original_commit_id":"f51ede90635c6edd5b00fb0e0c0e35f78b7fbc0f","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. [86/80]","created_at":"2015-08-27T08:36:45Z","updated_at":"2015-08-27T08:36:45Z","html_url":"https://github.com/dice-cyfronet/atmosphere/pull/242#discussion_r38073277","pull_request_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls/242","_links":{"self":{"href":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls/comments/38073277"},"html":{"href":"https://github.com/dice-cyfronet/atmosphere/pull/242#discussion_r38073277"},"pull_request":{"href":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls/242"}}},"pull_request":{"url":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls/242","id":43295221,"html_url":"https://github.com/dice-cyfronet/atmosphere/pull/242","diff_url":"https://github.com/dice-cyfronet/atmosphere/pull/242.diff","patch_url":"https://github.com/dice-cyfronet/atmosphere/pull/242.patch","issue_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/issues/242","number":242,"state":"open","locked":false,"title":"Updated fund assignment logic","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":"Fixes #210 ","created_at":"2015-08-25T14:51:28Z","updated_at":"2015-08-27T08:36:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c27af18548cc55893140b020bb11926c3dada43","assignee":{"login":"mkasztelnik","id":1265430,"avatar_url":"https://avatars.githubusercontent.com/u/1265430?v=3","gravatar_id":"","url":"https://api.github.com/users/mkasztelnik","html_url":"https://github.com/mkasztelnik","followers_url":"https://api.github.com/users/mkasztelnik/followers","following_url":"https://api.github.com/users/mkasztelnik/following{/other_user}","gists_url":"https://api.github.com/users/mkasztelnik/gists{/gist_id}","starred_url":"https://api.github.com/users/mkasztelnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkasztelnik/subscriptions","organizations_url":"https://api.github.com/users/mkasztelnik/orgs","repos_url":"https://api.github.com/users/mkasztelnik/repos","events_url":"https://api.github.com/users/mkasztelnik/events{/privacy}","received_events_url":"https://api.github.com/users/mkasztelnik/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dice-cyfronet/atmosphere/milestones/1","html_url":"https://github.com/dice-cyfronet/atmosphere/milestones/28-August","labels_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/milestones/1/labels","id":1262247,"number":1,"title":"28-August","description":"","creator":{"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},"open_issues":7,"closed_issues":12,"state":"open","created_at":"2015-08-19T09:43:04Z","updated_at":"2015-08-26T12:01:46Z","due_on":"2015-08-27T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls/242/commits","review_comments_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls/242/comments","review_comment_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/issues/242/comments","statuses_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/statuses/f51ede90635c6edd5b00fb0e0c0e35f78b7fbc0f","head":{"label":"dice-cyfronet:updated_fund_assignment_logic","ref":"updated_fund_assignment_logic","sha":"f51ede90635c6edd5b00fb0e0c0e35f78b7fbc0f","user":{"login":"dice-cyfronet","id":1628782,"avatar_url":"https://avatars.githubusercontent.com/u/1628782?v=3","gravatar_id":"","url":"https://api.github.com/users/dice-cyfronet","html_url":"https://github.com/dice-cyfronet","followers_url":"https://api.github.com/users/dice-cyfronet/followers","following_url":"https://api.github.com/users/dice-cyfronet/following{/other_user}","gists_url":"https://api.github.com/users/dice-cyfronet/gists{/gist_id}","starred_url":"https://api.github.com/users/dice-cyfronet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dice-cyfronet/subscriptions","organizations_url":"https://api.github.com/users/dice-cyfronet/orgs","repos_url":"https://api.github.com/users/dice-cyfronet/repos","events_url":"https://api.github.com/users/dice-cyfronet/events{/privacy}","received_events_url":"https://api.github.com/users/dice-cyfronet/received_events","type":"Organization","site_admin":false},"repo":{"id":25483417,"name":"atmosphere","full_name":"dice-cyfronet/atmosphere","owner":{"login":"dice-cyfronet","id":1628782,"avatar_url":"https://avatars.githubusercontent.com/u/1628782?v=3","gravatar_id":"","url":"https://api.github.com/users/dice-cyfronet","html_url":"https://github.com/dice-cyfronet","followers_url":"https://api.github.com/users/dice-cyfronet/followers","following_url":"https://api.github.com/users/dice-cyfronet/following{/other_user}","gists_url":"https://api.github.com/users/dice-cyfronet/gists{/gist_id}","starred_url":"https://api.github.com/users/dice-cyfronet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dice-cyfronet/subscriptions","organizations_url":"https://api.github.com/users/dice-cyfronet/orgs","repos_url":"https://api.github.com/users/dice-cyfronet/repos","events_url":"https://api.github.com/users/dice-cyfronet/events{/privacy}","received_events_url":"https://api.github.com/users/dice-cyfronet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dice-cyfronet/atmosphere","description":"Atmosphere cloud platform","fork":false,"url":"https://api.github.com/repos/dice-cyfronet/atmosphere","forks_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/forks","keys_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/teams","hooks_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/hooks","issue_events_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/issues/events{/number}","events_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/events","assignees_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/assignees{/user}","branches_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/branches{/branch}","tags_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/tags","blobs_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/git/refs{/sha}","trees_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/statuses/{sha}","languages_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/languages","stargazers_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/stargazers","contributors_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/contributors","subscribers_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/subscribers","subscription_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/subscription","commits_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/commits{/sha}","git_commits_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/git/commits{/sha}","comments_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/comments{/number}","issue_comment_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/issues/comments{/number}","contents_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/contents/{+path}","compare_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/merges","archive_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/downloads","issues_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/issues{/number}","pulls_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls{/number}","milestones_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/milestones{/number}","notifications_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/labels{/name}","releases_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/releases{/id}","created_at":"2014-10-20T19:40:11Z","updated_at":"2015-06-23T07:30:26Z","pushed_at":"2015-08-27T08:36:40Z","git_url":"git://github.com/dice-cyfronet/atmosphere.git","ssh_url":"git@github.com:dice-cyfronet/atmosphere.git","clone_url":"https://github.com/dice-cyfronet/atmosphere.git","svn_url":"https://github.com/dice-cyfronet/atmosphere","homepage":null,"size":10586,"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":33,"forks":0,"open_issues":33,"watchers":3,"default_branch":"master"}},"base":{"label":"dice-cyfronet:master","ref":"master","sha":"4b65a8f869e7466a36b4bf56af86b715a7237796","user":{"login":"dice-cyfronet","id":1628782,"avatar_url":"https://avatars.githubusercontent.com/u/1628782?v=3","gravatar_id":"","url":"https://api.github.com/users/dice-cyfronet","html_url":"https://github.com/dice-cyfronet","followers_url":"https://api.github.com/users/dice-cyfronet/followers","following_url":"https://api.github.com/users/dice-cyfronet/following{/other_user}","gists_url":"https://api.github.com/users/dice-cyfronet/gists{/gist_id}","starred_url":"https://api.github.com/users/dice-cyfronet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dice-cyfronet/subscriptions","organizations_url":"https://api.github.com/users/dice-cyfronet/orgs","repos_url":"https://api.github.com/users/dice-cyfronet/repos","events_url":"https://api.github.com/users/dice-cyfronet/events{/privacy}","received_events_url":"https://api.github.com/users/dice-cyfronet/received_events","type":"Organization","site_admin":false},"repo":{"id":25483417,"name":"atmosphere","full_name":"dice-cyfronet/atmosphere","owner":{"login":"dice-cyfronet","id":1628782,"avatar_url":"https://avatars.githubusercontent.com/u/1628782?v=3","gravatar_id":"","url":"https://api.github.com/users/dice-cyfronet","html_url":"https://github.com/dice-cyfronet","followers_url":"https://api.github.com/users/dice-cyfronet/followers","following_url":"https://api.github.com/users/dice-cyfronet/following{/other_user}","gists_url":"https://api.github.com/users/dice-cyfronet/gists{/gist_id}","starred_url":"https://api.github.com/users/dice-cyfronet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dice-cyfronet/subscriptions","organizations_url":"https://api.github.com/users/dice-cyfronet/orgs","repos_url":"https://api.github.com/users/dice-cyfronet/repos","events_url":"https://api.github.com/users/dice-cyfronet/events{/privacy}","received_events_url":"https://api.github.com/users/dice-cyfronet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dice-cyfronet/atmosphere","description":"Atmosphere cloud platform","fork":false,"url":"https://api.github.com/repos/dice-cyfronet/atmosphere","forks_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/forks","keys_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/teams","hooks_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/hooks","issue_events_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/issues/events{/number}","events_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/events","assignees_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/assignees{/user}","branches_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/branches{/branch}","tags_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/tags","blobs_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/git/refs{/sha}","trees_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/statuses/{sha}","languages_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/languages","stargazers_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/stargazers","contributors_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/contributors","subscribers_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/subscribers","subscription_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/subscription","commits_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/commits{/sha}","git_commits_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/git/commits{/sha}","comments_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/comments{/number}","issue_comment_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/issues/comments{/number}","contents_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/contents/{+path}","compare_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/merges","archive_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/downloads","issues_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/issues{/number}","pulls_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls{/number}","milestones_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/milestones{/number}","notifications_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/labels{/name}","releases_url":"https://api.github.com/repos/dice-cyfronet/atmosphere/releases{/id}","created_at":"2014-10-20T19:40:11Z","updated_at":"2015-06-23T07:30:26Z","pushed_at":"2015-08-27T08:36:40Z","git_url":"git://github.com/dice-cyfronet/atmosphere.git","ssh_url":"git@github.com:dice-cyfronet/atmosphere.git","clone_url":"https://github.com/dice-cyfronet/atmosphere.git","svn_url":"https://github.com/dice-cyfronet/atmosphere","homepage":null,"size":10586,"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":33,"forks":0,"open_issues":33,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls/242"},"html":{"href":"https://github.com/dice-cyfronet/atmosphere/pull/242"},"issue":{"href":"https://api.github.com/repos/dice-cyfronet/atmosphere/issues/242"},"comments":{"href":"https://api.github.com/repos/dice-cyfronet/atmosphere/issues/242/comments"},"review_comments":{"href":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls/242/comments"},"review_comment":{"href":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dice-cyfronet/atmosphere/pulls/242/commits"},"statuses":{"href":"https://api.github.com/repos/dice-cyfronet/atmosphere/statuses/f51ede90635c6edd5b00fb0e0c0e35f78b7fbc0f"}}}}