Permalink
Browse files

Implemented deleting tickets feature

  • Loading branch information...
1 parent 85f527a commit a17efca3f0c6151ca58e9b9001b0a3907c4f60a3 @wycats committed May 13, 2011
Showing with 26 additions and 0 deletions.
  1. +5 −0 app/controllers/tickets_controller.rb
  2. +2 −0 app/views/tickets/show.html.erb
  3. +19 −0 features/deleting_tickets.feature
@@ -35,6 +35,11 @@ def update
end
end
+ def destroy
+ @ticket.destroy
+ redirect_to @project, :notice => "Ticket has been deleted."
+ end
+
private
def find_project
@project = Project.find(params[:project_id])
@@ -1,6 +1,8 @@
<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>
@@ -0,0 +1,19 @@
+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 a17efca

Please sign in to comment.