From 0da263565bd1eb370f230426a55ca5acb1c1b4b6 Mon Sep 17 00:00:00 2001 From: Evandro Junior Date: Tue, 10 Mar 2015 16:51:34 -0300 Subject: [PATCH] guarantee main block is always visible to everybody --- app/models/main_block.rb | 6 ++++++ test/functional/profile_design_controller_test.rb | 8 ++++++++ test/unit/main_block_test.rb | 4 ++++ 3 files changed, 18 insertions(+), 0 deletions(-) diff --git a/app/models/main_block.rb b/app/models/main_block.rb index a834c11..0ed3650 100644 --- a/app/models/main_block.rb +++ b/app/models/main_block.rb @@ -24,4 +24,10 @@ class MainBlock < Block ['always', 'except_home_page'] end + def display_user_options + @display_user_options = { + 'all' => _('All users') + } + end + end diff --git a/test/functional/profile_design_controller_test.rb b/test/functional/profile_design_controller_test.rb index b0dde3d..bbe55ac 100644 --- a/test/functional/profile_design_controller_test.rb +++ b/test/functional/profile_design_controller_test.rb @@ -755,4 +755,12 @@ class ProfileDesignControllerTest < ActionController::TestCase assert_response :forbidden end + should 'guarantee main block is always visible to everybody' do + get :edit, :profile => 'designtestuser', :id => @b4.id + %w[logged not_logged followers].each do |option| + assert_no_tag :select, :attributes => {:name => 'block[display_user]'}, + :descendant => {:tag => 'option', :attributes => {:value => option}} + end + end + end diff --git a/test/unit/main_block_test.rb b/test/unit/main_block_test.rb index ce2c18d..1124416 100644 --- a/test/unit/main_block_test.rb +++ b/test/unit/main_block_test.rb @@ -29,4 +29,8 @@ class MainBlockTest < ActiveSupport::TestCase assert !block.visible? end + should 'guarantee main block is always visible to everybody' do + assert_equal MainBlock.new.display_user_options, {"all"=>_('All users')} + end + end -- libgit2 0.21.2