Skip to content
This repository has been archived by the owner on Jul 4, 2018. It is now read-only.

Commit

Permalink
[#2] assign pivotal story if starting it.
Browse files Browse the repository at this point in the history
  • Loading branch information
alemata committed May 29, 2015
1 parent 233a2f9 commit 90abc40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/assisted_workflow/addons/pivotal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ def start_story(story, options = {})
log "starting story ##{story.id}"
options.delete(:estimate) if options[:estimate].nil?
update_story!(story, options.merge(:current_state => "started"))

owner_ids = story.owner_ids
if owner_ids.empty? || !owner_ids.include?(@client.me.id)
log "assigning story ##{story.id}"
update_story!(story, :owner_ids => owner_ids.dup << @client.me.id)
end
end

def finish_story(story, options = {})
Expand Down
2 changes: 1 addition & 1 deletion spec/assisted_workflow/addons/pivotal_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
stub(TrackerApi::Client).new{ @client }
@project = TrackerApi::Resources::Project.new(client: @client, id: 1)
stub(@client).project(@configuration["project_id"]){ @project }
stub(@client).me{ TrackerApi::Resources::Me.new }

@pivotal = AssistedWorkflow::Addons::Pivotal.new(nil, @configuration)
end
Expand Down Expand Up @@ -66,7 +67,6 @@
story_stub(:id => "100002", :project_id => @project.id)
]
end
stub(@client).me{ TrackerApi::Resources::Me.new }

stories = @pivotal.pending_stories(:include_started => true)
stories.size.must_equal 2
Expand Down

0 comments on commit 90abc40

Please sign in to comment.