Commit d1ce6d4d687b8b5dfed82fa723318902072d6397
1 parent
9f41d6d5
Exists in
master
and in
27 other branches
Update tests to new author scheme
Showing
3 changed files
with
6 additions
and
6 deletions
Show diff stats
test/functional/cms_controller_test.rb
@@ -1223,7 +1223,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1223,7 +1223,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1223 | should 'not allow user edit article if he is owner but has no publish permission' do | 1223 | should 'not allow user edit article if he is owner but has no publish permission' do |
1224 | c = Community.create!(:name => 'test_comm', :identifier => 'test_comm') | 1224 | c = Community.create!(:name => 'test_comm', :identifier => 'test_comm') |
1225 | u = create_user_with_permission('test_user', 'bogus_permission', c) | 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 | login_as :test_user | 1227 | login_as :test_user |
1228 | 1228 | ||
1229 | get :edit, :profile => c.identifier, :id => a.id | 1229 | get :edit, :profile => c.identifier, :id => a.id |
@@ -1234,7 +1234,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1234,7 +1234,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1234 | should 'allow user edit article if he is owner and has publish permission' do | 1234 | should 'allow user edit article if he is owner and has publish permission' do |
1235 | c = Community.create!(:name => 'test_comm', :identifier => 'test_comm') | 1235 | c = Community.create!(:name => 'test_comm', :identifier => 'test_comm') |
1236 | u = create_user_with_permission('test_user', 'publish_content', c) | 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 | login_as :test_user | 1238 | login_as :test_user |
1239 | @controller.stubs(:user).returns(u) | 1239 | @controller.stubs(:user).returns(u) |
1240 | 1240 |
test/functional/comment_controller_test.rb
@@ -266,7 +266,7 @@ class CommentControllerTest < ActionController::TestCase | @@ -266,7 +266,7 @@ class CommentControllerTest < ActionController::TestCase | ||
266 | should 'not create ApproveComment task when the comment author is the same of article author' do | 266 | should 'not create ApproveComment task when the comment author is the same of article author' do |
267 | login_as @profile.identifier | 267 | login_as @profile.identifier |
268 | community = Community.create!(:name => 'testcomm') | 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 | community.add_moderator(@profile) | 270 | community.add_moderator(@profile) |
271 | 271 | ||
272 | assert_no_difference ApproveComment, :count do | 272 | assert_no_difference ApproveComment, :count do |
test/unit/forum_helper_test.rb
@@ -29,16 +29,16 @@ class ForumHelperTest < ActiveSupport::TestCase | @@ -29,16 +29,16 @@ class ForumHelperTest < ActiveSupport::TestCase | ||
29 | end | 29 | end |
30 | 30 | ||
31 | should 'list posts with different classes' do | 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 | one_month_later = Time.now + 1.month | 33 | one_month_later = Time.now + 1.month |
34 | Time.stubs(:now).returns(one_month_later) | 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 | assert_match /forum-post position-1 first odd-post.*forum-post position-2 last not-published even-post/, list_forum_posts(forum.posts) | 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 | end | 37 | end |
38 | 38 | ||
39 | should 'return post update if it has no comments' do | 39 | should 'return post update if it has no comments' do |
40 | author = create_user('forum test author').person | 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 | assert some_post.comments.empty? | 42 | assert some_post.comments.empty? |
43 | out = last_topic_update(some_post) | 43 | out = last_topic_update(some_post) |
44 | assert_match some_post.updated_at.to_s, out | 44 | assert_match some_post.updated_at.to_s, out |