From 82c3dd7b7ec760ad41b2ca15cc12aec207df8067 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Fri, 7 Mar 2014 15:33:10 -0300 Subject: [PATCH] rails3: fix broken tests after merge with master --- app/models/box.rb | 2 +- plugins/comment_group/lib/ext/comment.rb | 2 ++ plugins/comment_group/views/comment_group_plugin_profile/_comment_group.html.erb | 2 +- plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb | 12 ++++++------ plugins/container_block/test/unit/container_block_plugin/container_block_test.rb | 4 ++-- plugins/container_block/views/blocks/container.html.erb | 2 +- test/unit/comment_test.rb | 2 +- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/models/box.rb b/app/models/box.rb index 64bbbed..1a6535d 100644 --- a/app/models/box.rb +++ b/app/models/box.rb @@ -7,7 +7,7 @@ class Box < ActiveRecord::Base include Noosfero::Plugin::HotSpot - named_scope :with_position, :conditions => ['boxes.position > 0'] + scope :with_position, :conditions => ['boxes.position > 0'] def environment owner ? (owner.kind_of?(Environment) ? owner : owner.environment) : nil diff --git a/plugins/comment_group/lib/ext/comment.rb b/plugins/comment_group/lib/ext/comment.rb index 3298b85..d1e0df2 100644 --- a/plugins/comment_group/lib/ext/comment.rb +++ b/plugins/comment_group/lib/ext/comment.rb @@ -9,4 +9,6 @@ class Comment } } + attr_accessible :group_id + end diff --git a/plugins/comment_group/views/comment_group_plugin_profile/_comment_group.html.erb b/plugins/comment_group/views/comment_group_plugin_profile/_comment_group.html.erb index c7c7644..21856ae 100644 --- a/plugins/comment_group/views/comment_group_plugin_profile/_comment_group.html.erb +++ b/plugins/comment_group/views/comment_group_plugin_profile/_comment_group.html.erb @@ -3,7 +3,7 @@
<%= link_to_remote(image_tag("/plugins/comment_group/images/comments.gif"), :url => { :profile => profile_identifier, :controller => 'comment_group_plugin_profile', :action => 'view_comments', :group_id => group_id, :article_id => article_id}, - :loaded => visual_effect(:highlight, "comments_list_group_#{group_id}"), + :loaded => j(visual_effect(:highlight, "comments_list_group_#{group_id}")), :method => :post, :condition => "!toggleGroup(#{group_id})", :complete => "loadCompleted(#{group_id})")%> diff --git a/plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb b/plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb index 8f13670..ce605ad 100644 --- a/plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb +++ b/plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb @@ -87,7 +87,7 @@ class ContentViewerControllerTest < ActionController::TestCase end should 'render a div with block id for track list block' do - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) + box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name, :position => 1) @block = create(CommunityTrackPlugin::TrackListBlock, :box => box) @profile.boxes << box get :view_page, @step.url @@ -95,7 +95,7 @@ class ContentViewerControllerTest < ActionController::TestCase end should 'render a div with block id for track card list block' do - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) + box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name, :position => 1) @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) @profile.boxes << box get :view_page, @step.url @@ -103,7 +103,7 @@ class ContentViewerControllerTest < ActionController::TestCase end should 'render tracks in track list block' do - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) + box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name, :position => 1) @block = create(CommunityTrackPlugin::TrackListBlock, :box => box) @profile.boxes << box get :view_page, @step.url @@ -111,7 +111,7 @@ class ContentViewerControllerTest < ActionController::TestCase end should 'render tracks in track card list block' do - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) + box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name, :position => 1) @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) @profile.boxes << box get :view_page, @step.url @@ -120,7 +120,7 @@ class ContentViewerControllerTest < ActionController::TestCase end should 'render link to display more tracks in track list block' do - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) + box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name, :position => 1) @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) @profile.boxes << box @@ -131,7 +131,7 @@ class ContentViewerControllerTest < ActionController::TestCase end should 'render link to show all tracks in track list block' do - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) + box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name, :position => 1) @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) @profile.boxes << box @block.more_another_page = true diff --git a/plugins/container_block/test/unit/container_block_plugin/container_block_test.rb b/plugins/container_block/test/unit/container_block_plugin/container_block_test.rb index dcd85c0..321fb33 100644 --- a/plugins/container_block/test/unit/container_block_plugin/container_block_test.rb +++ b/plugins/container_block/test/unit/container_block_plugin/container_block_test.rb @@ -99,7 +99,7 @@ class ContainerBlockPlugin::ContainerBlockTest < ActiveSupport::TestCase box1 = fast_create(Box, :owner_id => env.id, :owner_type => 'Environment', :position => 1) box2 = fast_create(Box, :owner_id => env.id, :owner_type => 'Environment', :position => 2) box3 = fast_create(Box, :owner_id => env.id, :owner_type => 'Environment', :position => 3) - block = ContainerBlockPlugin::ContainerBlock.create!(:box => box1) + block = create(ContainerBlockPlugin::ContainerBlock, :box => box1) block.destroy assert_equal [1, 2, 3], [box1.reload.position, box2.reload.position, box3.reload.position] end @@ -114,7 +114,7 @@ class ContainerBlockPlugin::ContainerBlockTest < ActiveSupport::TestCase @block.save! @block.box = @block.container_box @block.save - assert @block.errors.invalid?(:box_id) + assert @block.errors.include?(:box_id) end end diff --git a/plugins/container_block/views/blocks/container.html.erb b/plugins/container_block/views/blocks/container.html.erb index 47477a3..6da5913 100644 --- a/plugins/container_block/views/blocks/container.html.erb +++ b/plugins/container_block/views/blocks/container.html.erb @@ -28,7 +28,7 @@
- <%= link_to_remote '', :url => { :controller => @controller.boxes_holder.kind_of?(Environment) ? 'container_block_plugin_admin' : 'container_block_plugin_myprofile', :action => 'saveWidths', :id => block.id }, + <%= link_to_remote '', :url => { :controller => controller.boxes_holder.kind_of?(Environment) ? 'container_block_plugin_admin' : 'container_block_plugin_myprofile', :action => 'saveWidths', :id => block.id }, :with => "containerChildrenWidth(#{block.id}, #{block.container_box.id})", :html => {:class => "button icon-save container_block_save", :id => "container_block_save_#{block.id}", :title => _('Save') }, :loading => "open_loading(DEFAULT_LOADING_MESSAGE);", diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index 3591560..bea4e87 100644 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.rb @@ -307,7 +307,7 @@ class CommentTest < ActiveSupport::TestCase c0 = Comment.create(:source => a, :body => 'Root comment', :author => person) c1 = Comment.create(:reply_of_id => c0.id, :source => a, :body => 'c1', :author => person) c2 = Comment.create(:source => a, :body => 'c2', :author => person) - spam = Comment.create(:spam => true, :reply_of_id => c2.id, :source => a, :body => 'spam', :author => person) + spam = create(Comment, :spam => true, :reply_of_id => c2.id, :source => a, :body => 'spam', :author => person) spam_reply = Comment.create(:reply_of_id => spam.id, :source => a, :body => 'spam reply', :author => person) result = a.activity.comments assert_equal c0, result[0] -- libgit2 0.21.2