Commit 4ade473383856e409c4c2e9c79cc613262311db5

Authored by AntonioTerceiro
1 parent 5995bbec

ActionItem21: test for setting home page



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@989 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/my_profile/cms_controller.rb
... ... @@ -55,7 +55,7 @@ class CmsController < MyProfileController
55 55 @article = profile.articles.find(params[:id])
56 56 profile.home_page = @article
57 57 profile.save!
58   - redirect_to :back
  58 + redirect_to :action => 'view', :id => @article.id
59 59 end
60 60  
61 61 protected
... ...
test/functional/cms_controller_test.rb
... ... @@ -67,7 +67,17 @@ class CmsControllerTest < Test::Unit::TestCase
67 67 end
68 68  
69 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 81 end
72 82  
73 83 should 'set last_changed_by when creating article' do
... ...