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  
8 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 12 def environment
13 13 owner ? (owner.kind_of?(Environment) ? owner : owner.environment) : nil
... ...
plugins/comment_group/lib/ext/comment.rb
... ... @@ -9,4 +9,6 @@ class Comment
9 9 }
10 10 }
11 11  
  12 + attr_accessible :group_id
  13 +
12 14 end
... ...
plugins/comment_group/views/comment_group_plugin_profile/_comment_group.html.erb
... ... @@ -3,7 +3,7 @@
3 3 <div style="float: left">
4 4 <%= link_to_remote(image_tag("/plugins/comment_group/images/comments.gif"),
5 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 7 :method => :post,
8 8 :condition => "!toggleGroup(#{group_id})",
9 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 87 end
88 88  
89 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 91 @block = create(CommunityTrackPlugin::TrackListBlock, :box => box)
92 92 @profile.boxes << box
93 93 get :view_page, @step.url
... ... @@ -95,7 +95,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
95 95 end
96 96  
97 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 99 @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box)
100 100 @profile.boxes << box
101 101 get :view_page, @step.url
... ... @@ -103,7 +103,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
103 103 end
104 104  
105 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 107 @block = create(CommunityTrackPlugin::TrackListBlock, :box => box)
108 108 @profile.boxes << box
109 109 get :view_page, @step.url
... ... @@ -111,7 +111,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
111 111 end
112 112  
113 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 115 @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box)
116 116 @profile.boxes << box
117 117 get :view_page, @step.url
... ... @@ -120,7 +120,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
120 120 end
121 121  
122 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 124 @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box)
125 125 @profile.boxes << box
126 126  
... ... @@ -131,7 +131,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
131 131 end
132 132  
133 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 135 @block = create(CommunityTrackPlugin::TrackCardListBlock, :box => box)
136 136 @profile.boxes << box
137 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 99 box1 = fast_create(Box, :owner_id => env.id, :owner_type => 'Environment', :position => 1)
100 100 box2 = fast_create(Box, :owner_id => env.id, :owner_type => 'Environment', :position => 2)
101 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 103 block.destroy
104 104 assert_equal [1, 2, 3], [box1.reload.position, box2.reload.position, box3.reload.position]
105 105 end
... ... @@ -114,7 +114,7 @@ class ContainerBlockPlugin::ContainerBlockTest &lt; ActiveSupport::TestCase
114 114 @block.save!
115 115 @block.box = @block.container_box
116 116 @block.save
117   - assert @block.errors.invalid?(:box_id)
  117 + assert @block.errors.include?(:box_id)
118 118 end
119 119  
120 120 end
... ...
plugins/container_block/views/blocks/container.html.erb
... ... @@ -28,7 +28,7 @@
28 28 </script>
29 29  
30 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 32 :with => "containerChildrenWidth(#{block.id}, #{block.container_box.id})",
33 33 :html => {:class => "button icon-save container_block_save", :id => "container_block_save_#{block.id}", :title => _('Save') },
34 34 :loading => "open_loading(DEFAULT_LOADING_MESSAGE);",
... ...
test/unit/comment_test.rb
... ... @@ -307,7 +307,7 @@ class CommentTest &lt; ActiveSupport::TestCase
307 307 c0 = Comment.create(:source => a, :body => 'Root comment', :author => person)
308 308 c1 = Comment.create(:reply_of_id => c0.id, :source => a, :body => 'c1', :author => person)
309 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 311 spam_reply = Comment.create(:reply_of_id => spam.id, :source => a, :body => 'spam reply', :author => person)
312 312 result = a.activity.comments
313 313 assert_equal c0, result[0]
... ...