Skip to content

Commit

Permalink
priority is copied around when starting or fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Mar 5, 2010
1 parent 3297447 commit f0ccaff
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 21 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
@@ -1,3 +1,7 @@
Fri Mar 5 08:59:37 2010 Aaron Patterson <aaron@tenderlovemaking.com>

* Priority is copied around when starting or fixing.

Thu Mar 4 09:24:46 2010 Aaron Patterson <aaron@tenderlovemaking.com>

* Description is no longer required to create a ticket
Expand Down
1 change: 1 addition & 0 deletions lib/geera/client.rb
Expand Up @@ -47,6 +47,7 @@ def create_ticket params
issue.description = params[:description]
issue.assignee = params[:assignee] || @username
issue.type = '1' #FIXME: wtf is this for?
issue.priority = '5'
issue = @ctx.createIssue issue
ticket issue.key
end
Expand Down
18 changes: 12 additions & 6 deletions lib/geera/ticket.rb
Expand Up @@ -35,9 +35,12 @@ def startable?
# Start this ticket.
def start!
action = available_actions.find { |x| x.name == 'Start' }
assign = Jira4R::V2::RemoteFieldValue.new('assignee', @client.username)
desc = Jira4R::V2::RemoteFieldValue.new('description', description)
@ctx.progressWorkflowAction(@number, action.id, [assign, desc])

assign = Jira4R::V2::RemoteFieldValue.new('assignee', @client.username)
desc = Jira4R::V2::RemoteFieldValue.new('description', description)
priority = Jira4R::V2::RemoteFieldValue.new('priority', issue.priority)

@ctx.progressWorkflowAction(@number, action.id, [assign, desc, priority])
end

###
Expand All @@ -50,9 +53,12 @@ def fixable?
# Fix this ticket.
def fix!
action = available_actions.find { |x| x.name == 'Fix' }
assign = Jira4R::V2::RemoteFieldValue.new('assignee', @client.username)
desc = Jira4R::V2::RemoteFieldValue.new('description', description)
@ctx.progressWorkflowAction(@number, action.id, [assign, desc])

assign = Jira4R::V2::RemoteFieldValue.new('assignee', @client.username)
desc = Jira4R::V2::RemoteFieldValue.new('description', description)
priority = Jira4R::V2::RemoteFieldValue.new('priority', issue.priority)

@ctx.progressWorkflowAction(@number, action.id, [assign, desc, priority])
end

###
Expand Down
35 changes: 20 additions & 15 deletions test/test_client.rb
Expand Up @@ -19,7 +19,7 @@ def method_missing *args
end

class TestClient < Test::Unit::TestCase
FakeIssue = Struct.new(:description, :key)
FakeIssue = Struct.new(:description, :key, :priority)

def setup
@url = 'some_url'
Expand Down Expand Up @@ -96,7 +96,7 @@ def test_start!
]

@fj.returns[:getAvailableActions] = actions
@fj.returns[:getIssue] = FakeIssue.new('desc')
@fj.returns[:getIssue] = FakeIssue.new('desc', nil, '5')
@ticket.start!

last_call = @fj.call_stack.pop
Expand All @@ -106,12 +106,15 @@ def test_start!

assert_instance_of(Array, last_call.last)

rfv = last_call.last.first
assert_equal 'assignee', rfv.id
assert_equal @username, rfv.values
rfv = last_call.last.last
assert_equal 'description', rfv.id
assert_equal 'desc', rfv.values
params = last_call.last
assert_equal 'assignee', params.first.id
assert_equal @username, params.first.values

assert_equal 'description', params[1].id
assert_equal 'desc', params[1].values

assert_equal 'priority', params[2].id
assert_equal '5', params[2].values
end

def test_fixable?
Expand Down Expand Up @@ -141,7 +144,7 @@ def test_fix!
]

@fj.returns[:getAvailableActions] = actions
@fj.returns[:getIssue] = FakeIssue.new('desc')
@fj.returns[:getIssue] = FakeIssue.new('desc', nil, '5')
@ticket.fix!

last_call = @fj.call_stack.pop
Expand All @@ -151,13 +154,15 @@ def test_fix!

assert_instance_of(Array, last_call.last)

rfv = last_call.last.first
assert_equal 'assignee', rfv.id
assert_equal @username, rfv.values
params = last_call.last
assert_equal 'assignee', params.first.id
assert_equal @username, params.first.values

assert_equal 'description', params[1].id
assert_equal 'desc', params[1].values

rfv = last_call.last.last
assert_equal 'description', rfv.id
assert_equal 'desc', rfv.values
assert_equal 'priority', params[2].id
assert_equal '5', params[2].values
end

def test_assign_to
Expand Down

0 comments on commit f0ccaff

Please sign in to comment.