Skip to content

Commit

Permalink
Adds Issue#issuetype has_one relationship
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Signal committed Jan 10, 2012
1 parent 02de744 commit 8dbb378
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/jira/resource/issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class Issue < Base
:nested_under => 'fields'
has_one :project, :nested_under => 'fields'

has_one :issuetype, :nested_under => 'fields'

def self.all(client)
response = client.get(client.options[:rest_base_path] + "/search")
json = parse_json(response.body)
Expand Down
5 changes: 5 additions & 0 deletions spec/jira/resource/issue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,9 @@
subject.project.foo.should == 'bar'
end

it "returns the issuetype" do
subject = JIRA::Resource::Issue.new(client, :attrs => {'fields' => {'issuetype' => {'foo' => 'bar'}}})
subject.issuetype.class.should == JIRA::Resource::Issuetype
subject.issuetype.foo.should == 'bar'
end
end

0 comments on commit 8dbb378

Please sign in to comment.