{"action":"created","comment":{"url":"https://api.github.com/repos/my-codeworks/fortnox-api/pulls/comments/56639421","id":56639421,"diff_hunk":"@@ -1,85 +1,16 @@\n require 'spec_helper'\n-require 'fortnox/api/repositories/context'\n+require 'fortnox/api/repositories/contexts/environment'\n require 'fortnox/api/repositories/customer'\n-require 'fortnox/api/models/customer'\n+require 'fortnox/api/repositories/examples/all'\n+require 'fortnox/api/repositories/examples/find'\n+require 'fortnox/api/repositories/examples/save'\n \n describe Fortnox::API::Repository::Customer do\n-  include_context 'repository context'\n+  include_context 'environment'\n \n-  subject{ described_class.new }\n+  include_examples '.all'\n \n-  it_behaves_like 'repositories', Fortnox::API::Model::Customer\n+  include_examples '.find'\n \n-  let( :find_id ){ 1 }\n-  let( :find_customer_1 ) do\n-    VCR.use_cassette( 'customers/find_id_1' ){ subject.find( find_id ) }\n-  end\n-\n-  describe '.all' do\n-    let(:response) do\n-      VCR.use_cassette( 'customers/all' ){ subject.all }\n-    end\n-\n-    specify 'returns correct number of records' do\n-      expect( response.size ).to be 1\n-    end\n-\n-    specify 'returns correct class' do\n-      expect( response.first.class ).to be Fortnox::API::Model::Customer\n-    end\n-  end\n-\n-  describe '.find' do\n-    specify 'returns correct class' do\n-      expect( find_customer_1.class ).to be Fortnox::API::Model::Customer\n-    end\n-\n-    specify 'returns correct Customer' do\n-      expect( find_customer_1.customer_number.to_i ).to eq( find_id )\n-    end\n-\n-    specify 'returned Customer is marked as saved' do\n-      expect( find_customer_1 ).to be_saved\n-    end\n-\n-    specify 'returned Customer is not markes as new' do\n-      expect( find_customer_1 ).to_not be_new\n-    end\n-  end\n-\n-  describe '.save' do\n-    shared_examples_for 'save' do |attribute|\n-      specify \"include updated #{attribute.inspect}\" do\n-        send_request\n-        expect( response['Customer'][attribute] ).to eql( updated_attribute )\n-      end\n-    end\n-\n-    describe 'new' do\n-      include_examples 'save', 'Name' do\n-        let( :updated_attribute ){ 'A customer' }\n-        let( :model ) do\n-          Fortnox::API::Model::Customer.new( name: updated_attribute )\n-        end\n-\n-        let( :send_request ) do\n-          VCR.use_cassette( 'customers/save_new' ){ subject.save( model ) }\n-        end\n-\n-        let( :response ){ send_request }\n-      end\n-    end\n-\n-    describe 'old (update existing)' do\n-      include_examples 'save', 'Name' do\n-        let( :updated_attribute ){ 'Updated customer' }\n-        let( :model ){ find_customer_1.update( name: updated_attribute ) }\n-\n-        let( :send_request ) do\n-          VCR.use_cassette( 'customers/save_old' ){ subject.save( model ) }\n-        end\n-        let( :response ){ send_request }\n-      end\n-    end\n-  end\n+  include_examples '.save', :name, {}","path":"spec/fortnox/api/repositories/customer_spec.rb","position":92,"original_position":92,"commit_id":"b4fbf5bbb4a3a7502026153cf9c2a0af8777b174","original_commit_id":"b4fbf5bbb4a3a7502026153cf9c2a0af8777b174","user":{"login":"d-Pixie","id":1247102,"avatar_url":"https://avatars.githubusercontent.com/u/1247102?v=3","gravatar_id":"","url":"https://api.github.com/users/d-Pixie","html_url":"https://github.com/d-Pixie","followers_url":"https://api.github.com/users/d-Pixie/followers","following_url":"https://api.github.com/users/d-Pixie/following{/other_user}","gists_url":"https://api.github.com/users/d-Pixie/gists{/gist_id}","starred_url":"https://api.github.com/users/d-Pixie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d-Pixie/subscriptions","organizations_url":"https://api.github.com/users/d-Pixie/orgs","repos_url":"https://api.github.com/users/d-Pixie/repos","events_url":"https://api.github.com/users/d-Pixie/events{/privacy}","received_events_url":"https://api.github.com/users/d-Pixie/received_events","type":"User","site_admin":false},"body":"Don't do this, see comment on the save example group.","created_at":"2016-03-18T10:48:37Z","updated_at":"2016-03-18T10:48:37Z","html_url":"https://github.com/my-codeworks/fortnox-api/pull/48#discussion_r56639421","pull_request_url":"https://api.github.com/repos/my-codeworks/fortnox-api/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/my-codeworks/fortnox-api/pulls/comments/56639421"},"html":{"href":"https://github.com/my-codeworks/fortnox-api/pull/48#discussion_r56639421"},"pull_request":{"href":"https://api.github.com/repos/my-codeworks/fortnox-api/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/my-codeworks/fortnox-api/pulls/48","id":63093208,"html_url":"https://github.com/my-codeworks/fortnox-api/pull/48","diff_url":"https://github.com/my-codeworks/fortnox-api/pull/48.diff","patch_url":"https://github.com/my-codeworks/fortnox-api/pull/48.patch","issue_url":"https://api.github.com/repos/my-codeworks/fortnox-api/issues/48","number":48,"state":"open","locked":false,"title":"Invoice repo spec","user":{"login":"ehannes","id":5365246,"avatar_url":"https://avatars.githubusercontent.com/u/5365246?v=3","gravatar_id":"","url":"https://api.github.com/users/ehannes","html_url":"https://github.com/ehannes","followers_url":"https://api.github.com/users/ehannes/followers","following_url":"https://api.github.com/users/ehannes/following{/other_user}","gists_url":"https://api.github.com/users/ehannes/gists{/gist_id}","starred_url":"https://api.github.com/users/ehannes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ehannes/subscriptions","organizations_url":"https://api.github.com/users/ehannes/orgs","repos_url":"https://api.github.com/users/ehannes/repos","events_url":"https://api.github.com/users/ehannes/events{/privacy}","received_events_url":"https://api.github.com/users/ehannes/received_events","type":"User","site_admin":false},"body":"An attempt to refactor the customer repository spec.\r\n\r\nThe customer repository has pretty good test coverage. The other repositories does not. This is an attempt to refactor the customer repository spec and extract tests to shared examples so all repositories can include these tests.\r\n\r\nThe first repository to include these shared examples, besides customer repository, is invoice repository.","created_at":"2016-03-16T16:21:45Z","updated_at":"2016-03-18T10:48:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"93e45d2d4407320170a424df1a6b02c4bec2e6f8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/my-codeworks/fortnox-api/pulls/48/commits","review_comments_url":"https://api.github.com/repos/my-codeworks/fortnox-api/pulls/48/comments","review_comment_url":"https://api.github.com/repos/my-codeworks/fortnox-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/my-codeworks/fortnox-api/issues/48/comments","statuses_url":"https://api.github.com/repos/my-codeworks/fortnox-api/statuses/b4fbf5bbb4a3a7502026153cf9c2a0af8777b174","head":{"label":"ehannes:invoice_repo_spec","ref":"invoice_repo_spec","sha":"b4fbf5bbb4a3a7502026153cf9c2a0af8777b174","user":{"login":"ehannes","id":5365246,"avatar_url":"https://avatars.githubusercontent.com/u/5365246?v=3","gravatar_id":"","url":"https://api.github.com/users/ehannes","html_url":"https://github.com/ehannes","followers_url":"https://api.github.com/users/ehannes/followers","following_url":"https://api.github.com/users/ehannes/following{/other_user}","gists_url":"https://api.github.com/users/ehannes/gists{/gist_id}","starred_url":"https://api.github.com/users/ehannes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ehannes/subscriptions","organizations_url":"https://api.github.com/users/ehannes/orgs","repos_url":"https://api.github.com/users/ehannes/repos","events_url":"https://api.github.com/users/ehannes/events{/privacy}","received_events_url":"https://api.github.com/users/ehannes/received_events","type":"User","site_admin":false},"repo":{"id":49967845,"name":"fortnox-api","full_name":"ehannes/fortnox-api","owner":{"login":"ehannes","id":5365246,"avatar_url":"https://avatars.githubusercontent.com/u/5365246?v=3","gravatar_id":"","url":"https://api.github.com/users/ehannes","html_url":"https://github.com/ehannes","followers_url":"https://api.github.com/users/ehannes/followers","following_url":"https://api.github.com/users/ehannes/following{/other_user}","gists_url":"https://api.github.com/users/ehannes/gists{/gist_id}","starred_url":"https://api.github.com/users/ehannes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ehannes/subscriptions","organizations_url":"https://api.github.com/users/ehannes/orgs","repos_url":"https://api.github.com/users/ehannes/repos","events_url":"https://api.github.com/users/ehannes/events{/privacy}","received_events_url":"https://api.github.com/users/ehannes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ehannes/fortnox-api","description":"Gem that abstracts Fortnox's F3 API","fork":true,"url":"https://api.github.com/repos/ehannes/fortnox-api","forks_url":"https://api.github.com/repos/ehannes/fortnox-api/forks","keys_url":"https://api.github.com/repos/ehannes/fortnox-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ehannes/fortnox-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ehannes/fortnox-api/teams","hooks_url":"https://api.github.com/repos/ehannes/fortnox-api/hooks","issue_events_url":"https://api.github.com/repos/ehannes/fortnox-api/issues/events{/number}","events_url":"https://api.github.com/repos/ehannes/fortnox-api/events","assignees_url":"https://api.github.com/repos/ehannes/fortnox-api/assignees{/user}","branches_url":"https://api.github.com/repos/ehannes/fortnox-api/branches{/branch}","tags_url":"https://api.github.com/repos/ehannes/fortnox-api/tags","blobs_url":"https://api.github.com/repos/ehannes/fortnox-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ehannes/fortnox-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ehannes/fortnox-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/ehannes/fortnox-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ehannes/fortnox-api/statuses/{sha}","languages_url":"https://api.github.com/repos/ehannes/fortnox-api/languages","stargazers_url":"https://api.github.com/repos/ehannes/fortnox-api/stargazers","contributors_url":"https://api.github.com/repos/ehannes/fortnox-api/contributors","subscribers_url":"https://api.github.com/repos/ehannes/fortnox-api/subscribers","subscription_url":"https://api.github.com/repos/ehannes/fortnox-api/subscription","commits_url":"https://api.github.com/repos/ehannes/fortnox-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/ehannes/fortnox-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/ehannes/fortnox-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/ehannes/fortnox-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/ehannes/fortnox-api/contents/{+path}","compare_url":"https://api.github.com/repos/ehannes/fortnox-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ehannes/fortnox-api/merges","archive_url":"https://api.github.com/repos/ehannes/fortnox-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ehannes/fortnox-api/downloads","issues_url":"https://api.github.com/repos/ehannes/fortnox-api/issues{/number}","pulls_url":"https://api.github.com/repos/ehannes/fortnox-api/pulls{/number}","milestones_url":"https://api.github.com/repos/ehannes/fortnox-api/milestones{/number}","notifications_url":"https://api.github.com/repos/ehannes/fortnox-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ehannes/fortnox-api/labels{/name}","releases_url":"https://api.github.com/repos/ehannes/fortnox-api/releases{/id}","deployments_url":"https://api.github.com/repos/ehannes/fortnox-api/deployments","created_at":"2016-01-19T16:54:16Z","updated_at":"2016-01-19T16:54:17Z","pushed_at":"2016-03-18T08:38:05Z","git_url":"git://github.com/ehannes/fortnox-api.git","ssh_url":"git@github.com:ehannes/fortnox-api.git","clone_url":"https://github.com/ehannes/fortnox-api.git","svn_url":"https://github.com/ehannes/fortnox-api","homepage":null,"size":293,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"my-codeworks:development","ref":"development","sha":"34af16265f3d574b104eb5a7842ecd2c677f8a5d","user":{"login":"my-codeworks","id":3019360,"avatar_url":"https://avatars.githubusercontent.com/u/3019360?v=3","gravatar_id":"","url":"https://api.github.com/users/my-codeworks","html_url":"https://github.com/my-codeworks","followers_url":"https://api.github.com/users/my-codeworks/followers","following_url":"https://api.github.com/users/my-codeworks/following{/other_user}","gists_url":"https://api.github.com/users/my-codeworks/gists{/gist_id}","starred_url":"https://api.github.com/users/my-codeworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/my-codeworks/subscriptions","organizations_url":"https://api.github.com/users/my-codeworks/orgs","repos_url":"https://api.github.com/users/my-codeworks/repos","events_url":"https://api.github.com/users/my-codeworks/events{/privacy}","received_events_url":"https://api.github.com/users/my-codeworks/received_events","type":"Organization","site_admin":false},"repo":{"id":17282331,"name":"fortnox-api","full_name":"my-codeworks/fortnox-api","owner":{"login":"my-codeworks","id":3019360,"avatar_url":"https://avatars.githubusercontent.com/u/3019360?v=3","gravatar_id":"","url":"https://api.github.com/users/my-codeworks","html_url":"https://github.com/my-codeworks","followers_url":"https://api.github.com/users/my-codeworks/followers","following_url":"https://api.github.com/users/my-codeworks/following{/other_user}","gists_url":"https://api.github.com/users/my-codeworks/gists{/gist_id}","starred_url":"https://api.github.com/users/my-codeworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/my-codeworks/subscriptions","organizations_url":"https://api.github.com/users/my-codeworks/orgs","repos_url":"https://api.github.com/users/my-codeworks/repos","events_url":"https://api.github.com/users/my-codeworks/events{/privacy}","received_events_url":"https://api.github.com/users/my-codeworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/my-codeworks/fortnox-api","description":"Gem that abstracts Fortnox's F3 API","fork":false,"url":"https://api.github.com/repos/my-codeworks/fortnox-api","forks_url":"https://api.github.com/repos/my-codeworks/fortnox-api/forks","keys_url":"https://api.github.com/repos/my-codeworks/fortnox-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/my-codeworks/fortnox-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/my-codeworks/fortnox-api/teams","hooks_url":"https://api.github.com/repos/my-codeworks/fortnox-api/hooks","issue_events_url":"https://api.github.com/repos/my-codeworks/fortnox-api/issues/events{/number}","events_url":"https://api.github.com/repos/my-codeworks/fortnox-api/events","assignees_url":"https://api.github.com/repos/my-codeworks/fortnox-api/assignees{/user}","branches_url":"https://api.github.com/repos/my-codeworks/fortnox-api/branches{/branch}","tags_url":"https://api.github.com/repos/my-codeworks/fortnox-api/tags","blobs_url":"https://api.github.com/repos/my-codeworks/fortnox-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/my-codeworks/fortnox-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/my-codeworks/fortnox-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/my-codeworks/fortnox-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/my-codeworks/fortnox-api/statuses/{sha}","languages_url":"https://api.github.com/repos/my-codeworks/fortnox-api/languages","stargazers_url":"https://api.github.com/repos/my-codeworks/fortnox-api/stargazers","contributors_url":"https://api.github.com/repos/my-codeworks/fortnox-api/contributors","subscribers_url":"https://api.github.com/repos/my-codeworks/fortnox-api/subscribers","subscription_url":"https://api.github.com/repos/my-codeworks/fortnox-api/subscription","commits_url":"https://api.github.com/repos/my-codeworks/fortnox-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/my-codeworks/fortnox-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/my-codeworks/fortnox-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/my-codeworks/fortnox-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/my-codeworks/fortnox-api/contents/{+path}","compare_url":"https://api.github.com/repos/my-codeworks/fortnox-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/my-codeworks/fortnox-api/merges","archive_url":"https://api.github.com/repos/my-codeworks/fortnox-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/my-codeworks/fortnox-api/downloads","issues_url":"https://api.github.com/repos/my-codeworks/fortnox-api/issues{/number}","pulls_url":"https://api.github.com/repos/my-codeworks/fortnox-api/pulls{/number}","milestones_url":"https://api.github.com/repos/my-codeworks/fortnox-api/milestones{/number}","notifications_url":"https://api.github.com/repos/my-codeworks/fortnox-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/my-codeworks/fortnox-api/labels{/name}","releases_url":"https://api.github.com/repos/my-codeworks/fortnox-api/releases{/id}","deployments_url":"https://api.github.com/repos/my-codeworks/fortnox-api/deployments","created_at":"2014-02-28T10:02:07Z","updated_at":"2016-01-31T12:11:22Z","pushed_at":"2016-03-18T08:38:06Z","git_url":"git://github.com/my-codeworks/fortnox-api.git","ssh_url":"git@github.com:my-codeworks/fortnox-api.git","clone_url":"https://github.com/my-codeworks/fortnox-api.git","svn_url":"https://github.com/my-codeworks/fortnox-api","homepage":null,"size":288,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":16,"forks":3,"open_issues":16,"watchers":4,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/my-codeworks/fortnox-api/pulls/48"},"html":{"href":"https://github.com/my-codeworks/fortnox-api/pull/48"},"issue":{"href":"https://api.github.com/repos/my-codeworks/fortnox-api/issues/48"},"comments":{"href":"https://api.github.com/repos/my-codeworks/fortnox-api/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/my-codeworks/fortnox-api/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/my-codeworks/fortnox-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/my-codeworks/fortnox-api/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/my-codeworks/fortnox-api/statuses/b4fbf5bbb4a3a7502026153cf9c2a0af8777b174"}}}}