Commit 82c3dd7b7ec760ad41b2ca15cc12aec207df8067

Authored by Victor Costa
1 parent c4c977dd

rails3: fix broken tests after merge with master

app/models/box.rb
@@ -7,7 +7,7 @@ class Box < ActiveRecord::Base @@ -7,7 +7,7 @@ class Box < ActiveRecord::Base
7 7
8 include Noosfero::Plugin::HotSpot 8 include Noosfero::Plugin::HotSpot
9 9
10 - named_scope :with_position, :conditions => ['boxes.position > 0'] 10 + scope :with_position, :conditions => ['boxes.position > 0']
11 11
12 def environment 12 def environment
13 owner ? (owner.kind_of?(Environment) ? owner : owner.environment) : nil 13 owner ? (owner.kind_of?(Environment) ? owner : owner.environment) : nil
plugins/comment_group/lib/ext/comment.rb
@@ -9,4 +9,6 @@ class Comment @@ -9,4 +9,6 @@ class Comment
9 } 9 }
10 } 10 }
11 11
  12 + attr_accessible :group_id
  13 +
12 end 14 end
plugins/comment_group/views/comment_group_plugin_profile/_comment_group.html.erb
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <div style="float: left"> 3 <div style="float: left">
4 <%= link_to_remote(image_tag("/plugins/comment_group/images/comments.gif"), 4 <%= link_to_remote(image_tag("/plugins/comment_group/images/comments.gif"),
5 :url => { :profile => profile_identifier, :controller => 'comment_group_plugin_profile', :action => 'view_comments', :group_id => group_id, :article_id => article_id}, 5 :url => { :profile => profile_identifier, :controller => 'comment_group_plugin_profile', :action => 'view_comments', :group_id => group_id, :article_id => article_id},
6 - :loaded => visual_effect(:highlight, "comments_list_group_#{group_id}"), 6 + :loaded => j(visual_effect(:highlight, "comments_list_group_#{group_id}")),
7 :method => :post, 7 :method => :post,
8 :condition => "!toggleGroup(#{group_id})", 8 :condition => "!toggleGroup(#{group_id})",
9 :complete => "loadCompleted(#{group_id})")%> 9 :complete => "loadCompleted(#{group_id})")%>
plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
@@ -87,7 +87,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -87,7 +87,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
87 end 87 end
88 88
89 should 'render a div with block id for track list block' do 89 should 'render a div with block id for track list block' do
90 - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) 90 + box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name, :position => 1)
91 @block = create(CommunityTrackPlugin::TrackListBlock, :box => box) 91 @block = create(CommunityTrackPlugin::TrackListBlock, :box => box)
92 @profile.boxes << box 92 @profile.boxes << box
93 get :view_page, @step.url 93 get :view_page, @step.url
@@ -95,7 +95,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -95,7 +95,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
95 end 95 end
96 96
97 should 'render a div with block id for track card list block' do 97 should 'render a div with block id for track card list block' do
98 - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) 98 + box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name, :position => 1)
99 @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) 99 @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box)
100 @profile.boxes << box 100 @profile.boxes << box
101 get :view_page, @step.url 101 get :view_page, @step.url
@@ -103,7 +103,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -103,7 +103,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
103 end 103 end
104 104
105 should 'render tracks in track list block' do 105 should 'render tracks in track list block' do
106 - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) 106 + box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name, :position => 1)
107 @block = create(CommunityTrackPlugin::TrackListBlock, :box => box) 107 @block = create(CommunityTrackPlugin::TrackListBlock, :box => box)
108 @profile.boxes << box 108 @profile.boxes << box
109 get :view_page, @step.url 109 get :view_page, @step.url
@@ -111,7 +111,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -111,7 +111,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
111 end 111 end
112 112
113 should 'render tracks in track card list block' do 113 should 'render tracks in track card list block' do
114 - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) 114 + box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name, :position => 1)
115 @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) 115 @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box)
116 @profile.boxes << box 116 @profile.boxes << box
117 get :view_page, @step.url 117 get :view_page, @step.url
@@ -120,7 +120,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -120,7 +120,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
120 end 120 end
121 121
122 should 'render link to display more tracks in track list block' do 122 should 'render link to display more tracks in track list block' do
123 - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) 123 + box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name, :position => 1)
124 @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) 124 @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box)
125 @profile.boxes << box 125 @profile.boxes << box
126 126
@@ -131,7 +131,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -131,7 +131,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
131 end 131 end
132 132
133 should 'render link to show all tracks in track list block' do 133 should 'render link to show all tracks in track list block' do
134 - box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name) 134 + box = fast_create(Box, :owner_id => @profile.id, :owner_type => @profile.class.name, :position => 1)
135 @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box) 135 @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box)
136 @profile.boxes << box 136 @profile.boxes << box
137 @block.more_another_page = true 137 @block.more_another_page = true
plugins/container_block/test/unit/container_block_plugin/container_block_test.rb
@@ -99,7 +99,7 @@ class ContainerBlockPlugin::ContainerBlockTest &lt; ActiveSupport::TestCase @@ -99,7 +99,7 @@ class ContainerBlockPlugin::ContainerBlockTest &lt; ActiveSupport::TestCase
99 box1 = fast_create(Box, :owner_id => env.id, :owner_type => 'Environment', :position => 1) 99 box1 = fast_create(Box, :owner_id => env.id, :owner_type => 'Environment', :position => 1)
100 box2 = fast_create(Box, :owner_id => env.id, :owner_type => 'Environment', :position => 2) 100 box2 = fast_create(Box, :owner_id => env.id, :owner_type => 'Environment', :position => 2)
101 box3 = fast_create(Box, :owner_id => env.id, :owner_type => 'Environment', :position => 3) 101 box3 = fast_create(Box, :owner_id => env.id, :owner_type => 'Environment', :position => 3)
102 - block = ContainerBlockPlugin::ContainerBlock.create!(:box => box1) 102 + block = create(ContainerBlockPlugin::ContainerBlock, :box => box1)
103 block.destroy 103 block.destroy
104 assert_equal [1, 2, 3], [box1.reload.position, box2.reload.position, box3.reload.position] 104 assert_equal [1, 2, 3], [box1.reload.position, box2.reload.position, box3.reload.position]
105 end 105 end
@@ -114,7 +114,7 @@ class ContainerBlockPlugin::ContainerBlockTest &lt; ActiveSupport::TestCase @@ -114,7 +114,7 @@ class ContainerBlockPlugin::ContainerBlockTest &lt; ActiveSupport::TestCase
114 @block.save! 114 @block.save!
115 @block.box = @block.container_box 115 @block.box = @block.container_box
116 @block.save 116 @block.save
117 - assert @block.errors.invalid?(:box_id) 117 + assert @block.errors.include?(:box_id)
118 end 118 end
119 119
120 end 120 end
plugins/container_block/views/blocks/container.html.erb
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 </script> 28 </script>
29 29
30 <div class="container-block-button-bar button-bar"> 30 <div class="container-block-button-bar button-bar">
31 - <%= link_to_remote '', :url => { :controller => @controller.boxes_holder.kind_of?(Environment) ? 'container_block_plugin_admin' : 'container_block_plugin_myprofile', :action => 'saveWidths', :id => block.id }, 31 + <%= link_to_remote '', :url => { :controller => controller.boxes_holder.kind_of?(Environment) ? 'container_block_plugin_admin' : 'container_block_plugin_myprofile', :action => 'saveWidths', :id => block.id },
32 :with => "containerChildrenWidth(#{block.id}, #{block.container_box.id})", 32 :with => "containerChildrenWidth(#{block.id}, #{block.container_box.id})",
33 :html => {:class => "button icon-save container_block_save", :id => "container_block_save_#{block.id}", :title => _('Save') }, 33 :html => {:class => "button icon-save container_block_save", :id => "container_block_save_#{block.id}", :title => _('Save') },
34 :loading => "open_loading(DEFAULT_LOADING_MESSAGE);", 34 :loading => "open_loading(DEFAULT_LOADING_MESSAGE);",
test/unit/comment_test.rb
@@ -307,7 +307,7 @@ class CommentTest &lt; ActiveSupport::TestCase @@ -307,7 +307,7 @@ class CommentTest &lt; ActiveSupport::TestCase
307 c0 = Comment.create(:source => a, :body => 'Root comment', :author => person) 307 c0 = Comment.create(:source => a, :body => 'Root comment', :author => person)
308 c1 = Comment.create(:reply_of_id => c0.id, :source => a, :body => 'c1', :author => person) 308 c1 = Comment.create(:reply_of_id => c0.id, :source => a, :body => 'c1', :author => person)
309 c2 = Comment.create(:source => a, :body => 'c2', :author => person) 309 c2 = Comment.create(:source => a, :body => 'c2', :author => person)
310 - spam = Comment.create(:spam => true, :reply_of_id => c2.id, :source => a, :body => 'spam', :author => person) 310 + spam = create(Comment, :spam => true, :reply_of_id => c2.id, :source => a, :body => 'spam', :author => person)
311 spam_reply = Comment.create(:reply_of_id => spam.id, :source => a, :body => 'spam reply', :author => person) 311 spam_reply = Comment.create(:reply_of_id => spam.id, :source => a, :body => 'spam reply', :author => person)
312 result = a.activity.comments 312 result = a.activity.comments
313 assert_equal c0, result[0] 313 assert_equal c0, result[0]