jira-ruby 1.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
 - data/.gitignore +3 -0
 - data/.travis.yml +5 -3
 - data/Gemfile +7 -1
 - data/Guardfile +1 -1
 - data/README.md +452 -0
 - data/Rakefile +6 -7
 - data/example.rb +23 -1
 - data/http-basic-example.rb +13 -12
 - data/jira-ruby.gemspec +13 -13
 - data/lib/jira/base.rb +53 -52
 - data/lib/jira/base_factory.rb +3 -6
 - data/lib/jira/client.rb +127 -30
 - data/lib/jira/has_many_proxy.rb +0 -1
 - data/lib/jira/http_client.rb +54 -16
 - data/lib/jira/http_error.rb +3 -5
 - data/lib/jira/jwt_client.rb +67 -0
 - data/lib/jira/oauth_client.rb +47 -17
 - data/lib/jira/request_client.rb +16 -5
 - data/lib/jira/resource/agile.rb +34 -9
 - data/lib/jira/resource/applinks.rb +5 -8
 - data/lib/jira/resource/attachment.rb +41 -3
 - data/lib/jira/resource/board.rb +91 -0
 - data/lib/jira/resource/board_configuration.rb +9 -0
 - data/lib/jira/resource/comment.rb +0 -2
 - data/lib/jira/resource/component.rb +1 -3
 - data/lib/jira/resource/createmeta.rb +12 -14
 - data/lib/jira/resource/field.rb +22 -22
 - data/lib/jira/resource/filter.rb +2 -2
 - data/lib/jira/resource/issue.rb +69 -38
 - data/lib/jira/resource/issue_picker_suggestions.rb +24 -0
 - data/lib/jira/resource/issue_picker_suggestions_issue.rb +10 -0
 - data/lib/jira/resource/issuelink.rb +3 -5
 - data/lib/jira/resource/issuelinktype.rb +0 -1
 - data/lib/jira/resource/issuetype.rb +1 -3
 - data/lib/jira/resource/priority.rb +1 -3
 - data/lib/jira/resource/project.rb +5 -7
 - data/lib/jira/resource/rapidview.rb +28 -7
 - data/lib/jira/resource/remotelink.rb +1 -4
 - data/lib/jira/resource/resolution.rb +2 -4
 - data/lib/jira/resource/serverinfo.rb +1 -2
 - data/lib/jira/resource/sprint.rb +86 -17
 - data/lib/jira/resource/sprint_report.rb +8 -0
 - data/lib/jira/resource/status.rb +1 -3
 - data/lib/jira/resource/suggested_issue.rb +9 -0
 - data/lib/jira/resource/transition.rb +2 -6
 - data/lib/jira/resource/user.rb +12 -2
 - data/lib/jira/resource/version.rb +1 -3
 - data/lib/jira/resource/watcher.rb +35 -0
 - data/lib/jira/resource/webhook.rb +3 -6
 - data/lib/jira/resource/worklog.rb +3 -5
 - data/lib/jira/version.rb +1 -1
 - data/lib/jira-ruby.rb +12 -2
 - data/lib/tasks/generate.rake +4 -4
 - data/spec/integration/attachment_spec.rb +17 -8
 - data/spec/integration/comment_spec.rb +31 -34
 - data/spec/integration/component_spec.rb +21 -24
 - data/spec/integration/field_spec.rb +15 -18
 - data/spec/integration/issue_spec.rb +45 -46
 - data/spec/integration/issuelinktype_spec.rb +8 -11
 - data/spec/integration/issuetype_spec.rb +5 -7
 - data/spec/integration/priority_spec.rb +5 -8
 - data/spec/integration/project_spec.rb +13 -20
 - data/spec/integration/rapidview_spec.rb +17 -10
 - data/spec/integration/resolution_spec.rb +7 -10
 - data/spec/integration/status_spec.rb +5 -8
 - data/spec/integration/transition_spec.rb +17 -20
 - data/spec/integration/user_spec.rb +24 -8
 - data/spec/integration/version_spec.rb +21 -25
 - data/spec/integration/watcher_spec.rb +62 -0
 - data/spec/integration/webhook.rb +8 -17
 - data/spec/integration/worklog_spec.rb +30 -34
 - data/spec/jira/base_factory_spec.rb +11 -12
 - data/spec/jira/base_spec.rb +216 -229
 - data/spec/jira/client_spec.rb +227 -159
 - data/spec/jira/has_many_proxy_spec.rb +11 -12
 - data/spec/jira/http_client_spec.rb +254 -31
 - data/spec/jira/http_error_spec.rb +7 -9
 - data/spec/jira/jwt_uri_builder_spec.rb +59 -0
 - data/spec/jira/oauth_client_spec.rb +110 -39
 - data/spec/jira/request_client_spec.rb +36 -9
 - data/spec/jira/resource/agile_spec.rb +135 -0
 - data/spec/jira/resource/attachment_spec.rb +127 -9
 - data/spec/jira/resource/board_spec.rb +224 -0
 - data/spec/jira/resource/createmeta_spec.rb +29 -32
 - data/spec/jira/resource/field_spec.rb +42 -48
 - data/spec/jira/resource/filter_spec.rb +40 -40
 - data/spec/jira/resource/issue_picker_suggestions_spec.rb +79 -0
 - data/spec/jira/resource/issue_spec.rb +88 -85
 - data/spec/jira/resource/issuelink_spec.rb +1 -1
 - data/spec/jira/resource/jira_picker_suggestions_issue_spec.rb +18 -0
 - data/spec/jira/resource/project_factory_spec.rb +2 -4
 - data/spec/jira/resource/project_spec.rb +33 -33
 - data/spec/jira/resource/sprint_spec.rb +90 -0
 - data/spec/jira/resource/user_factory_spec.rb +6 -8
 - data/spec/jira/resource/worklog_spec.rb +9 -11
 - data/spec/mock_responses/board/1.json +33 -0
 - data/spec/mock_responses/board/1_issues.json +62 -0
 - data/spec/mock_responses/empty_issues.json +8 -0
 - data/spec/mock_responses/issue/10002/watchers.json +13 -0
 - data/spec/mock_responses/issue.json +1 -1
 - data/spec/mock_responses/sprint/1_issues.json +125 -0
 - data/spec/spec_helper.rb +8 -9
 - data/spec/support/clients_helper.rb +4 -4
 - data/spec/support/shared_examples/integration.rb +60 -77
 - metadata +115 -55
 - data/.ruby-version +0 -1
 - data/README.rdoc +0 -333
 - /data/spec/mock_responses/{attachment → issue/10002/attachments}/10000.json +0 -0
 
