Skip to content

Commit

Permalink
Remove implementation for updating tickets
Browse files Browse the repository at this point in the history
* Redmine API doesn't support this behaviour through journals, just creation, as far as I research
  • Loading branch information
cored committed Jul 4, 2012
1 parent 872e0c1 commit 4a2166d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
19 changes: 10 additions & 9 deletions lib/provider/comment.rb
Expand Up @@ -24,15 +24,7 @@ def initialize(ticket_id, *object)
end end


def save def save
issue = API.find(ticket_id) raise TaskMapper::Exception.new "Redmine API doesn't support comment updates"
journal = issue.journals.find { |jou| jou.id.to_i == id.to_i }
journal.notes = body
issue.journals.inject([]) do |arr, jour|
arr << jour unless jour.id == journal.id
arr
end
issue.journals << journal
issue.save
end end


def self.find_by_id(project_id, ticket_id, id) def self.find_by_id(project_id, ticket_id, id)
Expand Down Expand Up @@ -63,5 +55,14 @@ def self.create_journal_for_issue(attributes)
journal journal
end end
end end

class Net::HTTP
def send(*args)
puts "request: #{args.inspect}"
resp = super
puts "response: #{resp.inspect}"
resp
end
end
end end
end end
4 changes: 2 additions & 2 deletions spec/comments_spec.rb
Expand Up @@ -79,8 +79,8 @@
context "when #save" do context "when #save" do
let(:comment) { ticket.comment(comment_id) } let(:comment) { ticket.comment(comment_id) }
let(:changed_comment) { comment.body = 'change'; comment } let(:changed_comment) { comment.body = 'change'; comment }
subject { changed_comment.save } subject { lambda { changed_comment.save } }
it { should be_true } it { should raise_error "Redmine API doesn't support comment updates" }
end end
end end
end end

0 comments on commit 4a2166d

Please sign in to comment.