Commit d1ce6d4d687b8b5dfed82fa723318902072d6397

Authored by Rodrigo Souto
1 parent 9f41d6d5

Update tests to new author scheme

test/functional/cms_controller_test.rb
... ... @@ -1223,7 +1223,7 @@ class CmsControllerTest < ActionController::TestCase
1223 1223 should 'not allow user edit article if he is owner but has no publish permission' do
1224 1224 c = Community.create!(:name => 'test_comm', :identifier => 'test_comm')
1225 1225 u = create_user_with_permission('test_user', 'bogus_permission', c)
1226   - a = c.articles.create!(:name => 'test_article', :last_changed_by => u)
  1226 + a = c.articles.create!(:name => 'test_article', :author => u)
1227 1227 login_as :test_user
1228 1228  
1229 1229 get :edit, :profile => c.identifier, :id => a.id
... ... @@ -1234,7 +1234,7 @@ class CmsControllerTest < ActionController::TestCase
1234 1234 should 'allow user edit article if he is owner and has publish permission' do
1235 1235 c = Community.create!(:name => 'test_comm', :identifier => 'test_comm')
1236 1236 u = create_user_with_permission('test_user', 'publish_content', c)
1237   - a = c.articles.create!(:name => 'test_article', :last_changed_by => u)
  1237 + a = c.articles.create!(:name => 'test_article', :author => u)
1238 1238 login_as :test_user
1239 1239 @controller.stubs(:user).returns(u)
1240 1240  
... ...
test/functional/comment_controller_test.rb
... ... @@ -266,7 +266,7 @@ class CommentControllerTest < ActionController::TestCase
266 266 should 'not create ApproveComment task when the comment author is the same of article author' do
267 267 login_as @profile.identifier
268 268 community = Community.create!(:name => 'testcomm')
269   - page = community.articles.create!(:name => 'myarticle', :moderate_comments => true, :last_changed_by => @profile)
  269 + page = community.articles.create!(:name => 'myarticle', :moderate_comments => true, :author => @profile)
270 270 community.add_moderator(@profile)
271 271  
272 272 assert_no_difference ApproveComment, :count do
... ...
test/unit/forum_helper_test.rb
... ... @@ -29,16 +29,16 @@ class ForumHelperTest < ActiveSupport::TestCase
29 29 end
30 30  
31 31 should 'list posts with different classes' do
32   - forum.children << older_post = TextileArticle.create!(:name => 'First post', :profile => profile, :parent => forum, :published => false, :last_changed_by => profile)
  32 + forum.children << older_post = TextileArticle.create!(:name => 'First post', :profile => profile, :parent => forum, :published => false, :author => profile)
33 33 one_month_later = Time.now + 1.month
34 34 Time.stubs(:now).returns(one_month_later)
35   - forum.children << newer_post = TextileArticle.create!(:name => 'Second post', :profile => profile, :parent => forum, :published => true, :last_changed_by => profile)
  35 + forum.children << newer_post = TextileArticle.create!(:name => 'Second post', :profile => profile, :parent => forum, :published => true, :author => profile)
36 36 assert_match /forum-post position-1 first odd-post.*forum-post position-2 last not-published even-post/, list_forum_posts(forum.posts)
37 37 end
38 38  
39 39 should 'return post update if it has no comments' do
40 40 author = create_user('forum test author').person
41   - some_post = TextileArticle.create!(:name => 'First post', :profile => profile, :parent => forum, :published => true, :last_changed_by => author)
  41 + some_post = TextileArticle.create!(:name => 'First post', :profile => profile, :parent => forum, :published => true, :author => author)
42 42 assert some_post.comments.empty?
43 43 out = last_topic_update(some_post)
44 44 assert_match some_post.updated_at.to_s, out
... ...