| 
         @@ -0,0 +1,62 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe JIRA::Resource::Watcher do
         
     | 
| 
      
 4 
     | 
    
         
            +
              with_each_client do |site_url, client|
         
     | 
| 
      
 5 
     | 
    
         
            +
                let(:client) { client }
         
     | 
| 
      
 6 
     | 
    
         
            +
                let(:site_url) { site_url }
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                let(:target) { JIRA::Resource::Watcher.new(client, attrs: { 'id' => '99999' }, issue_id: '10002') }
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                let(:belongs_to) do
         
     | 
| 
      
 11 
     | 
    
         
            +
                  JIRA::Resource::Issue.new(client, attrs: {
         
     | 
| 
      
 12 
     | 
    
         
            +
                                              'id' => '10002',
         
     | 
| 
      
 13 
     | 
    
         
            +
                                              'fields' => {
         
     | 
| 
      
 14 
     | 
    
         
            +
                                                'comment' => { 'comments' => [] }
         
     | 
| 
      
 15 
     | 
    
         
            +
                                              }
         
     | 
| 
      
 16 
     | 
    
         
            +
                                            })
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                let(:expected_attributes) do
         
     | 
| 
      
 20 
     | 
    
         
            +
                  {
         
     | 
| 
      
 21 
     | 
    
         
            +
                    'self' => 'http://localhost:2990/jira/rest/api/2/issue/10002/watchers',
         
     | 
| 
      
 22 
     | 
    
         
            +
                    "isWatching": false,
         
     | 
| 
      
 23 
     | 
    
         
            +
                    "watchCount": 1,
         
     | 
| 
      
 24 
     | 
    
         
            +
                    "watchers": [
         
     | 
| 
      
 25 
     | 
    
         
            +
                      {
         
     | 
| 
      
 26 
     | 
    
         
            +
                        "self": 'http://www.example.com/jira/rest/api/2/user?username=admin',
         
     | 
| 
      
 27 
     | 
    
         
            +
                        "name": 'admin',
         
     | 
| 
      
 28 
     | 
    
         
            +
                        "displayName": 'admin',
         
     | 
| 
      
 29 
     | 
    
         
            +
                        "active": false
         
     | 
| 
      
 30 
     | 
    
         
            +
                      }
         
     | 
| 
      
 31 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 32 
     | 
    
         
            +
                  }
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                describe 'watchers' do
         
     | 
| 
      
 36 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 37 
     | 
    
         
            +
                    stub_request(:get, site_url + '/jira/rest/api/2/issue/10002')
         
     | 
| 
      
 38 
     | 
    
         
            +
                      .to_return(status: 200, body: get_mock_response('issue/10002.json'))
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                    stub_request(:get, site_url + '/jira/rest/api/2/issue/10002/watchers')
         
     | 
| 
      
 41 
     | 
    
         
            +
                      .to_return(status: 200, body: get_mock_response('issue/10002/watchers.json'))
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                    stub_request(:post, site_url + '/jira/rest/api/2/issue/10002/watchers')
         
     | 
| 
      
 44 
     | 
    
         
            +
                      .to_return(status: 204, body: nil)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  it 'should returns all the watchers' do
         
     | 
| 
      
 48 
     | 
    
         
            +
                    issue = client.Issue.find('10002')
         
     | 
| 
      
 49 
     | 
    
         
            +
                    watchers = client.Watcher.all(options = { issue: issue })
         
     | 
| 
      
 50 
     | 
    
         
            +
                    expect(watchers.length).to eq(1)
         
     | 
| 
      
 51 
     | 
    
         
            +
                  end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                  it 'should add a watcher' do
         
     | 
| 
      
 54 
     | 
    
         
            +
                    issue = client.Issue.find('10002')
         
     | 
| 
      
 55 
     | 
    
         
            +
                    watcher = JIRA::Resource::Watcher.new(client, issue: issue)
         
     | 
| 
      
 56 
     | 
    
         
            +
                    user_id = "tester"
         
     | 
| 
      
 57 
     | 
    
         
            +
                    watcher.save!(user_id)
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
              end
         
     | 
| 
      
 62 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/integration/webhook.rb
    CHANGED
    
    | 
         @@ -1,34 +1,25 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            describe JIRA::Resource::Webhook do
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
4 
     | 
    
         
             
              with_each_client do |site_url, client|
         
     | 
| 
       6 
5 
     | 
    
         
             
                let(:client) { client }
         
     | 
| 
       7 
6 
     | 
    
         
             
                let(:site_url) { site_url }
         
     | 
| 
       8 
7 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                let(:key) { "2" }
         
     | 
| 
      
 8 
     | 
    
         
            +
                let(:key) { '2' }
         
     | 
| 
       11 
9 
     | 
    
         | 
| 
       12 
10 
     | 
    
         
             
                let(:expected_attributes) do
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 11 
     | 
    
         
            +
                  { 'name' => 'from API', 'url' => 'http://localhost:3000/webhooks/1', 'excludeBody' => false, 'filters' => { 'issue-related-events-section' => '' }, 'events' => [], 'enabled' => true, 'self' => 'http://localhost:2990/jira/rest/webhooks/1.0/webhook/2', 'lastUpdatedUser' => 'admin', 'lastUpdatedDisplayName' => 'admin', 'lastUpdated' => 1_453_306_520_188 }
         
     | 
| 
       14 
12 
     | 
    
         
             
                end
         
     | 
| 
       15 
13 
     | 
    
         | 
| 
       16 
14 
     | 
    
         
             
                let(:expected_collection_length) { 1 }
         
     | 
| 
       17 
15 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                it_should_behave_like  
     | 
| 
       19 
     | 
    
         
            -
                it_should_behave_like  
     | 
| 
       20 
     | 
    
         
            -
                it_should_behave_like  
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                it "returns a collection of components" do
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                  stub_request(:get, site_url + described_class.singular_path(client, key)).
         
     | 
| 
       27 
     | 
    
         
            -
                    to_return(:status => 200, :body => get_mock_response('webhook/webhook.json'))
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                  
         
     | 
| 
      
 16 
     | 
    
         
            +
                it_should_behave_like 'a resource'
         
     | 
| 
      
 17 
     | 
    
         
            +
                it_should_behave_like 'a resource with a collection GET endpoint'
         
     | 
| 
      
 18 
     | 
    
         
            +
                it_should_behave_like 'a resource with a singular GET endpoint'
         
     | 
| 
       31 
19 
     | 
    
         | 
| 
      
 20 
     | 
    
         
            +
                it 'returns a collection of components' do
         
     | 
| 
      
 21 
     | 
    
         
            +
                  stub_request(:get, site_url + described_class.singular_path(client, key))
         
     | 
| 
      
 22 
     | 
    
         
            +
                    .to_return(status: 200, body: get_mock_response('webhook/webhook.json'))
         
     | 
| 
       32 
23 
     | 
    
         
             
                end
         
     | 
| 
       33 
24 
     | 
    
         
             
              end
         
     | 
| 
       34 
25 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,55 +1,51 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            describe JIRA::Resource::Worklog do
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
4 
     | 
    
         
             
              with_each_client do |site_url, client|
         
     | 
| 
       7 
5 
     | 
    
         
             
                let(:client) { client }
         
     | 
| 
       8 
6 
     | 
    
         
             
                let(:site_url) { site_url }
         
     | 
| 
       9 
7 
     | 
    
         | 
| 
      
 8 
     | 
    
         
            +
                let(:key) { '10000' }
         
     | 
| 
       10 
9 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                let(: 
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                let(:target) { JIRA::Resource::Worklog.new(client, :attrs => {'id' => '99999'}, :issue_id => '54321') }
         
     | 
| 
      
 10 
     | 
    
         
            +
                let(:target) { JIRA::Resource::Worklog.new(client, attrs: { 'id' => '99999' }, issue_id: '54321') }
         
     | 
| 
       14 
11 
     | 
    
         | 
| 
       15 
12 
     | 
    
         
             
                let(:expected_collection_length) { 3 }
         
     | 
| 
       16 
13 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
                let(:belongs_to)  
     | 
| 
       18 
     | 
    
         
            -
                  JIRA::Resource::Issue.new(client, : 
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                 
     | 
| 
      
 14 
     | 
    
         
            +
                let(:belongs_to) do
         
     | 
| 
      
 15 
     | 
    
         
            +
                  JIRA::Resource::Issue.new(client, attrs: {
         
     | 
| 
      
 16 
     | 
    
         
            +
                                              'id' => '10002', 'fields' => {
         
     | 
| 
      
 17 
     | 
    
         
            +
                                                'comment' => { 'comments' => [] }
         
     | 
| 
      
 18 
     | 
    
         
            +
                                              }
         
     | 
| 
      
 19 
     | 
    
         
            +
                                            })
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
       24 
21 
     | 
    
         | 
| 
       25 
22 
     | 
    
         
             
                let(:expected_attributes) do
         
     | 
| 
       26 
23 
     | 
    
         
             
                  {
         
     | 
| 
       27 
     | 
    
         
            -
                    'self' =>  
     | 
| 
      
 24 
     | 
    
         
            +
                    'self' => 'http://localhost:2990/jira/rest/api/2/issue/10002/worklog/10000',
         
     | 
| 
       28 
25 
     | 
    
         
             
                    'id'   => key,
         
     | 
| 
       29 
     | 
    
         
            -
                    'comment' =>  
     | 
| 
      
 26 
     | 
    
         
            +
                    'comment' => 'Some epic work.'
         
     | 
| 
       30 
27 
     | 
    
         
             
                  }
         
     | 
| 
       31 
28 
     | 
    
         
             
                end
         
     | 
| 
       32 
29 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
                let(:attributes_for_post)  
     | 
| 
       34 
     | 
    
         
            -
                  { 
     | 
| 
       35 
     | 
    
         
            -
                 
     | 
| 
       36 
     | 
    
         
            -
                let(:expected_attributes_from_post)  
     | 
| 
       37 
     | 
    
         
            -
                  {  
     | 
| 
       38 
     | 
    
         
            -
                 
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                let(:attributes_for_put)  
     | 
| 
       41 
     | 
    
         
            -
                  { 
     | 
| 
       42 
     | 
    
         
            -
                 
     | 
| 
       43 
     | 
    
         
            -
                let(:expected_attributes_from_put)  
     | 
| 
       44 
     | 
    
         
            -
                  {  
     | 
| 
       45 
     | 
    
         
            -
                 
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                it_should_behave_like "a resource"
         
     | 
| 
       48 
     | 
    
         
            -
                it_should_behave_like "a resource with a collection GET endpoint"
         
     | 
| 
       49 
     | 
    
         
            -
                it_should_behave_like "a resource with a singular GET endpoint"
         
     | 
| 
       50 
     | 
    
         
            -
                it_should_behave_like "a resource with a DELETE endpoint"
         
     | 
| 
       51 
     | 
    
         
            -
                it_should_behave_like "a resource with a POST endpoint"
         
     | 
| 
       52 
     | 
    
         
            -
                it_should_behave_like "a resource with a PUT endpoint"
         
     | 
| 
      
 30 
     | 
    
         
            +
                let(:attributes_for_post) do
         
     | 
| 
      
 31 
     | 
    
         
            +
                  { 'timeSpent' => '2d' }
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
                let(:expected_attributes_from_post) do
         
     | 
| 
      
 34 
     | 
    
         
            +
                  { 'id' => '10001', 'timeSpent' => '2d' }
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                let(:attributes_for_put) do
         
     | 
| 
      
 38 
     | 
    
         
            +
                  { 'timeSpent' => '2d' }
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
                let(:expected_attributes_from_put) do
         
     | 
| 
      
 41 
     | 
    
         
            +
                  { 'id' => '10001', 'timeSpent' => '4d' }
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
       53 
43 
     | 
    
         | 
| 
      
 44 
     | 
    
         
            +
                it_should_behave_like 'a resource'
         
     | 
| 
      
 45 
     | 
    
         
            +
                it_should_behave_like 'a resource with a collection GET endpoint'
         
     | 
| 
      
 46 
     | 
    
         
            +
                it_should_behave_like 'a resource with a singular GET endpoint'
         
     | 
| 
      
 47 
     | 
    
         
            +
                it_should_behave_like 'a resource with a DELETE endpoint'
         
     | 
| 
      
 48 
     | 
    
         
            +
                it_should_behave_like 'a resource with a POST endpoint'
         
     | 
| 
      
 49 
     | 
    
         
            +
                it_should_behave_like 'a resource with a PUT endpoint'
         
     | 
| 
       54 
50 
     | 
    
         
             
              end
         
     | 
| 
       55 
51 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,45 +1,44 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            describe JIRA::BaseFactory do
         
     | 
| 
      
 4 
     | 
    
         
            +
              class JIRA::Resource::FooFactory < JIRA::BaseFactory; end
         
     | 
| 
      
 5 
     | 
    
         
            +
              class JIRA::Resource::Foo; end
         
     | 
| 
       4 
6 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
               
     | 
| 
       6 
     | 
    
         
            -
              class JIRA::Resource::Foo ; end
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
              let(:client)  { double() }
         
     | 
| 
      
 7 
     | 
    
         
            +
              let(:client)  { double }
         
     | 
| 
       9 
8 
     | 
    
         
             
              subject       { JIRA::Resource::FooFactory.new(client) }
         
     | 
| 
       10 
9 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
              it  
     | 
| 
      
 10 
     | 
    
         
            +
              it 'initializes correctly' do
         
     | 
| 
       12 
11 
     | 
    
         
             
                expect(subject.class).to        eq(JIRA::Resource::FooFactory)
         
     | 
| 
       13 
12 
     | 
    
         
             
                expect(subject.client).to       eq(client)
         
     | 
| 
       14 
13 
     | 
    
         
             
                expect(subject.target_class).to eq(JIRA::Resource::Foo)
         
     | 
| 
       15 
14 
     | 
    
         
             
              end
         
     | 
| 
       16 
15 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
              it  
     | 
| 
      
 16 
     | 
    
         
            +
              it 'proxies all to the target class' do
         
     | 
| 
       18 
17 
     | 
    
         
             
                expect(JIRA::Resource::Foo).to receive(:all).with(client)
         
     | 
| 
       19 
18 
     | 
    
         
             
                subject.all
         
     | 
| 
       20 
19 
     | 
    
         
             
              end
         
     | 
| 
       21 
20 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
              it  
     | 
| 
      
 21 
     | 
    
         
            +
              it 'proxies find to the target class' do
         
     | 
| 
       23 
22 
     | 
    
         
             
                expect(JIRA::Resource::Foo).to receive(:find).with(client, 'FOO')
         
     | 
| 
       24 
23 
     | 
    
         
             
                subject.find('FOO')
         
     | 
| 
       25 
24 
     | 
    
         
             
              end
         
     | 
| 
       26 
25 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
              it  
     | 
| 
      
 26 
     | 
    
         
            +
              it 'returns the target class' do
         
     | 
| 
       28 
27 
     | 
    
         
             
                expect(subject.target_class).to eq(JIRA::Resource::Foo)
         
     | 
| 
       29 
28 
     | 
    
         
             
              end
         
     | 
| 
       30 
29 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
              it  
     | 
| 
       32 
     | 
    
         
            -
                attrs = double 
     | 
| 
      
 30 
     | 
    
         
            +
              it 'proxies build to the target class' do
         
     | 
| 
      
 31 
     | 
    
         
            +
                attrs = double
         
     | 
| 
       33 
32 
     | 
    
         
             
                expect(JIRA::Resource::Foo).to receive(:build).with(client, attrs)
         
     | 
| 
       34 
33 
     | 
    
         
             
                subject.build(attrs)
         
     | 
| 
       35 
34 
     | 
    
         
             
              end
         
     | 
| 
       36 
35 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
              it  
     | 
| 
      
 36 
     | 
    
         
            +
              it 'proxies collection path to the target class' do
         
     | 
| 
       38 
37 
     | 
    
         
             
                expect(JIRA::Resource::Foo).to receive(:collection_path).with(client)
         
     | 
| 
       39 
38 
     | 
    
         
             
                subject.collection_path
         
     | 
| 
       40 
39 
     | 
    
         
             
              end
         
     | 
| 
       41 
40 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
              it  
     | 
| 
      
 41 
     | 
    
         
            +
              it 'proxies singular path to the target class' do
         
     | 
| 
       43 
42 
     | 
    
         
             
                expect(JIRA::Resource::Foo).to receive(:singular_path).with(client, 'FOO')
         
     | 
| 
       44 
43 
     | 
    
         
             
                subject.singular_path('FOO')
         
     | 
| 
       45 
44 
     | 
    
         
             
              end
         
     |