Commit 97fe0f5036d728783c27eedf01a3b94a06e43d30
1 parent
05592804
Exists in
master
and in
22 other branches
Fixing master tests after merge with stable
Showing
7 changed files
with
10 additions
and
12 deletions
Show diff stats
app/helpers/blog_helper.rb
| @@ -20,7 +20,7 @@ module BlogHelper | @@ -20,7 +20,7 @@ module BlogHelper | ||
| 20 | :previous_label => _('« Newer posts'), | 20 | :previous_label => _('« Newer posts'), |
| 21 | :next_label => _('Older posts »'), | 21 | :next_label => _('Older posts »'), |
| 22 | :params => {:action=>"view_page", :page=>articles.first.parent.path.split('/'), :controller=>"content_viewer"} | 22 | :params => {:action=>"view_page", :page=>articles.first.parent.path.split('/'), :controller=>"content_viewer"} |
| 23 | - }) | 23 | + }) if articles.present? |
| 24 | content = [] | 24 | content = [] |
| 25 | artic_len = articles.length | 25 | artic_len = articles.length |
| 26 | articles.each_with_index{ |art,i| | 26 | articles.each_with_index{ |art,i| |
app/helpers/content_viewer_helper.rb
| @@ -2,7 +2,6 @@ module ContentViewerHelper | @@ -2,7 +2,6 @@ module ContentViewerHelper | ||
| 2 | 2 | ||
| 3 | include BlogHelper | 3 | include BlogHelper |
| 4 | include ForumHelper | 4 | include ForumHelper |
| 5 | - include ActionView::Helpers::TagHelper | ||
| 6 | 5 | ||
| 7 | def number_of_comments(article) | 6 | def number_of_comments(article) |
| 8 | n = article.comments.without_spam.count | 7 | n = article.comments.without_spam.count |
app/models/article.rb
| @@ -2,6 +2,9 @@ require 'hpricot' | @@ -2,6 +2,9 @@ require 'hpricot' | ||
| 2 | 2 | ||
| 3 | class Article < ActiveRecord::Base | 3 | class Article < ActiveRecord::Base |
| 4 | 4 | ||
| 5 | + #FIXME This is necessary because html is being generated on the model... | ||
| 6 | + include ActionView::Helpers::TagHelper | ||
| 7 | + | ||
| 5 | # use for internationalizable human type names in search facets | 8 | # use for internationalizable human type names in search facets |
| 6 | # reimplement on subclasses | 9 | # reimplement on subclasses |
| 7 | def self.type_name | 10 | def self.type_name |
app/views/content_viewer/view_page.rhtml
| @@ -90,7 +90,7 @@ | @@ -90,7 +90,7 @@ | ||
| 90 | <% end %> | 90 | <% end %> |
| 91 | 91 | ||
| 92 | <% if @page.accept_comments? && @comments_count > 1 %> | 92 | <% if @page.accept_comments? && @comments_count > 1 %> |
| 93 | - <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form') %> | 93 | + <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form', :id => 'top-post-comment-button') %> |
| 94 | <% end %> | 94 | <% end %> |
| 95 | 95 | ||
| 96 | <ul class="article-comments-list"> | 96 | <ul class="article-comments-list"> |
test/functional/content_viewer_controller_test.rb
| @@ -1281,7 +1281,7 @@ end | @@ -1281,7 +1281,7 @@ end | ||
| 1281 | comment = article.comments.build(:author => profile, :title => 'hi', :body => 'hello') | 1281 | comment = article.comments.build(:author => profile, :title => 'hi', :body => 'hello') |
| 1282 | comment.save! | 1282 | comment.save! |
| 1283 | get :view_page, :profile => 'testuser', :page => [ 'test' ] | 1283 | get :view_page, :profile => 'testuser', :page => [ 'test' ] |
| 1284 | - assert_no_tag :tag => 'a', :attributes => { :class => 'display-comment-form' } | 1284 | + assert_no_tag :tag => 'a', :attributes => { :id => 'top-post-comment-button' } |
| 1285 | end | 1285 | end |
| 1286 | 1286 | ||
| 1287 | should 'not show a post comment button on top if there are no comments' do | 1287 | should 'not show a post comment button on top if there are no comments' do |
| @@ -1289,7 +1289,7 @@ end | @@ -1289,7 +1289,7 @@ end | ||
| 1289 | article = profile.articles.build(:name => 'test') | 1289 | article = profile.articles.build(:name => 'test') |
| 1290 | article.save! | 1290 | article.save! |
| 1291 | get :view_page, :profile => 'testuser', :page => [ 'test' ] | 1291 | get :view_page, :profile => 'testuser', :page => [ 'test' ] |
| 1292 | - assert_no_tag :tag => 'a', :attributes => { :class => 'display-comment-form' } | 1292 | + assert_no_tag :tag => 'a', :attributes => { :id => 'top-post-comment-button' } |
| 1293 | end | 1293 | end |
| 1294 | 1294 | ||
| 1295 | should 'show a post comment button on top if there are at least two comments' do | 1295 | should 'show a post comment button on top if there are at least two comments' do |
| @@ -1301,7 +1301,7 @@ end | @@ -1301,7 +1301,7 @@ end | ||
| 1301 | comment2 = article.comments.build(:author => profile, :title => 'hi', :body => 'hello', :reply_of_id => comment1.id) | 1301 | comment2 = article.comments.build(:author => profile, :title => 'hi', :body => 'hello', :reply_of_id => comment1.id) |
| 1302 | comment2.save! | 1302 | comment2.save! |
| 1303 | get :view_page, :profile => 'testuser', :page => [ 'test' ] | 1303 | get :view_page, :profile => 'testuser', :page => [ 'test' ] |
| 1304 | - assert_tag :tag => 'a', :attributes => { :class => 'display-comment-form' } | 1304 | + assert_tag :tag => 'a', :attributes => { :id => 'top-post-comment-button' } |
| 1305 | end | 1305 | end |
| 1306 | 1306 | ||
| 1307 | should 'store number of comments' do | 1307 | should 'store number of comments' do |
test/functional/environment_design_controller_test.rb
| @@ -64,11 +64,8 @@ class EnvironmentDesignControllerTest < ActionController::TestCase | @@ -64,11 +64,8 @@ class EnvironmentDesignControllerTest < ActionController::TestCase | ||
| 64 | e.boxes.first.blocks << l | 64 | e.boxes.first.blocks << l |
| 65 | community = mock() | 65 | community = mock() |
| 66 | Environment.any_instance.stubs(:portal_community).returns(community) | 66 | Environment.any_instance.stubs(:portal_community).returns(community) |
| 67 | - article = mock() | 67 | + article = fast_create(Article) |
| 68 | community.stubs(:articles).returns([article]) | 68 | community.stubs(:articles).returns([article]) |
| 69 | - article.expects(:folder?).returns(false) | ||
| 70 | - article.expects(:path).returns('some_path') | ||
| 71 | - article.expects(:id).returns(1) | ||
| 72 | get :edit, :id => l.id | 69 | get :edit, :id => l.id |
| 73 | assert_tag :tag => 'select', :attributes => { :name => 'block[article_id]' } | 70 | assert_tag :tag => 'select', :attributes => { :name => 'block[article_id]' } |
| 74 | end | 71 | end |
test/unit/content_viewer_helper_test.rb
| @@ -61,8 +61,7 @@ class ContentViewerHelperTest < ActiveSupport::TestCase | @@ -61,8 +61,7 @@ class ContentViewerHelperTest < ActiveSupport::TestCase | ||
| 61 | end | 61 | end |
| 62 | 62 | ||
| 63 | should 'count total of comments from post' do | 63 | should 'count total of comments from post' do |
| 64 | - article = fast_create(TextileArticle) | ||
| 65 | - article.stubs(:url).returns({}) | 64 | + article = fast_create(TextileArticle, :profile_id => profile.id) |
| 66 | article.comments.create!(:author => profile, :title => 'test', :body => 'test') | 65 | article.comments.create!(:author => profile, :title => 'test', :body => 'test') |
| 67 | result = link_to_comments(article) | 66 | result = link_to_comments(article) |
| 68 | assert_match /One comment/, result | 67 | assert_match /One comment/, result |