Commit 2e9bff75949eba9a354245a79f412bcaa6486c19

Authored by Daniela Feitosa
1 parent 518ec830

Fixed broken tests

app/controllers/public/profile_controller.rb
@@ -264,7 +264,7 @@ class ProfileController < PublicController @@ -264,7 +264,7 @@ class ProfileController < PublicController
264 264
265 def profile_info 265 def profile_info
266 begin 266 begin
267 - @block = profile.blocks.find(params[:block_id]).includes(:box) 267 + @block = profile.blocks.find(params[:block_id])
268 rescue 268 rescue
269 render :text => _('Profile information could not be loaded') 269 render :text => _('Profile information could not be loaded')
270 end 270 end
test/functional/application_controller_test.rb
@@ -296,15 +296,20 @@ class ApplicationControllerTest < ActionController::TestCase @@ -296,15 +296,20 @@ class ApplicationControllerTest < ActionController::TestCase
296 296
297 should 'not display invisible blocks' do 297 should 'not display invisible blocks' do
298 @controller.expects(:uses_design_blocks?).returns(true) 298 @controller.expects(:uses_design_blocks?).returns(true)
299 - p = create_user_full('test_user').person 299 + p = create_user('test_user').person
300 @controller.expects(:profile).at_least_once.returns(p) 300 @controller.expects(:profile).at_least_once.returns(p)
301 - b = p.blocks[1]  
302 - b.expects(:visible?).returns(false)  
303 - b.save!  
304 301
305 - get :index, :profile => p.identifier 302 + box = p.boxes.first
  303 + invisible_block = fast_create(Block, :box_id => box.id)
  304 + invisible_block.display = 'never'
  305 + invisible_block.save
  306 + visible_block = fast_create(Block, :box_id => box.id)
  307 + visible_block.display = 'always'
  308 + visible_block.save
306 309
307 - assert_no_tag :tag => 'div', :attributes => {:id => 'block-' + b.id.to_s} 310 + get :index, :profile => p.identifier
  311 + assert_no_tag :tag => 'div', :attributes => {:id => 'block-' + invisible_block.id.to_s}
  312 + assert_tag :tag => 'div', :attributes => {:id => 'block-' + visible_block.id.to_s}
308 end 313 end
309 314
310 should 'diplay name of environment in description' do 315 should 'diplay name of environment in description' do