Commit 4fc900d2098b52c2d2c672e671e469e35104f070

Authored by AntonioTerceiro
1 parent 7fac67da

ActionItem21: adding test for attribution of "last changed by" on article updating



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@991 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/my_profile/cms_controller.rb
... ... @@ -24,6 +24,7 @@ class CmsController < MyProfileController
24 24 @article.last_changed_by = user
25 25 if @article.update_attributes(params[:article])
26 26 redirect_to :action => 'view', :id => @article.id
  27 + return
27 28 end
28 29 end
29 30  
... ...
test/functional/cms_controller_test.rb
... ... @@ -91,7 +91,18 @@ class CmsControllerTest < Test::Unit::TestCase
91 91 end
92 92  
93 93 should 'set last_changed_by when updating article' do
94   - flunk 'pending'
  94 + other_person = create_user('otherperson').person
  95 +
  96 + a = profile.articles.build(:name => 'my article')
  97 + a.last_changed_by = other_person
  98 + a.save!
  99 +
  100 + login_as(profile.identifier)
  101 + post :edit, :profile => profile.identifier, :id => a.id, :article => { :body => 'new content for this article' }
  102 +
  103 + a.reload
  104 +
  105 + assert_equal profile, a.last_changed_by
95 106 end
96 107  
97 108 should 'list available editors' do
... ...