-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #427 from jcouball/issue_resolution
Add Issue#resolution relationship
- Loading branch information
Showing
14 changed files
with
155 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
require_relative 'status_category' | ||
|
||
module JIRA | ||
module Resource | ||
class StatusFactory < JIRA::BaseFactory # :nodoc: | ||
end | ||
|
||
class Status < JIRA::Base; end | ||
class Status < JIRA::Base | ||
has_one :status_category, class: JIRA::Resource::StatusCategory, attribute_key: 'statusCategory' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module JIRA | ||
module Resource | ||
class StatusCategoryFactory < JIRA::BaseFactory # :nodoc: | ||
end | ||
|
||
class StatusCategory < JIRA::Base; end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require 'spec_helper' | ||
|
||
describe JIRA::Resource::StatusCategory do | ||
with_each_client do |site_url, client| | ||
let(:client) { client } | ||
let(:site_url) { site_url } | ||
|
||
let(:key) { 1 } | ||
|
||
let(:expected_attributes) do | ||
JSON.parse(File.read('spec/mock_responses/statuscategory/1.json')) | ||
end | ||
|
||
let(:expected_collection_length) { 4 } | ||
|
||
it_should_behave_like 'a resource' | ||
it_should_behave_like 'a resource with a collection GET endpoint' | ||
it_should_behave_like 'a resource with a singular GET endpoint' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'spec_helper' | ||
|
||
describe JIRA::Resource::Status do | ||
|
||
let(:client) do | ||
client = double(options: { rest_base_path: '/jira/rest/api/2' }) | ||
allow(client).to receive(:Field).and_return(JIRA::Resource::FieldFactory.new(client)) | ||
allow(client).to receive(:cache).and_return(OpenStruct.new) | ||
client | ||
end | ||
|
||
describe '#status_category' do | ||
subject do | ||
JIRA::Resource::Status.new(client, attrs: JSON.parse(File.read('spec/mock_responses/status/1.json'))) | ||
end | ||
|
||
it 'has a status_category relationship' do | ||
expect(subject).to have_one(:status_category, JIRA::Resource::StatusCategory) | ||
expect(subject.status_category.name).to eq('To Do') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[ | ||
{ | ||
"self": "http://localhost:2990/jira/rest/api/2/statuscategory/1", | ||
"id": 1, | ||
"key": "undefined", | ||
"colorName": "medium-gray", | ||
"name": "No Category" | ||
}, | ||
{ | ||
"self": "http://localhost:2990/jira/rest/api/2/statuscategory/2", | ||
"id": 2, | ||
"key": "new", | ||
"colorName": "blue-gray", | ||
"name": "To Do" | ||
}, | ||
{ | ||
"self": "http://localhost:2990/jira/rest/api/2/statuscategory/4", | ||
"id": 4, | ||
"key": "indeterminate", | ||
"colorName": "yellow", | ||
"name": "In Progress" | ||
}, | ||
{ | ||
"self": "http://localhost:2990/jira/rest/api/2/statuscategory/3", | ||
"id": 3, | ||
"key": "done", | ||
"colorName": "green", | ||
"name": "Done" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"self": "http://localhost:2990/jira/rest/api/2/statuscategory/1", | ||
"id": 1, | ||
"key": "undefined", | ||
"colorName": "medium-gray", | ||
"name": "No Category" | ||
} |