diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index f7a3c26..0018c7e 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -55,7 +55,7 @@ class CmsController < MyProfileController @article = profile.articles.find(params[:id]) profile.home_page = @article profile.save! - redirect_to :back + redirect_to :action => 'view', :id => @article.id end protected diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb index 0c733fe..5d3a6e7 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -67,7 +67,17 @@ class CmsControllerTest < Test::Unit::TestCase end should 'be able to set home page' do - flunk 'pending' + a = profile.articles.build(:name => 'my new home page') + a.save! + + assert_not_equal a, profile.home_page + + post :set_home_page, :profile => profile.identifier, :id => a.id + + assert_redirected_to :action => 'view', :id => a.id + + profile.reload + assert_equal a, profile.home_page end should 'set last_changed_by when creating article' do -- libgit2 0.21.2