Commit 97fe0f5036d728783c27eedf01a3b94a06e43d30
1 parent
05592804
Exists in
master
and in
23 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 | 20 | :previous_label => _('« Newer posts'), |
| 21 | 21 | :next_label => _('Older posts »'), |
| 22 | 22 | :params => {:action=>"view_page", :page=>articles.first.parent.path.split('/'), :controller=>"content_viewer"} |
| 23 | - }) | |
| 23 | + }) if articles.present? | |
| 24 | 24 | content = [] |
| 25 | 25 | artic_len = articles.length |
| 26 | 26 | articles.each_with_index{ |art,i| | ... | ... |
app/helpers/content_viewer_helper.rb
app/models/article.rb
| ... | ... | @@ -2,6 +2,9 @@ require 'hpricot' |
| 2 | 2 | |
| 3 | 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 | 8 | # use for internationalizable human type names in search facets |
| 6 | 9 | # reimplement on subclasses |
| 7 | 10 | def self.type_name | ... | ... |
app/views/content_viewer/view_page.rhtml
| ... | ... | @@ -90,7 +90,7 @@ |
| 90 | 90 | <% end %> |
| 91 | 91 | |
| 92 | 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 | 94 | <% end %> |
| 95 | 95 | |
| 96 | 96 | <ul class="article-comments-list"> | ... | ... |
test/functional/content_viewer_controller_test.rb
| ... | ... | @@ -1281,7 +1281,7 @@ end |
| 1281 | 1281 | comment = article.comments.build(:author => profile, :title => 'hi', :body => 'hello') |
| 1282 | 1282 | comment.save! |
| 1283 | 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 | 1285 | end |
| 1286 | 1286 | |
| 1287 | 1287 | should 'not show a post comment button on top if there are no comments' do |
| ... | ... | @@ -1289,7 +1289,7 @@ end |
| 1289 | 1289 | article = profile.articles.build(:name => 'test') |
| 1290 | 1290 | article.save! |
| 1291 | 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 | 1293 | end |
| 1294 | 1294 | |
| 1295 | 1295 | should 'show a post comment button on top if there are at least two comments' do |
| ... | ... | @@ -1301,7 +1301,7 @@ end |
| 1301 | 1301 | comment2 = article.comments.build(:author => profile, :title => 'hi', :body => 'hello', :reply_of_id => comment1.id) |
| 1302 | 1302 | comment2.save! |
| 1303 | 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 | 1305 | end |
| 1306 | 1306 | |
| 1307 | 1307 | should 'store number of comments' do | ... | ... |
test/functional/environment_design_controller_test.rb
| ... | ... | @@ -64,11 +64,8 @@ class EnvironmentDesignControllerTest < ActionController::TestCase |
| 64 | 64 | e.boxes.first.blocks << l |
| 65 | 65 | community = mock() |
| 66 | 66 | Environment.any_instance.stubs(:portal_community).returns(community) |
| 67 | - article = mock() | |
| 67 | + article = fast_create(Article) | |
| 68 | 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 | 69 | get :edit, :id => l.id |
| 73 | 70 | assert_tag :tag => 'select', :attributes => { :name => 'block[article_id]' } |
| 74 | 71 | end | ... | ... |
test/unit/content_viewer_helper_test.rb
| ... | ... | @@ -61,8 +61,7 @@ class ContentViewerHelperTest < ActiveSupport::TestCase |
| 61 | 61 | end |
| 62 | 62 | |
| 63 | 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 | 65 | article.comments.create!(:author => profile, :title => 'test', :body => 'test') |
| 67 | 66 | result = link_to_comments(article) |
| 68 | 67 | assert_match /One comment/, result | ... | ... |