From fcd8f24b6961f31d367d28755dc6c32205c7ea61 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Tue, 20 Jan 2009 12:55:56 -0800 Subject: [PATCH] Changed back_url so it's always set and added a test for it. #1916 --- app/controllers/rates_controller.rb | 3 ++- spec/controllers/rates_controller_spec.rb | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/rates_controller.rb b/app/controllers/rates_controller.rb index b782ccf..719cf33 100644 --- a/app/controllers/rates_controller.rb +++ b/app/controllers/rates_controller.rb @@ -5,7 +5,7 @@ class RatesController < ApplicationController before_filter :require_admin before_filter :require_user_id, :only => [:index, :new] - before_filter :set_back_url, :only => [:new, :edit] + before_filter :set_back_url ValidSortOptions = {'date_in_effect' => "#{Rate.table_name}.date_in_effect", 'project_id' => "#{Project.table_name}.name"} @@ -136,5 +136,6 @@ class RatesController < ApplicationController def set_back_url @back_url = params[:back_url] + @back_url end end diff --git a/spec/controllers/rates_controller_spec.rb b/spec/controllers/rates_controller_spec.rb index 1c3b79a..094775b 100644 --- a/spec/controllers/rates_controller_spec.rb +++ b/spec/controllers/rates_controller_spec.rb @@ -444,4 +444,10 @@ describe RatesController, "as an administrator" do end + describe "set_back_url (private)" do + it "should set the back_url based on the params" do + controller.params = { :back_url => '/back' } + controller.send(:set_back_url).should eql('/back') + end + end end