Commit 259f642d0eea5510f22abd055230f5ebac753473
1 parent
4013a294
Exists in
master
and in
29 other branches
Fix tests for SearchController
Showing
1 changed file
with
15 additions
and
14 deletions
Show diff stats
test/functional/content_viewer_controller_test.rb
@@ -131,7 +131,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -131,7 +131,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
131 | login_as 'testuser' | 131 | login_as 'testuser' |
132 | assert_difference Comment, :count, -1 do | 132 | assert_difference Comment, :count, -1 do |
133 | post :view_page, :profile => profile.identifier, :page => [ 'test' ], :remove_comment => comment.id | 133 | post :view_page, :profile => profile.identifier, :page => [ 'test' ], :remove_comment => comment.id |
134 | - assert_redirected_to :profile => 'testuser', :action => 'view_page', :page => [ 'test' ] | 134 | + assert_redirected_to :controller => 'content_viewer', :profile => 'testuser', :action => 'view_page', :page => [ 'test' ] |
135 | end | 135 | end |
136 | end | 136 | end |
137 | 137 | ||
@@ -183,7 +183,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -183,7 +183,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
183 | post :view_page, :profile => profile.identifier, :page => [ image.filename ], :remove_comment => comment.id, :view => true | 183 | post :view_page, :profile => profile.identifier, :page => [ image.filename ], :remove_comment => comment.id, :view => true |
184 | 184 | ||
185 | assert_response :redirect | 185 | assert_response :redirect |
186 | - assert_redirected_to :profile => profile.identifier, :page => image.explode_path, :view => true | 186 | + assert_redirected_to :controller => 'content_viewer', :action => 'view_page', :profile => profile.identifier, :page => image.explode_path, :view => true |
187 | end | 187 | end |
188 | end | 188 | end |
189 | 189 | ||
@@ -587,17 +587,17 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -587,17 +587,17 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
587 | blog = Blog.create!(:name => "blog", :profile => profile) | 587 | blog = Blog.create!(:name => "blog", :profile => profile) |
588 | profile.articles << blog | 588 | profile.articles << blog |
589 | 589 | ||
590 | - past_post = TextileArticle.create!(:name => "past post", :profile => profile, :parent => blog, :created_at => blog.created_at - 1.year) | ||
591 | - actual_post = TextileArticle.create!(:name => "actual post", :profile => profile, :parent => blog) | 590 | + past_post = TextileArticle.create!(:name => "past post", :profile => profile, :parent => blog, :published_at => blog.created_at - 1.year) |
591 | + current_post = TextileArticle.create!(:name => "current post", :profile => profile, :parent => blog) | ||
592 | blog.children << past_post | 592 | blog.children << past_post |
593 | - blog.children << actual_post | 593 | + blog.children << current_post |
594 | 594 | ||
595 | year, month = profile.blog.created_at.year.to_s, '%02d' % profile.blog.created_at.month | 595 | year, month = profile.blog.created_at.year.to_s, '%02d' % profile.blog.created_at.month |
596 | 596 | ||
597 | get :view_page, :profile => profile.identifier, :page => [profile.blog.path], :year => year, :month => month | 597 | get :view_page, :profile => profile.identifier, :page => [profile.blog.path], :year => year, :month => month |
598 | 598 | ||
599 | assert_no_tag :tag => 'a', :content => past_post.title | 599 | assert_no_tag :tag => 'a', :content => past_post.title |
600 | - assert_tag :tag => 'a', :content => actual_post.title | 600 | + assert_tag :tag => 'a', :content => current_post.title |
601 | end | 601 | end |
602 | 602 | ||
603 | should 'give link to create new article inside folder when view child of folder' do | 603 | should 'give link to create new article inside folder when view child of folder' do |
@@ -942,9 +942,10 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -942,9 +942,10 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
942 | should 'display first page of forum posts' do | 942 | should 'display first page of forum posts' do |
943 | forum = Forum.create!(:name => 'My forum', :profile => profile, :posts_per_page => 5) | 943 | forum = Forum.create!(:name => 'My forum', :profile => profile, :posts_per_page => 5) |
944 | for n in 1..10 | 944 | for n in 1..10 |
945 | - forum.children << art = TextileArticle.create!(:name => "Post #{n}", :profile => profile, :parent => forum) | 945 | + art = TextileArticle.create!(:name => "Post #{n}", :profile => profile, :parent => forum) |
946 | art.updated_at = (10 - n).days.ago | 946 | art.updated_at = (10 - n).days.ago |
947 | - art.send :update_without_callbacks | 947 | + art.stubs(:record_timestamps).returns(false) |
948 | + art.save! | ||
948 | end | 949 | end |
949 | assert_equal 10, forum.posts.size | 950 | assert_equal 10, forum.posts.size |
950 | 951 | ||
@@ -979,17 +980,17 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -979,17 +980,17 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
979 | forum = Forum.create!(:name => "forum", :profile => profile) | 980 | forum = Forum.create!(:name => "forum", :profile => profile) |
980 | profile.articles << forum | 981 | profile.articles << forum |
981 | 982 | ||
982 | - past_post = TextileArticle.create!(:name => "past post", :profile => profile, :parent => forum, :created_at => forum.created_at - 1.year) | ||
983 | - actual_post = TextileArticle.create!(:name => "actual post", :profile => profile, :parent => forum) | 983 | + past_post = TextileArticle.create!(:name => "past post", :profile => profile, :parent => forum, :published_at => forum.created_at - 1.year) |
984 | + current_post = TextileArticle.create!(:name => "current post", :profile => profile, :parent => forum) | ||
984 | forum.children << past_post | 985 | forum.children << past_post |
985 | - forum.children << actual_post | 986 | + forum.children << current_post |
986 | 987 | ||
987 | - year, month = profile.forum.created_at.year.to_s, '%02d' % profile.forum.created_at.month | 988 | + year, month = forum.created_at.year.to_s, '%02d' % forum.created_at.month |
988 | 989 | ||
989 | get :view_page, :profile => profile.identifier, :page => [profile.forum.path], :year => year, :month => month | 990 | get :view_page, :profile => profile.identifier, :page => [profile.forum.path], :year => year, :month => month |
990 | 991 | ||
991 | assert_no_tag :tag => 'a', :content => past_post.title | 992 | assert_no_tag :tag => 'a', :content => past_post.title |
992 | - assert_tag :tag => 'a', :content => actual_post.title | 993 | + assert_tag :tag => 'a', :content => current_post.title |
993 | end | 994 | end |
994 | 995 | ||
995 | should "display 'New discussion topic' when create children of forum" do | 996 | should "display 'New discussion topic' when create children of forum" do |
@@ -1209,7 +1210,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1209,7 +1210,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1209 | login_as @profile.identifier | 1210 | login_as @profile.identifier |
1210 | page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text') | 1211 | page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text') |
1211 | post :view_page, :profile => @profile.identifier, :page => [ 'myarticle' ], :comment => { :title => 'title', :body => 'body' }, :confirm => 'true' | 1212 | post :view_page, :profile => @profile.identifier, :page => [ 'myarticle' ], :comment => { :title => 'title', :body => 'body' }, :confirm => 'true' |
1212 | - assert_redirected_to :profile => @profile.identifier, :page => page.explode_path | 1213 | + assert_redirected_to :controller => 'content_viewer', :action => 'view_page', :profile => @profile.identifier, :page => page.explode_path |
1213 | end | 1214 | end |
1214 | 1215 | ||
1215 | should 'display reply to comment button if authenticated' do | 1216 | should 'display reply to comment button if authenticated' do |