diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 6887e4bee6abd84d60dffb2f58638ac472de9e37..ec1d9cb2e264d10b3c717e91e9006fd4a1f81a2d 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -24,7 +24,7 @@ class AspectsController < ApplicationController respond_with @aspect else flash[:error] = I18n.t('aspects.create.failure') - redirect_to aspects_manage_path + redirect_to :back end end diff --git a/spec/controllers/aspects_controller_spec.rb b/spec/controllers/aspects_controller_spec.rb index 7635bbfc1e98153588981ca8ca5fa47d8a5d33c9..9793a81e99b50a745cb30689532a4879a790d4e6 100644 --- a/spec/controllers/aspects_controller_spec.rb +++ b/spec/controllers/aspects_controller_spec.rb @@ -16,6 +16,7 @@ describe AspectsController do friend_users(@user,@aspect, @user2, @aspect2) @contact = @user.contact_for(@user2.person) sign_in :user, @user + request.env["HTTP_REFERER"] = 'http://' + request.host end describe "#index" do @@ -44,9 +45,9 @@ describe AspectsController do post :create, "aspect" => {"name" => ""} @user.reload.aspects.count.should == 2 end - it "goes back to manage aspects" do + it "goes back to the page you came from" do post :create, "aspect" => {"name" => ""} - response.should redirect_to(aspects_manage_path) + response.should redirect_to(:back) end end end