Skip to content

Commit

Permalink
Implemented deleting tickets feature
Browse files Browse the repository at this point in the history
  • Loading branch information
klcompt committed Mar 3, 2012
1 parent 2131fc0 commit 1f56b0a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/tickets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ def update
end
end

def destroy
@ticket.destroy
flash[:notice] = "Ticket has been deleted."
redirect_to @project
end

private

def find_project
Expand Down
2 changes: 2 additions & 0 deletions app/views/tickets/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div id='ticket'>
<h2><%= @ticket.title %></h2>
<%= link_to "Edit Ticket", [:edit, @project, @ticket] %>
<%= link_to "Delete Ticket", [@project, @ticket], :method => :delete,
:confirm => "Are you sure you want to delete this ticket?" %>
<%= simple_format(@ticket.description) %>
</div>
16 changes: 16 additions & 0 deletions features/deleting_tickets.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Feature: Deleting tickets
In order to remove tickets
As a user I want to press a button and make them disappear
Background:
Given there is a project called "TextMate 2"
And that project has a ticket:
| title | description |
| Make it shiny! | Gradients! Starbursts! Oh my! |
Given I am on the homepage
When I follow "TextMate 2"
And I follow "Make it shiny!"

Scenario: Deleting a ticket
When I follow "Delete Ticket"
Then I should see "Ticket has been deleted."
And I should be on the project page for "TextMate 2"

0 comments on commit 1f56b0a

Please sign in to comment.