Commit 4ade473383856e409c4c2e9c79cc613262311db5
1 parent
5995bbec
Exists in
master
and in
23 other branches
ActionItem21: test for setting home page
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@989 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
12 additions
and
2 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
| @@ -55,7 +55,7 @@ class CmsController < MyProfileController | @@ -55,7 +55,7 @@ class CmsController < MyProfileController | ||
| 55 | @article = profile.articles.find(params[:id]) | 55 | @article = profile.articles.find(params[:id]) |
| 56 | profile.home_page = @article | 56 | profile.home_page = @article |
| 57 | profile.save! | 57 | profile.save! |
| 58 | - redirect_to :back | 58 | + redirect_to :action => 'view', :id => @article.id |
| 59 | end | 59 | end |
| 60 | 60 | ||
| 61 | protected | 61 | protected |
test/functional/cms_controller_test.rb
| @@ -67,7 +67,17 @@ class CmsControllerTest < Test::Unit::TestCase | @@ -67,7 +67,17 @@ class CmsControllerTest < Test::Unit::TestCase | ||
| 67 | end | 67 | end |
| 68 | 68 | ||
| 69 | should 'be able to set home page' do | 69 | should 'be able to set home page' do |
| 70 | - flunk 'pending' | 70 | + a = profile.articles.build(:name => 'my new home page') |
| 71 | + a.save! | ||
| 72 | + | ||
| 73 | + assert_not_equal a, profile.home_page | ||
| 74 | + | ||
| 75 | + post :set_home_page, :profile => profile.identifier, :id => a.id | ||
| 76 | + | ||
| 77 | + assert_redirected_to :action => 'view', :id => a.id | ||
| 78 | + | ||
| 79 | + profile.reload | ||
| 80 | + assert_equal a, profile.home_page | ||
| 71 | end | 81 | end |
| 72 | 82 | ||
| 73 | should 'set last_changed_by when creating article' do | 83 | should 'set last_changed_by when creating article' do |