When deleting an aspect from contacts page do not redirect to aspects page

This commit is contained in:
Gonzalo Rodriguez 2011-08-27 19:24:21 -03:00
parent 5b51dde195
commit b048d1dd54
2 changed files with 16 additions and 1 deletions

View file

@ -98,9 +98,12 @@ class AspectsController < ApplicationController
begin
@aspect.destroy
flash[:notice] = I18n.t 'aspects.destroy.success', :name => @aspect.name
redirect_to aspects_path
rescue ActiveRecord::StatementInvalid => e
flash[:error] = I18n.t 'aspects.destroy.failure', :name => @aspect.name
end
if request.referer.include?('contacts')
redirect_to contacts_path
else
redirect_to aspects_path
end
end

View file

@ -19,6 +19,18 @@ Feature: User manages contacts
And I press "Create" in the modal window
Then I should see "losers" within "#aspect_nav"
Scenario: deleting an aspect from contacts index
Given I am signed in
And I have an aspect called "People"
When I am on the contacts page
And I follow "People"
And I follow "Edit People"
And I wait for the ajax to finish
And I click ok in the confirm dialog to appear next
And I press "Delete" in the modal window
Then I should be on the contacts page
And I should not see "People" within "#aspect_nav"
Scenario: Editing the aspect memberships of a contact from the aspect edit facebox
Given I am signed in
And I have 2 contacts