Commit 48b1de6dfdbd44708937e000e9768a2c130d3f27
1 parent
7a14f984
Exists in
staging
and in
42 other branches
Remove warnings in functional tests
Showing
8 changed files
with
17 additions
and
11 deletions
Show diff stats
app/controllers/my_profile/tasks_controller.rb
| @@ -33,12 +33,14 @@ class TasksController < MyProfileController | @@ -33,12 +33,14 @@ class TasksController < MyProfileController | ||
| 33 | end | 33 | end |
| 34 | end | 34 | end |
| 35 | 35 | ||
| 36 | + url = { :action => 'index' } | ||
| 36 | if failed.blank? | 37 | if failed.blank? |
| 37 | session[:notice] = _("All decisions were applied successfully.") | 38 | session[:notice] = _("All decisions were applied successfully.") |
| 38 | else | 39 | else |
| 39 | session[:notice] = _("Some decisions couldn't be applied.") | 40 | session[:notice] = _("Some decisions couldn't be applied.") |
| 41 | + url[:failed] = failed | ||
| 40 | end | 42 | end |
| 41 | - redirect_to params.merge!(:action => 'index', :failed => failed) | 43 | + redirect_to url |
| 42 | end | 44 | end |
| 43 | 45 | ||
| 44 | def new | 46 | def new |
test/functional/catalog_controller_test.rb
| @@ -26,7 +26,7 @@ class CatalogControllerTest < ActionController::TestCase | @@ -26,7 +26,7 @@ class CatalogControllerTest < ActionController::TestCase | ||
| 26 | should 'not display for non-enterprises' do | 26 | should 'not display for non-enterprises' do |
| 27 | u = create_user('testinguser').person | 27 | u = create_user('testinguser').person |
| 28 | get :index, :profile => 'testinguser' | 28 | get :index, :profile => 'testinguser' |
| 29 | - assert_redirected_to :controller => "profile", :profile => 'testinguser' | 29 | + assert_redirected_to :controller => "profile", :profile => 'testinguser', :action => 'index' |
| 30 | end | 30 | end |
| 31 | 31 | ||
| 32 | should 'display for enterprises' do | 32 | should 'display for enterprises' do |
test/functional/cms_controller_test.rb
| @@ -202,7 +202,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -202,7 +202,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 202 | 202 | ||
| 203 | assert_difference Article, :count, -1 do | 203 | assert_difference Article, :count, -1 do |
| 204 | post :destroy, :profile => profile.identifier, :id => a.id | 204 | post :destroy, :profile => profile.identifier, :id => a.id |
| 205 | - assert_redirected_to :action => 'index' | 205 | + assert_redirected_to :controller => 'cms', :profile => profile.identifier, :action => 'index' |
| 206 | end | 206 | end |
| 207 | end | 207 | end |
| 208 | 208 | ||
| @@ -959,7 +959,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -959,7 +959,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 959 | 959 | ||
| 960 | post :upload_files, :profile => profile.identifier, :parent_id => folder.id, :back_to => @request.referer, :uploaded_files => [fixture_file_upload('files/rails.png', 'image/png')] | 960 | post :upload_files, :profile => profile.identifier, :parent_id => folder.id, :back_to => @request.referer, :uploaded_files => [fixture_file_upload('files/rails.png', 'image/png')] |
| 961 | assert_template nil | 961 | assert_template nil |
| 962 | - assert_redirected_to folder.view_url | 962 | + assert_redirected_to 'http://localhost/testinguser/test-folder' |
| 963 | end | 963 | end |
| 964 | 964 | ||
| 965 | should 'record when coming from public view on edit files with view true' do | 965 | should 'record when coming from public view on edit files with view true' do |
| @@ -1416,7 +1416,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1416,7 +1416,7 @@ class CmsControllerTest < ActionController::TestCase | ||
| 1416 | should 'update file and be redirect to cms' do | 1416 | should 'update file and be redirect to cms' do |
| 1417 | file = UploadedFile.create!(:profile => @profile, :uploaded_data => fixture_file_upload('files/test.txt', 'text/plain')) | 1417 | file = UploadedFile.create!(:profile => @profile, :uploaded_data => fixture_file_upload('files/test.txt', 'text/plain')) |
| 1418 | post :edit, :profile => @profile.identifier, :id => file.id, :article => { } | 1418 | post :edit, :profile => @profile.identifier, :id => file.id, :article => { } |
| 1419 | - assert_redirected_to :action => 'index' | 1419 | + assert_redirected_to :controller => 'cms', :profile => profile.identifier, :action => 'index' |
| 1420 | end | 1420 | end |
| 1421 | 1421 | ||
| 1422 | should 'update file and be redirect to cms folder' do | 1422 | should 'update file and be redirect to cms folder' do |
test/functional/mailconf_controller_test.rb
| @@ -99,7 +99,7 @@ class MailconfControllerTest < ActionController::TestCase | @@ -99,7 +99,7 @@ class MailconfControllerTest < ActionController::TestCase | ||
| 99 | should 'go back on save' do | 99 | should 'go back on save' do |
| 100 | login_as('ze') | 100 | login_as('ze') |
| 101 | post :enable, :profile => 'ze' | 101 | post :enable, :profile => 'ze' |
| 102 | - assert_redirected_to :controller => 'profile_editor' | 102 | + assert_redirected_to :controller => 'profile_editor', :action => 'edit' |
| 103 | end | 103 | end |
| 104 | 104 | ||
| 105 | should 'go to profile editor after enable email' do | 105 | should 'go to profile editor after enable email' do |
test/functional/manage_products_controller_test.rb
| @@ -146,10 +146,10 @@ class ManageProductsControllerTest < ActionController::TestCase | @@ -146,10 +146,10 @@ class ManageProductsControllerTest < ActionController::TestCase | ||
| 146 | assert_no_difference Product, :count do | 146 | assert_no_difference Product, :count do |
| 147 | post 'destroy', :profile => @enterprise.identifier, :id => product.id | 147 | post 'destroy', :profile => @enterprise.identifier, :id => product.id |
| 148 | assert_response :redirect | 148 | assert_response :redirect |
| 149 | - assert_redirected_to :action => 'show' | 149 | + assert_redirected_to :controller => "manage_products", :profile => @enterprise.identifier, :action => 'show', :id => product.id |
| 150 | assert assigns(:product) | 150 | assert assigns(:product) |
| 151 | - assert Product.find_by_name('test product') | ||
| 152 | - end | 151 | + assert Product.find_by_name('test product') |
| 152 | + end | ||
| 153 | end | 153 | end |
| 154 | 154 | ||
| 155 | should 'show categories selection' do | 155 | should 'show categories selection' do |
test/functional/profile_controller_test.rb
| @@ -1205,7 +1205,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1205,7 +1205,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
| 1205 | @request.stubs(:host).returns(community.environment.default_hostname) | 1205 | @request.stubs(:host).returns(community.environment.default_hostname) |
| 1206 | get :index, :profile => community.identifier | 1206 | get :index, :profile => community.identifier |
| 1207 | assert_response :redirect | 1207 | assert_response :redirect |
| 1208 | - assert_redirected_to :host => 'community.example.net' | 1208 | + assert_redirected_to :host => 'community.example.net', :controller => 'profile', :action => 'index' |
| 1209 | end | 1209 | end |
| 1210 | 1210 | ||
| 1211 | should 'register abuse report' do | 1211 | should 'register abuse report' do |
test/functional/tasks_controller_test.rb
| @@ -18,6 +18,10 @@ class TasksControllerTest < ActionController::TestCase | @@ -18,6 +18,10 @@ class TasksControllerTest < ActionController::TestCase | ||
| 18 | end | 18 | end |
| 19 | attr_accessor :profile | 19 | attr_accessor :profile |
| 20 | 20 | ||
| 21 | + def assert_redirected_to(options) | ||
| 22 | + super({ :controller => 'tasks', :profile => profile.identifier }.merge(options)) | ||
| 23 | + end | ||
| 24 | + | ||
| 21 | def test_local_files_reference | 25 | def test_local_files_reference |
| 22 | assert_local_files_reference | 26 | assert_local_files_reference |
| 23 | end | 27 | end |
test/functional/themes_controller_test.rb
| @@ -234,7 +234,7 @@ class ThemesControllerTest < ActionController::TestCase | @@ -234,7 +234,7 @@ class ThemesControllerTest < ActionController::TestCase | ||
| 234 | post :start_test, :profile => 'testinguser', :id => 'theme-under-test' | 234 | post :start_test, :profile => 'testinguser', :id => 'theme-under-test' |
| 235 | 235 | ||
| 236 | assert_equal 'theme-under-test', session[:theme] | 236 | assert_equal 'theme-under-test', session[:theme] |
| 237 | - assert_redirected_to :controller => 'content_viewer', :profile => 'testinguser' | 237 | + assert_redirected_to :controller => 'content_viewer', :profile => 'testinguser', :action => 'view_page' |
| 238 | end | 238 | end |
| 239 | 239 | ||
| 240 | should 'stop testing theme' do | 240 | should 'stop testing theme' do |