Commit 4fc900d2098b52c2d2c672e671e469e35104f070
1 parent
7fac67da
Exists in
master
and in
29 other branches
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
Showing
2 changed files
with
13 additions
and
1 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
@@ -24,6 +24,7 @@ class CmsController < MyProfileController | @@ -24,6 +24,7 @@ class CmsController < MyProfileController | ||
24 | @article.last_changed_by = user | 24 | @article.last_changed_by = user |
25 | if @article.update_attributes(params[:article]) | 25 | if @article.update_attributes(params[:article]) |
26 | redirect_to :action => 'view', :id => @article.id | 26 | redirect_to :action => 'view', :id => @article.id |
27 | + return | ||
27 | end | 28 | end |
28 | end | 29 | end |
29 | 30 |
test/functional/cms_controller_test.rb
@@ -91,7 +91,18 @@ class CmsControllerTest < Test::Unit::TestCase | @@ -91,7 +91,18 @@ class CmsControllerTest < Test::Unit::TestCase | ||
91 | end | 91 | end |
92 | 92 | ||
93 | should 'set last_changed_by when updating article' do | 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 | end | 106 | end |
96 | 107 | ||
97 | should 'list available editors' do | 108 | should 'list available editors' do |