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 | 131 | login_as 'testuser' |
132 | 132 | assert_difference Comment, :count, -1 do |
133 | 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 | 135 | end |
136 | 136 | end |
137 | 137 | |
... | ... | @@ -183,7 +183,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
183 | 183 | post :view_page, :profile => profile.identifier, :page => [ image.filename ], :remove_comment => comment.id, :view => true |
184 | 184 | |
185 | 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 | 187 | end |
188 | 188 | end |
189 | 189 | |
... | ... | @@ -587,17 +587,17 @@ class ContentViewerControllerTest < ActionController::TestCase |
587 | 587 | blog = Blog.create!(:name => "blog", :profile => profile) |
588 | 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 | 592 | blog.children << past_post |
593 | - blog.children << actual_post | |
593 | + blog.children << current_post | |
594 | 594 | |
595 | 595 | year, month = profile.blog.created_at.year.to_s, '%02d' % profile.blog.created_at.month |
596 | 596 | |
597 | 597 | get :view_page, :profile => profile.identifier, :page => [profile.blog.path], :year => year, :month => month |
598 | 598 | |
599 | 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 | 601 | end |
602 | 602 | |
603 | 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 | 942 | should 'display first page of forum posts' do |
943 | 943 | forum = Forum.create!(:name => 'My forum', :profile => profile, :posts_per_page => 5) |
944 | 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 | 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 | 949 | end |
949 | 950 | assert_equal 10, forum.posts.size |
950 | 951 | |
... | ... | @@ -979,17 +980,17 @@ class ContentViewerControllerTest < ActionController::TestCase |
979 | 980 | forum = Forum.create!(:name => "forum", :profile => profile) |
980 | 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 | 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 | 990 | get :view_page, :profile => profile.identifier, :page => [profile.forum.path], :year => year, :month => month |
990 | 991 | |
991 | 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 | 994 | end |
994 | 995 | |
995 | 996 | should "display 'New discussion topic' when create children of forum" do |
... | ... | @@ -1209,7 +1210,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
1209 | 1210 | login_as @profile.identifier |
1210 | 1211 | page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text') |
1211 | 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 | 1214 | end |
1214 | 1215 | |
1215 | 1216 | should 'display reply to comment button if authenticated' do | ... | ... |