From 48b1de6dfdbd44708937e000e9768a2c130d3f27 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Sun, 11 Dec 2011 22:57:09 -0200 Subject: [PATCH] Remove warnings in functional tests --- app/controllers/my_profile/tasks_controller.rb | 4 +++- test/functional/catalog_controller_test.rb | 2 +- test/functional/cms_controller_test.rb | 6 +++--- test/functional/mailconf_controller_test.rb | 2 +- test/functional/manage_products_controller_test.rb | 6 +++--- test/functional/profile_controller_test.rb | 2 +- test/functional/tasks_controller_test.rb | 4 ++++ test/functional/themes_controller_test.rb | 2 +- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/controllers/my_profile/tasks_controller.rb b/app/controllers/my_profile/tasks_controller.rb index 496a5b7..a2fb611 100644 --- a/app/controllers/my_profile/tasks_controller.rb +++ b/app/controllers/my_profile/tasks_controller.rb @@ -33,12 +33,14 @@ class TasksController < MyProfileController end end + url = { :action => 'index' } if failed.blank? session[:notice] = _("All decisions were applied successfully.") else session[:notice] = _("Some decisions couldn't be applied.") + url[:failed] = failed end - redirect_to params.merge!(:action => 'index', :failed => failed) + redirect_to url end def new diff --git a/test/functional/catalog_controller_test.rb b/test/functional/catalog_controller_test.rb index 0658260..5f600cd 100644 --- a/test/functional/catalog_controller_test.rb +++ b/test/functional/catalog_controller_test.rb @@ -26,7 +26,7 @@ class CatalogControllerTest < ActionController::TestCase should 'not display for non-enterprises' do u = create_user('testinguser').person get :index, :profile => 'testinguser' - assert_redirected_to :controller => "profile", :profile => 'testinguser' + assert_redirected_to :controller => "profile", :profile => 'testinguser', :action => 'index' end should 'display for enterprises' do diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb index 22a940b..4bc8bbe 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -202,7 +202,7 @@ class CmsControllerTest < ActionController::TestCase assert_difference Article, :count, -1 do post :destroy, :profile => profile.identifier, :id => a.id - assert_redirected_to :action => 'index' + assert_redirected_to :controller => 'cms', :profile => profile.identifier, :action => 'index' end end @@ -959,7 +959,7 @@ class CmsControllerTest < ActionController::TestCase post :upload_files, :profile => profile.identifier, :parent_id => folder.id, :back_to => @request.referer, :uploaded_files => [fixture_file_upload('files/rails.png', 'image/png')] assert_template nil - assert_redirected_to folder.view_url + assert_redirected_to 'http://localhost/testinguser/test-folder' end should 'record when coming from public view on edit files with view true' do @@ -1416,7 +1416,7 @@ class CmsControllerTest < ActionController::TestCase should 'update file and be redirect to cms' do file = UploadedFile.create!(:profile => @profile, :uploaded_data => fixture_file_upload('files/test.txt', 'text/plain')) post :edit, :profile => @profile.identifier, :id => file.id, :article => { } - assert_redirected_to :action => 'index' + assert_redirected_to :controller => 'cms', :profile => profile.identifier, :action => 'index' end should 'update file and be redirect to cms folder' do diff --git a/test/functional/mailconf_controller_test.rb b/test/functional/mailconf_controller_test.rb index a82466b..ae2cf9d 100644 --- a/test/functional/mailconf_controller_test.rb +++ b/test/functional/mailconf_controller_test.rb @@ -99,7 +99,7 @@ class MailconfControllerTest < ActionController::TestCase should 'go back on save' do login_as('ze') post :enable, :profile => 'ze' - assert_redirected_to :controller => 'profile_editor' + assert_redirected_to :controller => 'profile_editor', :action => 'edit' end should 'go to profile editor after enable email' do diff --git a/test/functional/manage_products_controller_test.rb b/test/functional/manage_products_controller_test.rb index 9e9d0cf..ce2142f 100644 --- a/test/functional/manage_products_controller_test.rb +++ b/test/functional/manage_products_controller_test.rb @@ -146,10 +146,10 @@ class ManageProductsControllerTest < ActionController::TestCase assert_no_difference Product, :count do post 'destroy', :profile => @enterprise.identifier, :id => product.id assert_response :redirect - assert_redirected_to :action => 'show' + assert_redirected_to :controller => "manage_products", :profile => @enterprise.identifier, :action => 'show', :id => product.id assert assigns(:product) - assert Product.find_by_name('test product') - end + assert Product.find_by_name('test product') + end end should 'show categories selection' do diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index 6f176b5..9483122 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -1205,7 +1205,7 @@ class ProfileControllerTest < ActionController::TestCase @request.stubs(:host).returns(community.environment.default_hostname) get :index, :profile => community.identifier assert_response :redirect - assert_redirected_to :host => 'community.example.net' + assert_redirected_to :host => 'community.example.net', :controller => 'profile', :action => 'index' end should 'register abuse report' do diff --git a/test/functional/tasks_controller_test.rb b/test/functional/tasks_controller_test.rb index 7cca646..590b0d7 100644 --- a/test/functional/tasks_controller_test.rb +++ b/test/functional/tasks_controller_test.rb @@ -18,6 +18,10 @@ class TasksControllerTest < ActionController::TestCase end attr_accessor :profile + def assert_redirected_to(options) + super({ :controller => 'tasks', :profile => profile.identifier }.merge(options)) + end + def test_local_files_reference assert_local_files_reference end diff --git a/test/functional/themes_controller_test.rb b/test/functional/themes_controller_test.rb index 0b2e6d2..6574fd1 100644 --- a/test/functional/themes_controller_test.rb +++ b/test/functional/themes_controller_test.rb @@ -234,7 +234,7 @@ class ThemesControllerTest < ActionController::TestCase post :start_test, :profile => 'testinguser', :id => 'theme-under-test' assert_equal 'theme-under-test', session[:theme] - assert_redirected_to :controller => 'content_viewer', :profile => 'testinguser' + assert_redirected_to :controller => 'content_viewer', :profile => 'testinguser', :action => 'view_page' end should 'stop testing theme' do -- libgit2 0.21.2