diff --git a/Gemfile b/Gemfile index 5fb098f..9cac92e 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem 'exception_notification', '~> 4.0.1' gem 'gettext', '~> 2.2.1', :require => false gem 'locale', '~> 2.0.5' gem 'whenever', :require => false -gem 'eita-jrails', '>= 0.9.8', require: 'jrails' +gem 'eita-jrails', '>= 0.9.9', require: 'jrails' # asset pipeline gem 'uglifier', '>= 1.0.3' diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 865150d..3c1282a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -156,7 +156,7 @@ class ApplicationController < ActionController::Base def render_not_found(path = nil) @no_design_blocks = true @path ||= request.path - render :template => 'shared/not_found.html.erb', :status => 404, :layout => get_layout + render template: 'shared/not_found', status: 404, layout: get_layout end alias :render_404 :render_not_found @@ -164,7 +164,7 @@ class ApplicationController < ActionController::Base @no_design_blocks = true @message = message @title = title - render :template => 'shared/access_denied.html.erb', :status => 403 + render template: 'shared/access_denied', status: 403 end def load_category diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index c8b6685..e7d75ae 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -113,7 +113,7 @@ class AccountController < ApplicationController @user.signup! owner_role = Role.find_by_name('owner') @user.person.affiliate(@user.person, [owner_role]) if owner_role - invitation = Task.from_code @invitation_code + invitation = Task.from_code(@invitation_code).first if invitation invitation.update_attributes!({:friend => @user.person}) invitation.finish @@ -205,7 +205,7 @@ class AccountController < ApplicationController # # Posts back. def new_password - @change_password = ChangePassword.from_code params[:code] + @change_password = ChangePassword.from_code(params[:code]).first unless @change_password render :action => 'invalid_change_password_code', :status => 403 @@ -398,7 +398,7 @@ class AccountController < ApplicationController end def load_enterprise_activation - @enterprise_activation ||= EnterpriseActivation.from_code params[:enterprise_code] + @enterprise_activation ||= EnterpriseActivation.from_code(params[:enterprise_code]).first end def load_enterprise diff --git a/app/controllers/public/search_controller.rb b/app/controllers/public/search_controller.rb index 1001baa..4fe8d9e 100644 --- a/app/controllers/public/search_controller.rb +++ b/app/controllers/public/search_controller.rb @@ -67,7 +67,7 @@ class SearchController < PublicController end def contents - redirect_to params.merge(:action => :articles) + redirect_to url_for(params.merge action: :articles) end def people @@ -124,7 +124,7 @@ class SearchController < PublicController # keep old URLs workings def assets params[:action] = params[:asset].is_a?(Array) ? :index : params.delete(:asset) - redirect_to params + redirect_to url_for(params) end def tags diff --git a/app/views/comment/_comment_form.html.erb b/app/views/comment/_comment_form.html.erb index ecbc9cd..a4ba5ce 100644 --- a/app/views/comment/_comment_form.html.erb +++ b/app/views/comment/_comment_form.html.erb @@ -55,7 +55,7 @@ function check_captcha(button, confirm_action) {
<%= link_to(_('Post a comment'), '#', :class => 'display-comment-form') if display_link && @comment.reply_of_id.blank? %> -<%= remote_form_for(:comment, @comment, :url => {:profile => profile.identifier, :controller => 'comment', :action => (edition_mode ? 'update' : 'create'), :id => (edition_mode ? @comment.id : @page.id)}, :html => { :class => 'comment_form' } ) do |f| %> +<%= remote_form_for(@comment, :url => {:profile => profile.identifier, :controller => 'comment', :action => (edition_mode ? 'update' : 'create'), :id => (edition_mode ? @comment.id : @page.id)}, :html => { :class => 'comment_form' } ) do |f| %> <%= required_fields_message %> diff --git a/app/views/manage_products/new.html.erb b/app/views/manage_products/new.html.erb index 806c32f..867dda0 100644 --- a/app/views/manage_products/new.html.erb +++ b/app/views/manage_products/new.html.erb @@ -2,7 +2,7 @@ -<%= remote_form_for :product, @product, +<%= remote_form_for @product, :loading => "open_loading('#{ _('loading...') }')", :update => "request_result_message", :url => {:action => 'new'}, diff --git a/app/views/profile_search/_results-list.html.erb b/app/views/profile_search/_results-list.html.erb deleted file mode 100644 index 5b68f41..0000000 --- a/app/views/profile_search/_results-list.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -
- <% if @results %> -
- <%= _("%s results found") % @results.total_entries %> -
- - - - <%= pagination_links @results %> - <% end %> -
diff --git a/app/views/profile_search/_results_list.html.erb b/app/views/profile_search/_results_list.html.erb new file mode 100644 index 0000000..5b68f41 --- /dev/null +++ b/app/views/profile_search/_results_list.html.erb @@ -0,0 +1,15 @@ +
+ <% if @results %> +
+ <%= _("%s results found") % @results.total_entries %> +
+ + + + <%= pagination_links @results %> + <% end %> +
diff --git a/app/views/profile_search/index.html.erb b/app/views/profile_search/index.html.erb index 8eedad7..4d4c955 100644 --- a/app/views/profile_search/index.html.erb +++ b/app/views/profile_search/index.html.erb @@ -3,7 +3,7 @@ <%= render :partial => 'shared/profile_search_form' %> - <%= render :partial => 'results-list' %> + <%= render 'results_list' %>
<%= javascript_include_tag 'search' %> diff --git a/app/views/profile_search/index.js.erb b/app/views/profile_search/index.js.erb index 466b9cf..4ca7a03 100644 --- a/app/views/profile_search/index.js.erb +++ b/app/views/profile_search/index.js.erb @@ -1 +1 @@ -jQuery('#search-content').html('<%= escape_javascript(render :partial => "results-list") %>'); +jQuery('#search-content').html('<%= j render 'results_list' %>'); diff --git a/app/views/shared/logged_in/xmpp_chat.html.erb b/app/views/shared/logged_in/xmpp_chat.html.erb index 85a1c0a..9a63c60 100644 --- a/app/views/shared/logged_in/xmpp_chat.html.erb +++ b/app/views/shared/logged_in/xmpp_chat.html.erb @@ -1,4 +1,4 @@ - <%= javascript_include_tag 'strophejs-1.1.3/strophe.min', 'jquery.emoticon', '../designs/icons/pidgin/emoticons.js', 'ba-linkify', 'jquery.ba-hashchange', 'jquery.sound', 'chat', 'perfect-scrollbar.min.js', 'perfect-scrollbar.with-mousewheel.min.js', 'jquery.timeago.js', :cache => 'cache/chat' %> + <%= javascript_include_tag 'strophejs-1.1.3/strophe.min', 'jquery.emoticon', '../designs/icons/pidgin/emoticons.js', 'ba-linkify', 'jquery.ba-hashchange', 'jquery.sound', 'chat', 'perfect-scrollbar.min.js', 'perfect-scrollbar.with-mousewheel.min.js', 'jquery.timeago.js' %> <%= stylesheet_link_tag 'perfect-scrollbar.min.css' %> <% extend ChatHelper %> diff --git a/plugins/breadcrumbs/test/functional/profile_design_controller_test.rb b/plugins/breadcrumbs/test/functional/profile_design_controller_test.rb index 94dc8bb..dce83e3 100644 --- a/plugins/breadcrumbs/test/functional/profile_design_controller_test.rb +++ b/plugins/breadcrumbs/test/functional/profile_design_controller_test.rb @@ -1,12 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' -class ProfileDesignController - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - def rescue_action(e) - raise e - end -end - class ProfileDesignControllerTest < ActionController::TestCase def setup diff --git a/plugins/bsc/test/functional/bsc_plugin_admin_controller_test.rb b/plugins/bsc/test/functional/bsc_plugin_admin_controller_test.rb index c277874..c133a5a 100644 --- a/plugins/bsc/test/functional/bsc_plugin_admin_controller_test.rb +++ b/plugins/bsc/test/functional/bsc_plugin_admin_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/bsc_plugin_admin_controller' -# Re-raise errors caught by the controller. -class BscPluginAdminController; def rescue_action(e) raise e end; end - class BscPluginAdminControllerTest < ActionController::TestCase VALID_CNPJ = '94.132.024/0001-48' diff --git a/plugins/bsc/test/functional/bsc_plugin_myprofile_controller_test.rb b/plugins/bsc/test/functional/bsc_plugin_myprofile_controller_test.rb index c99ee67..07b9c17 100644 --- a/plugins/bsc/test/functional/bsc_plugin_myprofile_controller_test.rb +++ b/plugins/bsc/test/functional/bsc_plugin_myprofile_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/bsc_plugin_myprofile_controller' -# Re-raise errors caught by the controller. -class BscPluginMyprofileController; def rescue_action(e) raise e end; end - class BscPluginMyprofileControllerTest < ActionController::TestCase VALID_CNPJ = '94.132.024/0001-48' diff --git a/plugins/classify_members/test/functional/classify_members_plugin_test.rb b/plugins/classify_members/test/functional/classify_members_plugin_test.rb index 9901c23..5de5efe 100644 --- a/plugins/classify_members/test/functional/classify_members_plugin_test.rb +++ b/plugins/classify_members/test/functional/classify_members_plugin_test.rb @@ -1,12 +1,5 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' -# Re-raise errors caught by the controller. -class HomeController - def rescue_action(e) - raise e - end -end - class ProfileControllerTest < ActionController::TestCase def setup @env = Environment.default diff --git a/plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb b/plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb index 60c0ec3..c52dacd 100644 --- a/plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb +++ b/plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../test_helper' require File.dirname(__FILE__) + '/../../controllers/profile/comment_group_plugin_profile_controller' -# Re-raise errors caught by the controller. -class CommentGroupPluginProfileController; def rescue_action(e) raise e end; end - class CommentGroupPluginProfileControllerTest < ActionController::TestCase def setup diff --git a/plugins/comment_group/test/functional/comment_group_plugin_public_controller_test.rb b/plugins/comment_group/test/functional/comment_group_plugin_public_controller_test.rb index f6b26c1..323b475 100644 --- a/plugins/comment_group/test/functional/comment_group_plugin_public_controller_test.rb +++ b/plugins/comment_group/test/functional/comment_group_plugin_public_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../test_helper' require File.dirname(__FILE__) + '/../../controllers/public/comment_group_plugin_public_controller' -# Re-raise errors caught by the controller. -class CommentGroupPluginPublicController; def rescue_action(e) raise e end; end - class CommentGroupPluginPublicControllerTest < ActionController::TestCase def setup diff --git a/plugins/comment_group/test/functional/content_viewer_controller_test.rb b/plugins/comment_group/test/functional/content_viewer_controller_test.rb index 1a47b4b..0cf4523 100644 --- a/plugins/comment_group/test/functional/content_viewer_controller_test.rb +++ b/plugins/comment_group/test/functional/content_viewer_controller_test.rb @@ -1,12 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' -class ContentViewerController - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - def rescue_action(e) - raise e - end -end - class ContentViewerControllerTest < ActionController::TestCase def setup diff --git a/plugins/community_block/test/functional/commmunity_block_plugin_profile_controller_test.rb b/plugins/community_block/test/functional/commmunity_block_plugin_profile_controller_test.rb index 649d859..fcf914b 100644 --- a/plugins/community_block/test/functional/commmunity_block_plugin_profile_controller_test.rb +++ b/plugins/community_block/test/functional/commmunity_block_plugin_profile_controller_test.rb @@ -1,13 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' -# Re-raise errors caught by the controller. -class ProfileController - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - def rescue_action(e) - raise e - end -end - class ProfileControllerTest < ActionController::TestCase def setup diff --git a/plugins/community_track/test/functional/community_track_plugin_cms_controller_test.rb b/plugins/community_track/test/functional/community_track_plugin_cms_controller_test.rb index 1487afe..28e2812 100644 --- a/plugins/community_track/test/functional/community_track_plugin_cms_controller_test.rb +++ b/plugins/community_track/test/functional/community_track_plugin_cms_controller_test.rb @@ -1,8 +1,5 @@ require_relative '../test_helper' -# Re-raise errors caught by the controller. -class CmsController; def rescue_action(e) raise e end; end - class CmsControllerTest < ActionController::TestCase def setup 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 271378f..ce79df6 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 @@ -1,6 +1,5 @@ require_relative '../test_helper' -class ContentViewerController; def rescue_action(e) raise e end; end class ContentViewerControllerTest < ActionController::TestCase def setup diff --git a/plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb b/plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb index e09d1ef..c02689f 100644 --- a/plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb +++ b/plugins/community_track/test/functional/community_track_plugin_environment_design_controller_test.rb @@ -1,8 +1,5 @@ require_relative '../test_helper' -# Re-raise errors caught by the controller. -class EnvironmentDesignController; def rescue_action(e) raise e end; end - class EnvironmentDesignControllerTest < ActionController::TestCase def setup diff --git a/plugins/community_track/test/functional/community_track_plugin_myprofile_controller_test.rb b/plugins/community_track/test/functional/community_track_plugin_myprofile_controller_test.rb index 276d9f3..7c5b352 100644 --- a/plugins/community_track/test/functional/community_track_plugin_myprofile_controller_test.rb +++ b/plugins/community_track/test/functional/community_track_plugin_myprofile_controller_test.rb @@ -1,9 +1,6 @@ require_relative '../test_helper' require_relative '../../controllers/myprofile/community_track_plugin_myprofile_controller' -# Re-raise errors caught by the controller. -class CommunityTrackPluginMyprofileController; def rescue_action(e) raise e end; end - class CommunityTrackPluginMyprofileControllerTest < ActionController::TestCase def setup diff --git a/plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb b/plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb index a6ad411..4a807eb 100644 --- a/plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb +++ b/plugins/community_track/test/functional/community_track_plugin_public_controller_test.rb @@ -1,9 +1,6 @@ require_relative '../test_helper' require_relative '../../controllers/public/community_track_plugin_public_controller' -# Re-raise errors caught by the controller. -class CommunityTrackPluginPublicController; def rescue_action(e) raise e end; end - class CommunityTrackPluginPublicControllerTest < ActionController::TestCase def setup diff --git a/plugins/container_block/test/functional/container_block_environment_design_controller_test.rb b/plugins/container_block/test/functional/container_block_environment_design_controller_test.rb index ce16a9f..efb031d 100644 --- a/plugins/container_block/test/functional/container_block_environment_design_controller_test.rb +++ b/plugins/container_block/test/functional/container_block_environment_design_controller_test.rb @@ -1,13 +1,5 @@ require 'test_helper' -# Re-raise errors caught by the controller. -class EnvironmentDesignController - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - def rescue_action(e) - raise e - end -end - class EnvironmentDesignControllerTest < ActionController::TestCase def setup diff --git a/plugins/container_block/test/functional/container_block_home_controller_test.rb b/plugins/container_block/test/functional/container_block_home_controller_test.rb index 526d96b..9fae508 100644 --- a/plugins/container_block/test/functional/container_block_home_controller_test.rb +++ b/plugins/container_block/test/functional/container_block_home_controller_test.rb @@ -1,13 +1,5 @@ require 'test_helper' -# Re-raise errors caught by the controller. -class HomeController - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - def rescue_action(e) - raise e - end -end - class HomeControllerTest < ActionController::TestCase def setup @@ -22,7 +14,7 @@ class HomeControllerTest < ActionController::TestCase box = create(Box, :owner => @environment) @block = create(ContainerBlockPlugin::ContainerBlock, :box => box) - + @environment.boxes = [box] end diff --git a/plugins/context_content/test/functional/content_viewer_controller_test.rb b/plugins/context_content/test/functional/content_viewer_controller_test.rb index 010fd28..6be97fb 100644 --- a/plugins/context_content/test/functional/content_viewer_controller_test.rb +++ b/plugins/context_content/test/functional/content_viewer_controller_test.rb @@ -1,12 +1,5 @@ require 'test_helper' -class ContentViewerController - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - def rescue_action(e) - raise e - end -end - class ContentViewerControllerTest < ActionController::TestCase def setup diff --git a/plugins/context_content/test/functional/profile_design_controller_test.rb b/plugins/context_content/test/functional/profile_design_controller_test.rb index 2345c21..08cfe00 100644 --- a/plugins/context_content/test/functional/profile_design_controller_test.rb +++ b/plugins/context_content/test/functional/profile_design_controller_test.rb @@ -1,12 +1,5 @@ require 'test_helper' -class ProfileDesignController - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - def rescue_action(e) - raise e - end -end - class ProfileDesignControllerTest < ActionController::TestCase def setup diff --git a/plugins/custom_forms/test/functional/custom_forms_plugin_myprofile_controller_test.rb b/plugins/custom_forms/test/functional/custom_forms_plugin_myprofile_controller_test.rb index 892c150..71eb6c6 100644 --- a/plugins/custom_forms/test/functional/custom_forms_plugin_myprofile_controller_test.rb +++ b/plugins/custom_forms/test/functional/custom_forms_plugin_myprofile_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/custom_forms_plugin_myprofile_controller' -# Re-raise errors caught by the controller. -class CustomFormsPluginMyprofileController; def rescue_action(e) raise e end; end - class CustomFormsPluginMyprofileControllerTest < ActionController::TestCase def setup @controller = CustomFormsPluginMyprofileController.new diff --git a/plugins/custom_forms/test/functional/custom_forms_plugin_profile_controller_test.rb b/plugins/custom_forms/test/functional/custom_forms_plugin_profile_controller_test.rb index d6976b0..945585e 100644 --- a/plugins/custom_forms/test/functional/custom_forms_plugin_profile_controller_test.rb +++ b/plugins/custom_forms/test/functional/custom_forms_plugin_profile_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/custom_forms_plugin_profile_controller' -# Re-raise errors caught by the controller. -class CustomFormsPluginProfileController; def rescue_action(e) raise e end; end - class CustomFormsPluginProfileControllerTest < ActionController::TestCase def setup @controller = CustomFormsPluginProfileController.new diff --git a/plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb b/plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb index ce35191..f494731 100644 --- a/plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb +++ b/plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb @@ -1,10 +1,6 @@ require File.dirname(__FILE__) + '/../test_helper' require File.dirname(__FILE__) + '/../../controllers/display_content_plugin_admin_controller' - -# Re-raise errors caught by the controller. -class DisplayContentPluginAdminControllerController; def rescue_action(e) raise e end; end - class DisplayContentPluginAdminControllerTest < ActionController::TestCase def setup diff --git a/plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb b/plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb index 331158a..478bf63 100644 --- a/plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb +++ b/plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb @@ -1,10 +1,6 @@ require File.dirname(__FILE__) + '/../test_helper' require File.dirname(__FILE__) + '/../../controllers/display_content_plugin_myprofile_controller' - -# Re-raise errors caught by the controller. -class DisplayContentPluginMyprofileControllerController; def rescue_action(e) raise e end; end - class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase def setup diff --git a/plugins/event/test/functional/event_block_test.rb b/plugins/event/test/functional/event_block_test.rb index 7093779..6a9fd3b 100644 --- a/plugins/event/test/functional/event_block_test.rb +++ b/plugins/event/test/functional/event_block_test.rb @@ -1,13 +1,5 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' -# Re-raise errors caught by the controller. -class HomeController - #append_view_path File.join(File.dirname(__FILE__) + '/../../views') - def rescue_action(e) - raise e - end -end - class HomeControllerTest < ActionController::TestCase def setup diff --git a/plugins/google_analytics/test/functional/profile_editor_controller_test.rb b/plugins/google_analytics/test/functional/profile_editor_controller_test.rb index 1be3bb4..69e6123 100644 --- a/plugins/google_analytics/test/functional/profile_editor_controller_test.rb +++ b/plugins/google_analytics/test/functional/profile_editor_controller_test.rb @@ -1,9 +1,6 @@ require 'test_helper' require 'profile_editor_controller' -# Re-raise errors caught by the controller. -class ProfileEditorController; def rescue_action(e) raise e end; end - class ProfileEditorControllerTest < ActionController::TestCase def setup diff --git a/plugins/google_cse/test/functional/google_cse_plugin_controller_test.rb b/plugins/google_cse/test/functional/google_cse_plugin_controller_test.rb index b5c4a80..63a058b 100644 --- a/plugins/google_cse/test/functional/google_cse_plugin_controller_test.rb +++ b/plugins/google_cse/test/functional/google_cse_plugin_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/google_cse_plugin_controller' -# Re-raise errors caught by the controller. -class GoogleCsePluginController; def rescue_action(e) raise e end; end - class GoogleCsePluginControllerTest < ActionController::TestCase def setup diff --git a/plugins/html5_video/test/functional/content_viewer_controler_test.rb b/plugins/html5_video/test/functional/content_viewer_controler_test.rb index 5a0f494..5faeeb4 100644 --- a/plugins/html5_video/test/functional/content_viewer_controler_test.rb +++ b/plugins/html5_video/test/functional/content_viewer_controler_test.rb @@ -1,12 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require 'content_viewer_controller' -class ContentViewerController - # Re-raise errors caught by the controller. - def rescue_action(e) raise e end - append_view_path File.join(File.dirname(__FILE__) + '/../../views') -end - class ContentViewerControllerTest < ActionController::TestCase all_fixtures diff --git a/plugins/ldap/test/functional/account_controller_plugin_test.rb b/plugins/ldap/test/functional/account_controller_plugin_test.rb index 412c695..10e59ac 100644 --- a/plugins/ldap/test/functional/account_controller_plugin_test.rb +++ b/plugins/ldap/test/functional/account_controller_plugin_test.rb @@ -1,8 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' -# Re-raise errors caught by the controller. -class AccountController; def rescue_action(e) raise e end; end - class AccountControllerPluginTest < ActionController::TestCase def setup diff --git a/plugins/ldap/test/functional/ldap_plugin_admin_controller_test.rb b/plugins/ldap/test/functional/ldap_plugin_admin_controller_test.rb index 3279654..3e9d668 100644 --- a/plugins/ldap/test/functional/ldap_plugin_admin_controller_test.rb +++ b/plugins/ldap/test/functional/ldap_plugin_admin_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/ldap_plugin_admin_controller' -# Re-raise errors caught by the controller. -class LdapPluginAdminController; def rescue_action(e) raise e end; end - class LdapPluginAdminControllerTest < ActionController::TestCase def setup diff --git a/plugins/mark_comment_as_read/test/functional/mark_comment_as_read_plugin_profile_controller_test.rb b/plugins/mark_comment_as_read/test/functional/mark_comment_as_read_plugin_profile_controller_test.rb index 777dcb0..8cfaf3b 100644 --- a/plugins/mark_comment_as_read/test/functional/mark_comment_as_read_plugin_profile_controller_test.rb +++ b/plugins/mark_comment_as_read/test/functional/mark_comment_as_read_plugin_profile_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/mark_comment_as_read_plugin_profile_controller' -# Re-raise errors caught by the controller. -class MarkCommentAsReadPluginProfileController; def rescue_action(e) raise e end; end - class MarkCommentAsReadPluginProfileControllerTest < ActionController::TestCase def setup @controller = MarkCommentAsReadPluginProfileController.new diff --git a/plugins/metadata/test/functional/content_viewer_controller_test.rb b/plugins/metadata/test/functional/content_viewer_controller_test.rb index ae01d05..5231c90 100644 --- a/plugins/metadata/test/functional/content_viewer_controller_test.rb +++ b/plugins/metadata/test/functional/content_viewer_controller_test.rb @@ -1,9 +1,6 @@ require 'test_helper' require 'content_viewer_controller' -# Re-raise errors caught by the controller. -class ContentViewerController; def rescue_action(e) raise e end; end - class ContentViewerControllerTest < ActionController::TestCase def setup diff --git a/plugins/metadata/test/functional/home_controller_test.rb b/plugins/metadata/test/functional/home_controller_test.rb index b9f75d4..3c671e0 100644 --- a/plugins/metadata/test/functional/home_controller_test.rb +++ b/plugins/metadata/test/functional/home_controller_test.rb @@ -1,9 +1,6 @@ require 'test_helper' require 'home_controller' -# Re-raise errors caught by the controller. -class HomeController; def rescue_action(e) raise e end; end - class HomeControllerTest < ActionController::TestCase def setup diff --git a/plugins/metadata/test/functional/manage_products_controller_test.rb b/plugins/metadata/test/functional/manage_products_controller_test.rb index 3c4be1e..23bcc74 100644 --- a/plugins/metadata/test/functional/manage_products_controller_test.rb +++ b/plugins/metadata/test/functional/manage_products_controller_test.rb @@ -1,9 +1,6 @@ require 'test_helper' require 'home_controller' -# Re-raise errors caught by the controller. -class ManageProductsController; def rescue_action(e) raise e end; end - class ManageProductsControllerTest < ActionController::TestCase def setup diff --git a/plugins/people_block/test/functional/people_block_plugin_environment_design_controller_test.rb b/plugins/people_block/test/functional/people_block_plugin_environment_design_controller_test.rb index 66629db..921b668 100644 --- a/plugins/people_block/test/functional/people_block_plugin_environment_design_controller_test.rb +++ b/plugins/people_block/test/functional/people_block_plugin_environment_design_controller_test.rb @@ -1,8 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' -# Re-raise errors caught by the controller. -class EnvironmentDesignController; def rescue_action(e) raise e end; end - class EnvironmentDesignControllerTest < ActionController::TestCase def setup diff --git a/plugins/people_block/test/functional/people_block_plugin_profile_controller_test.rb b/plugins/people_block/test/functional/people_block_plugin_profile_controller_test.rb index 4014672..dec9b96 100644 --- a/plugins/people_block/test/functional/people_block_plugin_profile_controller_test.rb +++ b/plugins/people_block/test/functional/people_block_plugin_profile_controller_test.rb @@ -1,10 +1,6 @@ require_relative '../test_helper' require_relative '../../controllers/people_block_plugin_profile_controller' - -# Re-raise errors caught by the controller. -class PeopleBlockPluginProfileController; def rescue_action(e) raise e end; end - class PeopleBlockPluginProfileControllerTest < ActionController::TestCase def setup diff --git a/plugins/people_block/test/functional/people_block_plugin_profile_design_controller_test.rb b/plugins/people_block/test/functional/people_block_plugin_profile_design_controller_test.rb index b92d580..a60ba8c 100644 --- a/plugins/people_block/test/functional/people_block_plugin_profile_design_controller_test.rb +++ b/plugins/people_block/test/functional/people_block_plugin_profile_design_controller_test.rb @@ -1,8 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' -# Re-raise errors caught by the controller. -class ProfileDesignController; def rescue_action(e) raise e end; end - class ProfileDesignControllerTest < ActionController::TestCase def setup diff --git a/plugins/people_block/test/functional/profile_controller_test.rb b/plugins/people_block/test/functional/profile_controller_test.rb index dcd09db..8919bdd 100644 --- a/plugins/people_block/test/functional/profile_controller_test.rb +++ b/plugins/people_block/test/functional/profile_controller_test.rb @@ -1,8 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' -# Re-raise errors caught by the controller. -class ProfileController; def rescue_action(e) raise e end; end - class ProfileControllerTest < ActionController::TestCase def setup diff --git a/plugins/piwik/test/functional/piwik_plugin_test.rb b/plugins/piwik/test/functional/piwik_plugin_test.rb index 0267f95..d4d87ce 100644 --- a/plugins/piwik/test/functional/piwik_plugin_test.rb +++ b/plugins/piwik/test/functional/piwik_plugin_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/piwik_plugin_admin_controller' -# Re-raise errors caught by the controller. -class PiwikPluginAdminController; def rescue_action(e) raise e end; end - class PiwikPluginAdminControllerTest < ActionController::TestCase def setup diff --git a/plugins/relevant_content/test/unit/article.rb b/plugins/relevant_content/test/unit/article.rb index 0e323e5..c7cd3b9 100644 --- a/plugins/relevant_content/test/unit/article.rb +++ b/plugins/relevant_content/test/unit/article.rb @@ -1,8 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' - require 'comment_controller' -# Re-raise errors caught by the controller. -class CommentController; def rescue_action(e) raise e end; end class RelevantContentBlockTest < ActiveSupport::TestCase diff --git a/plugins/relevant_content/test/unit/relevant_content_block_test.rb b/plugins/relevant_content/test/unit/relevant_content_block_test.rb index 1b97707..92c9489 100644 --- a/plugins/relevant_content/test/unit/relevant_content_block_test.rb +++ b/plugins/relevant_content/test/unit/relevant_content_block_test.rb @@ -1,8 +1,6 @@ require File.dirname(__FILE__) + '/../test_helper' require 'comment_controller' -# Re-raise errors caught by the controller. -class CommentController; def rescue_action(e) raise e end; end class RelevantContentBlockTest < ActiveSupport::TestCase diff --git a/plugins/remote_user/test/functional/remote_user_plugin_test.rb b/plugins/remote_user/test/functional/remote_user_plugin_test.rb index a33f04f..ff940b6 100644 --- a/plugins/remote_user/test/functional/remote_user_plugin_test.rb +++ b/plugins/remote_user/test/functional/remote_user_plugin_test.rb @@ -1,8 +1,5 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' -# Re-raise errors caught by the controller. -class AccountController; def rescue_action(e) raise e end; end - class AccountControllerTest < ActionController::TestCase def setup @environment = Environment.default diff --git a/plugins/shopping_cart/test/functional/shopping_cart_plugin_controller_test.rb b/plugins/shopping_cart/test/functional/shopping_cart_plugin_controller_test.rb index 0d465cd..8c1ee0f 100644 --- a/plugins/shopping_cart/test/functional/shopping_cart_plugin_controller_test.rb +++ b/plugins/shopping_cart/test/functional/shopping_cart_plugin_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/shopping_cart_plugin_controller' -# Re-raise errors caught by the controller. -class ShoppingCartPluginController; def rescue_action(e) raise e end; end - class ShoppingCartPluginControllerTest < ActionController::TestCase def setup diff --git a/plugins/social_share_privacy/test/functional/content_viewer_controller_test.rb b/plugins/social_share_privacy/test/functional/content_viewer_controller_test.rb index e3e9e92..fad684e 100644 --- a/plugins/social_share_privacy/test/functional/content_viewer_controller_test.rb +++ b/plugins/social_share_privacy/test/functional/content_viewer_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../../../app/controllers/public/invite_controller' -# Re-raise errors caught by the controller. -class ContentViewerController; def rescue_action(e) raise e end; end - class ContentViewerControllerTest < ActionController::TestCase def setup diff --git a/plugins/social_share_privacy/test/functional/social_share_privacy_plugin_admin_controller_test.rb b/plugins/social_share_privacy/test/functional/social_share_privacy_plugin_admin_controller_test.rb index c43a208..050af82 100644 --- a/plugins/social_share_privacy/test/functional/social_share_privacy_plugin_admin_controller_test.rb +++ b/plugins/social_share_privacy/test/functional/social_share_privacy_plugin_admin_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/social_share_privacy_plugin_admin_controller' -# Re-raise errors caught by the controller. -class SocialSharePrivacyPluginAdminController; def rescue_action(e) raise e end; end - class SocialSharePrivacyPluginAdminControllerTest < ActionController::TestCase def setup diff --git a/plugins/solr/test/functional/search_controller_test.rb b/plugins/solr/test/functional/search_controller_test.rb index cf1f12f..c4f6230 100644 --- a/plugins/solr/test/functional/search_controller_test.rb +++ b/plugins/solr/test/functional/search_controller_test.rb @@ -1,9 +1,6 @@ require "#{File.dirname(__FILE__)}/../test_helper" require File.dirname(__FILE__) + '/../../lib/ext/facets_browse' -# Re-raise errors caught by the controller. -class SearchController; def rescue_action(e) raise e end; end - class SearchControllerTest < ActionController::TestCase def setup diff --git a/plugins/spaminator/test/functional/spaminator_plugin_admin_controller_test.rb b/plugins/spaminator/test/functional/spaminator_plugin_admin_controller_test.rb index 3a14446..b3dffca 100644 --- a/plugins/spaminator/test/functional/spaminator_plugin_admin_controller_test.rb +++ b/plugins/spaminator/test/functional/spaminator_plugin_admin_controller_test.rb @@ -1,9 +1,6 @@ require 'test_helper' require File.dirname(__FILE__) + '/../../controllers/spaminator_plugin_admin_controller' -# Re-raise errors caught by the controller. -class SpaminatorPluginAdminController; def rescue_action(e) raise e end; end - class SpaminatorPluginAdminControllerTest < ActionController::TestCase def setup @controller = SpaminatorPluginAdminController.new diff --git a/plugins/statistics/test/functional/statistics_plugin_environment_design_controller_test.rb b/plugins/statistics/test/functional/statistics_plugin_environment_design_controller_test.rb index 7638e3a..5c266fb 100644 --- a/plugins/statistics/test/functional/statistics_plugin_environment_design_controller_test.rb +++ b/plugins/statistics/test/functional/statistics_plugin_environment_design_controller_test.rb @@ -1,8 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' -# Re-raise errors caught by the controller. -class EnvironmentDesignController; def rescue_action(e) raise e end; end - class EnvironmentDesignControllerTest < ActionController::TestCase def setup @@ -136,7 +133,7 @@ class EnvironmentDesignControllerTest < ActionController::TestCase assert_tag :input, :attributes => {:id => 'block_product_counter'} assert_no_tag :input, :attributes => {:id => 'block_product_counter', :checked => 'checked'} - end + end should 'not input category counter be checked by default' do get :edit, :id => @block.id @@ -162,4 +159,4 @@ class EnvironmentDesignControllerTest < ActionController::TestCase assert_no_tag :input, :attributes => {:id => 'block_hit_counter', :checked => 'checked'} end -end \ No newline at end of file +end diff --git a/plugins/statistics/test/functional/statistics_plugin_home_controller_test.rb b/plugins/statistics/test/functional/statistics_plugin_home_controller_test.rb index 2a763e6..2ca5ca8 100755 --- a/plugins/statistics/test/functional/statistics_plugin_home_controller_test.rb +++ b/plugins/statistics/test/functional/statistics_plugin_home_controller_test.rb @@ -1,8 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' -# Re-raise errors caught by the controller. -class HomeController; def rescue_action(e) raise e end; end - class HomeControllerTest < ActionController::TestCase def setup diff --git a/plugins/statistics/test/functional/statistics_plugin_profile_design_controller_test.rb b/plugins/statistics/test/functional/statistics_plugin_profile_design_controller_test.rb index 7e59ed0..db90050 100644 --- a/plugins/statistics/test/functional/statistics_plugin_profile_design_controller_test.rb +++ b/plugins/statistics/test/functional/statistics_plugin_profile_design_controller_test.rb @@ -1,8 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' -# Re-raise errors caught by the controller. -class ProfileDesignController; def rescue_action(e) raise e end; end - class ProfileDesignControllerTest < ActionController::TestCase def setup diff --git a/plugins/stoa/test/functional/account_controller_test.rb b/plugins/stoa/test/functional/account_controller_test.rb index 9f85204..ee2ed17 100644 --- a/plugins/stoa/test/functional/account_controller_test.rb +++ b/plugins/stoa/test/functional/account_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../../../app/controllers/public/account_controller' -# Re-raise errors caught by the controller. -class AccountController; def rescue_action(e) raise e end; end - class AccountControllerTest < ActionController::TestCase SALT=YAML::load(File.open(StoaPlugin.root_path + 'config.yml'))['salt'] diff --git a/plugins/stoa/test/functional/invite_controller_test.rb b/plugins/stoa/test/functional/invite_controller_test.rb index da1a3a4..559b1c7 100644 --- a/plugins/stoa/test/functional/invite_controller_test.rb +++ b/plugins/stoa/test/functional/invite_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../../../app/controllers/public/invite_controller' -# Re-raise errors caught by the controller. -class InviteController; def rescue_action(e) raise e end; end - class InviteControllerTest < ActionController::TestCase def setup diff --git a/plugins/stoa/test/functional/profile_editor_controller_test.rb b/plugins/stoa/test/functional/profile_editor_controller_test.rb index 822b0e5..0eecae8 100644 --- a/plugins/stoa/test/functional/profile_editor_controller_test.rb +++ b/plugins/stoa/test/functional/profile_editor_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../../../app/controllers/my_profile/profile_editor_controller' -# Re-raise errors caught by the controller. -class ProfileEditorController; def rescue_action(e) raise e end; end - class StoaPluginProfileEditorControllerTest < ActionController::TestCase SALT=YAML::load(File.open(StoaPlugin.root_path + 'config.yml'))['salt'] diff --git a/plugins/stoa/test/functional/stoa_plugin_controller_test.rb b/plugins/stoa/test/functional/stoa_plugin_controller_test.rb index e6959fa..ea3bd49 100644 --- a/plugins/stoa/test/functional/stoa_plugin_controller_test.rb +++ b/plugins/stoa/test/functional/stoa_plugin_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/stoa_plugin_controller' -# Re-raise errors caught by the controller. -class StoaPluginController; def rescue_action(e) raise e end; end - class StoaPluginControllerTest < ActionController::TestCase SALT=YAML::load(File.open(StoaPlugin.root_path + 'config.yml'))['salt'] diff --git a/plugins/sub_organizations/test/functional/sub_organizations_plugin_myprofile_controller_test.rb b/plugins/sub_organizations/test/functional/sub_organizations_plugin_myprofile_controller_test.rb index 8797dde..5d3c7cf 100644 --- a/plugins/sub_organizations/test/functional/sub_organizations_plugin_myprofile_controller_test.rb +++ b/plugins/sub_organizations/test/functional/sub_organizations_plugin_myprofile_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/sub_organizations_plugin_myprofile_controller' -# Re-raise errors caught by the controller. -class SubOrganizationsPluginMyprofileController; def rescue_action(e) raise e end; end - class SubOrganizationsPluginMyprofileControllerTest < ActionController::TestCase def setup @controller = SubOrganizationsPluginMyprofileController.new @@ -94,7 +91,7 @@ class SubOrganizationsPluginMyprofileControllerTest < ActionController::TestCase get :index, :profile => organization.identifier assert_response 403 - assert_template 'access_denied' + assert_template 'shared/access_denied' end should 'not search organizations if dont have permission' do @@ -107,7 +104,7 @@ class SubOrganizationsPluginMyprofileControllerTest < ActionController::TestCase get :search_organization, :profile => organization.identifier, :q => 'sampl' assert_response 403 - assert_template 'access_denied' + assert_template 'shared/access_denied' end end diff --git a/plugins/sub_organizations/test/functional/sub_organizations_plugin_profile_controller_test.rb b/plugins/sub_organizations/test/functional/sub_organizations_plugin_profile_controller_test.rb index eb0e3c8..21707c9 100644 --- a/plugins/sub_organizations/test/functional/sub_organizations_plugin_profile_controller_test.rb +++ b/plugins/sub_organizations/test/functional/sub_organizations_plugin_profile_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/sub_organizations_plugin_profile_controller' -# Re-raise errors caught by the controller. -class SubOrganizationsPluginProfileController; def rescue_action(e) raise e end; end - class SubOrganizationsPluginProfileControllerTest < ActionController::TestCase def setup diff --git a/plugins/video/test/functional/video_plugin_environment_design_controller_test.rb b/plugins/video/test/functional/video_plugin_environment_design_controller_test.rb index 2a376b4..fc126e2 100644 --- a/plugins/video/test/functional/video_plugin_environment_design_controller_test.rb +++ b/plugins/video/test/functional/video_plugin_environment_design_controller_test.rb @@ -1,8 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' -# Re-raise errors caught by the controller. -class EnvironmentDesignController; def rescue_action(e) raise e end; end - class EnvironmentDesignControllerTest < ActionController::TestCase def setup diff --git a/plugins/video/test/functional/video_plugin_profile_design_controller_test.rb b/plugins/video/test/functional/video_plugin_profile_design_controller_test.rb index 94d2036..f0ec598 100644 --- a/plugins/video/test/functional/video_plugin_profile_design_controller_test.rb +++ b/plugins/video/test/functional/video_plugin_profile_design_controller_test.rb @@ -1,8 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' -# Re-raise errors caught by the controller. -class ProfileDesignController; def rescue_action(e) raise e end; end - class ProfileDesignControllerTest < ActionController::TestCase def setup diff --git a/plugins/vote/test/functional/vote_plugin_admin_controller_test.rb b/plugins/vote/test/functional/vote_plugin_admin_controller_test.rb index 35395f7..3e9f3f2 100644 --- a/plugins/vote/test/functional/vote_plugin_admin_controller_test.rb +++ b/plugins/vote/test/functional/vote_plugin_admin_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/vote_plugin_admin_controller' -# Re-raise errors caught by the controller. -class VotePluginAdminController; def rescue_action(e) raise e end; end - class VotePluginAdminControllerTest < ActionController::TestCase def setup diff --git a/plugins/vote/test/functional/vote_plugin_profile_controller_test.rb b/plugins/vote/test/functional/vote_plugin_profile_controller_test.rb index 73db1e3..68ed7bf 100644 --- a/plugins/vote/test/functional/vote_plugin_profile_controller_test.rb +++ b/plugins/vote/test/functional/vote_plugin_profile_controller_test.rb @@ -1,9 +1,6 @@ require File.dirname(__FILE__) + '/../../../../test/test_helper' require File.dirname(__FILE__) + '/../../controllers/vote_plugin_profile_controller' -# Re-raise errors caught by the controller. -class VotePluginProfileController; def rescue_action(e) raise e end; end - class VotePluginProfileControllerTest < ActionController::TestCase def setup diff --git a/plugins/work_assignment/test/functional/cms_controller_test.rb b/plugins/work_assignment/test/functional/cms_controller_test.rb index df204bf..d7ab749 100644 --- a/plugins/work_assignment/test/functional/cms_controller_test.rb +++ b/plugins/work_assignment/test/functional/cms_controller_test.rb @@ -1,9 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../../test/test_helper") require 'cms_controller' -# Re-raise errors caught by the controller. -class CmsController; def rescue_action(e) raise e end; end - class CmsControllerTest < ActionController::TestCase def setup @@ -22,7 +19,7 @@ class CmsControllerTest < ActionController::TestCase work_assignment = create_work_assignment('Work Assignment', @organization, nil, nil) get :upload_files, :profile => @organization.identifier, :parent_id => work_assignment.id assert_response :forbidden - assert_template 'access_denied' + assert_template 'shared/access_denied' end should 'allow members to upload submissions on work_assignment' do diff --git a/plugins/work_assignment/test/functional/content_viewer_controller_test.rb b/plugins/work_assignment/test/functional/content_viewer_controller_test.rb index 19ed308..bcf2167 100644 --- a/plugins/work_assignment/test/functional/content_viewer_controller_test.rb +++ b/plugins/work_assignment/test/functional/content_viewer_controller_test.rb @@ -1,9 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../../test/test_helper") require 'content_viewer_controller' -# Re-raise errors caught by the controller. -class ContentViewerController; def rescue_action(e) raise e end; end - class ContentViewerControllerTest < ActionController::TestCase def setup @@ -30,7 +27,7 @@ class ContentViewerControllerTest < ActionController::TestCase get :view_page, :profile => @organization.identifier, :page => submission.path assert_response :forbidden - assert_template 'access_denied' + assert_template 'shared/access_denied' WorkAssignmentPlugin.stubs(:can_download_submission?).returns(true) diff --git a/plugins/work_assignment/test/functional/work_assignment_plugin_myprofile_controller_test.rb b/plugins/work_assignment/test/functional/work_assignment_plugin_myprofile_controller_test.rb index dcea2d2..0335aad 100644 --- a/plugins/work_assignment/test/functional/work_assignment_plugin_myprofile_controller_test.rb +++ b/plugins/work_assignment/test/functional/work_assignment_plugin_myprofile_controller_test.rb @@ -1,9 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../../test/test_helper") require 'work_assignment_plugin_myprofile_controller' -# Re-raise errors caught by the controller. -class WorkAssignmentPluginMyprofileController; def rescue_action(e) raise e end; end - class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase def setup @@ -40,9 +37,9 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase assert_equal false, submission.parent.published post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id - assert_template 'access_denied' + assert_template 'shared/access_denied' post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id, :article => { :published => true } - assert_template 'access_denied' + assert_template 'shared/access_denied' submission.reload assert_equal false, submission.published @@ -56,9 +53,9 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase assert_equal true, @person.is_admin? post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id - assert_template 'access_denied' + assert_template 'shared/access_denied' post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id, :article => { :published => true } - assert_template 'access_denied' + assert_template 'shared/access_denied' submission.reload assert_equal false, submission.published @@ -120,10 +117,10 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase assert_equal(submission.author, @person) post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id - assert_template 'access_denied' + assert_template 'shared/access_denied' post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id, :article => { :published => true } - assert_template 'access_denied' + assert_template 'shared/access_denied' submission.reload assert_equal false, submission.parent.published @@ -174,10 +171,10 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase assert_equal false, (@person.is_member_of? submission.profile) post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id - assert_template 'access_denied' + assert_template 'shared/access_denied' post :edit_visibility, :profile => @organization.identifier, :article_id => parent.id, :article => { :published => true } - assert_template 'access_denied' + assert_template 'shared/access_denied' submission.reload assert_equal false, submission.parent.published diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index fc7152d..59268e5 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'account_controller' -# Re-raise errors caught by the controller. -class AccountController; def rescue_action(e) raise e end; end - class AccountControllerTest < ActionController::TestCase # Be sure to include AuthenticatedTestHelper in test/test_helper.rb instead # Then, you can remove it from this and the units test. @@ -240,28 +237,20 @@ class AccountControllerTest < ActionController::TestCase end should 'provide interface for entering new password' do - change = ChangePassword.new - ChangePassword.expects(:from_code).with('osidufgiashfkjsadfhkj99999').returns(change) - person = mock - person.stubs(:identifier).returns('joe') - person.stubs(:name).returns('Joe') - change.stubs(:requestor).returns(person) + code = 'osidufgiashfkjsadfhkj99999' + person = create_user('joe').person + change = ChangePassword.create! code: code, requestor: person - get :new_password, :code => 'osidufgiashfkjsadfhkj99999' + get :new_password, code: code assert_equal change, assigns(:change_password) end should 'actually change password after entering new password' do - change = ChangePassword.new - ChangePassword.expects(:from_code).with('osidufgiashfkjsadfhkj99999').returns(change) + code = 'osidufgiashfkjsadfhkj99999' + person = create_user('joe').person + ChangePassword.create! code: code, requestor: person - requestor = mock - requestor.stubs(:identifier).returns('joe') - change.stubs(:requestor).returns(requestor) - change.expects(:update_attributes!).with({'password' => 'newpass', 'password_confirmation' => 'newpass'}) - change.expects(:finish) - - post :new_password, :code => 'osidufgiashfkjsadfhkj99999', :change_password => { :password => 'newpass', :password_confirmation => 'newpass' } + post :new_password, code: code, change_password: { password: 'newpass', password_confirmation: 'newpass' } assert_template 'new_password_ok' end @@ -323,8 +312,6 @@ class AccountControllerTest < ActionController::TestCase person = create_user('mylogin').person login_as(person.identifier) - EnterpriseActivation.expects(:from_code).with('some_invalid_code').returns(nil).at_least_once - get :activation_question, :enterprise_code => 'some_invalid_code' assert_template 'invalid_enterprise_code' @@ -336,9 +323,7 @@ class AccountControllerTest < ActionController::TestCase ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => true) ent.update_attribute(:cnpj, '0'*14) - task = mock - task.expects(:enterprise).returns(ent).at_least_once - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once + EnterpriseActivation.create! code: '0123456789', enterprise: ent get :activation_question, :enterprise_code => '0123456789' @@ -350,10 +335,7 @@ class AccountControllerTest < ActionController::TestCase login_as(person.identifier) ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent') - - task = mock - task.expects(:enterprise).returns(ent).at_least_once - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once + EnterpriseActivation.create! code: '0123456789', enterprise: ent get :activation_question, :enterprise_code => '0123456789' @@ -365,10 +347,7 @@ class AccountControllerTest < ActionController::TestCase login_as(person.identifier) ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) - - task = mock - task.expects(:enterprise).returns(ent).at_least_once - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once + EnterpriseActivation.create! code: '0123456789', enterprise: ent get :activation_question, :enterprise_code => '0123456789' @@ -381,10 +360,7 @@ class AccountControllerTest < ActionController::TestCase ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) ent.update_attribute(:foundation_year, 1998) - - task = mock - task.expects(:enterprise).returns(ent).at_least_once - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once + EnterpriseActivation.create! code: '0123456789', enterprise: ent get :activation_question, :enterprise_code => '0123456789' @@ -397,10 +373,7 @@ class AccountControllerTest < ActionController::TestCase ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) ent.update_attribute(:cnpj, '0'*14) - - task = mock - task.expects(:enterprise).returns(ent).at_least_once - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once + EnterpriseActivation.create! code: '0123456789', enterprise: ent get :activation_question, :enterprise_code => '0123456789' @@ -414,10 +387,7 @@ class AccountControllerTest < ActionController::TestCase ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) ent.update_attribute(:foundation_year, 1998) ent.block - - task = mock - task.expects(:enterprise).returns(ent).at_least_once - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once + EnterpriseActivation.create! code: '0123456789', enterprise: ent get :activation_question, :enterprise_code => '0123456789' @@ -430,10 +400,7 @@ class AccountControllerTest < ActionController::TestCase ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) ent.update_attribute(:foundation_year, 1998) - - task = mock - task.expects(:enterprise).returns(ent).at_least_once - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once + EnterpriseActivation.create! code: '0123456789', enterprise: ent get :activation_question, :enterprise_code => '0123456789' @@ -443,10 +410,7 @@ class AccountControllerTest < ActionController::TestCase should 'require login for accept terms' do ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) ent.update_attribute(:foundation_year, 1998) - - task = mock - task.expects(:enterprise).returns(ent).never - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).never + EnterpriseActivation.create! code: '0123456789', enterprise: ent post :accept_terms, :enterprise_code => '0123456789', :answer => '1998' @@ -459,10 +423,7 @@ class AccountControllerTest < ActionController::TestCase ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) ent.update_attribute(:foundation_year, 1998) - - task = mock - task.expects(:enterprise).returns(ent).at_least_once - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once + EnterpriseActivation.create! code: '0123456789', enterprise: ent post :accept_terms, :enterprise_code => '0123456789', :answer => '1997' @@ -483,8 +444,7 @@ class AccountControllerTest < ActionController::TestCase ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) ent.update_attribute(:foundation_year, 1998) - task = EnterpriseActivation.create!(:enterprise => ent) - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once + EnterpriseActivation.create! code: '0123456789', enterprise: ent post :accept_terms, :enterprise_code => '0123456789', :answer => '1998' @@ -500,10 +460,7 @@ class AccountControllerTest < ActionController::TestCase ent.update_attribute(:foundation_year, 1998) ent.block ent.save - - task = mock - task.expects(:enterprise).returns(ent).at_least_once - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once + EnterpriseActivation.create! code: '0123456789', enterprise: ent get :accept_terms, :enterprise_code => '0123456789', :answer => 1998 @@ -516,8 +473,7 @@ class AccountControllerTest < ActionController::TestCase env.save! ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) ent.update_attribute(:foundation_year, 1998) - task = EnterpriseActivation.create!(:enterprise => ent) - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).never + EnterpriseActivation.create! code: '0123456789', enterprise: ent post :activate_enterprise, :enterprise_code => '0123456789', :answer => '1998', :terms_accepted => true @@ -525,13 +481,12 @@ class AccountControllerTest < ActionController::TestCase end should 'not activate if user does not accept terms' do - ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) - ent.update_attribute(:foundation_year, 1998) p = create_user('test_user', :password => 'blih', :password_confirmation => 'blih', :email => 'test@noosfero.com').person login_as(p.identifier) - task = EnterpriseActivation.create!(:enterprise => ent) - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once + ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) + ent.update_attribute(:foundation_year, 1998) + EnterpriseActivation.create! code: '0123456789', enterprise: ent post :activate_enterprise, :enterprise_code => '0123456789', :answer => '1998', :terms_accepted => false ent.reload @@ -541,13 +496,12 @@ class AccountControllerTest < ActionController::TestCase end should 'activate enterprise and make logged user admin' do - ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) - ent.update_attribute(:foundation_year, 1998) p = create_user('test_user', :password => 'blih', :password_confirmation => 'blih', :email => 'test@noosfero.com').person login_as(p.identifier) - task = EnterpriseActivation.create!(:enterprise => ent) - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once + ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) + ent.update_attribute(:foundation_year, 1998) + EnterpriseActivation.create! code: '0123456789', enterprise: ent post :activate_enterprise, :enterprise_code => '0123456789', :answer => '1998', :terms_accepted => true ent.reload @@ -565,8 +519,7 @@ class AccountControllerTest < ActionController::TestCase env.save! ent = fast_create(Enterprise, :name => 'test enterprise', :identifier => 'test_ent', :enabled => false) ent.update_attribute(:foundation_year, 1998) - task = EnterpriseActivation.create!(:enterprise => ent) - EnterpriseActivation.expects(:from_code).with('0123456789').returns(task).at_least_once + EnterpriseActivation.create! code: '0123456789', enterprise: ent post :activate_enterprise, :enterprise_code => '0123456789', :answer => '1998', :terms_accepted => true diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb index 5350c93..cf2d3f3 100644 --- a/test/functional/admin_controller_test.rb +++ b/test/functional/admin_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'admin_controller' -# Re-raise errors caught by the controller. -class AdminController; def rescue_action(e) raise e end; end - class AdminControllerTest < ActionController::TestCase should 'inherit from ApplicationController' do diff --git a/test/functional/admin_panel_controller_test.rb b/test/functional/admin_panel_controller_test.rb index 02b76f6..821c291 100644 --- a/test/functional/admin_panel_controller_test.rb +++ b/test/functional/admin_panel_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'admin_panel_controller' -# Re-raise errors caught by the controller. -class AdminPanelController; def rescue_action(e) raise e end; end - class AdminPanelControllerTest < ActionController::TestCase all_fixtures @@ -127,7 +124,7 @@ class AdminPanelControllerTest < ActionController::TestCase should 'sanitize message for disabled enterprise with white_list' do post :site_info, :environment => { :message_for_disabled_enterprise => "This is my new environment" } assert_redirected_to :action => 'index' - assert_equal "This is my new environment", Environment.default.message_for_disabled_enterprise + assert_equal "This is alert('alow')my new environment", Environment.default.message_for_disabled_enterprise end should 'save site article date format option' do diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb index c6737d9..c8c1d48 100644 --- a/test/functional/application_controller_test.rb +++ b/test/functional/application_controller_test.rb @@ -2,9 +2,6 @@ require_relative "../test_helper" require 'test_controller' -# Re-raise errors caught by the controller. -class TestController; def rescue_action(e) raise e end; end - class ApplicationControllerTest < ActionController::TestCase all_fixtures def setup diff --git a/test/functional/catalog_controller_test.rb b/test/functional/catalog_controller_test.rb index 89f50cc..1b39b81 100644 --- a/test/functional/catalog_controller_test.rb +++ b/test/functional/catalog_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'catalog_controller' -# Re-raise errors caught by the controller. -class CatalogController; def rescue_action(e) raise e end; end - class CatalogControllerTest < ActionController::TestCase def setup @controller = CatalogController.new diff --git a/test/functional/categories_controller_test.rb b/test/functional/categories_controller_test.rb index f065110..a2b68b6 100644 --- a/test/functional/categories_controller_test.rb +++ b/test/functional/categories_controller_test.rb @@ -1,16 +1,13 @@ require_relative "../test_helper" require 'categories_controller' -# Re-raise errors caught by the controller. -class CategoriesController; def rescue_action(e) raise e end; end - class CategoriesControllerTest < ActionController::TestCase all_fixtures def setup @controller = CategoriesController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - + @env = fast_create(Environment, :name => "My test environment") Environment.stubs(:default).returns(env) assert (@cat1 = env.categories.create(:name => 'a test category')) @@ -25,9 +22,6 @@ class CategoriesControllerTest < ActionController::TestCase get :index assert_response :success assert_template 'index' - assert_kind_of Array, assigns(:categories) - assert_kind_of Array, assigns(:product_categories) - assert_kind_of Array, assigns(:regions) assert_tag :tag => 'a', :attributes => { :href => '/admin/categories/new'} end diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb index 6d05356..fdc4049 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'cms_controller' -# Re-raise errors caught by the controller. -class CmsController; def rescue_action(e) raise e end; end - class CmsControllerTest < ActionController::TestCase include NoosferoTestHelper @@ -1237,7 +1234,7 @@ class CmsControllerTest < ActionController::TestCase get :new, :profile => c.identifier assert_response :forbidden - assert_template 'access_denied' + assert_template 'shared/access_denied' end should 'allow user with permission create an article in community' do @@ -1259,7 +1256,7 @@ class CmsControllerTest < ActionController::TestCase get :edit, :profile => c.identifier, :id => a.id assert_response :forbidden - assert_template 'access_denied' + assert_template 'shared/access_denied' end should 'not allow user edit article if he is owner but has no publish permission' do @@ -1270,7 +1267,7 @@ class CmsControllerTest < ActionController::TestCase get :edit, :profile => c.identifier, :id => a.id assert_response :forbidden - assert_template 'access_denied' + assert_template 'shared/access_denied' end should 'allow user edit article if he is owner and has publish permission' do @@ -1782,7 +1779,7 @@ class CmsControllerTest < ActionController::TestCase get :upload_files, :profile => c.identifier, :parent_id => a.id assert_response :forbidden - assert_template 'access_denied' + assert_template 'shared/access_denied' end should 'filter profile folders to select' do diff --git a/test/functional/comment_controller_test.rb b/test/functional/comment_controller_test.rb index 8340c35..c2c1e46 100644 --- a/test/functional/comment_controller_test.rb +++ b/test/functional/comment_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'comment_controller' -# Re-raise errors caught by the controller. -class CommentController; def rescue_action(e) raise e end; end - class CommentControllerTest < ActionController::TestCase def setup @@ -358,7 +355,7 @@ class CommentControllerTest < ActionController::TestCase should "render the root comment when a reply is made" do login_as profile.identifier page = profile.articles.create!(:name => 'myarticle') - + comment = fast_create(Comment, :body => 'some content', :source_id => page.id, :source_type => 'Article') xhr :post, :create, :profile => profile.identifier, :id => page.id, :comment => {:body => 'Some comment...', :reply_of_id => comment.id}, :confirm => 'true' diff --git a/test/functional/contact_controller_test.rb b/test/functional/contact_controller_test.rb index a237728..e456e28 100644 --- a/test/functional/contact_controller_test.rb +++ b/test/functional/contact_controller_test.rb @@ -2,9 +2,6 @@ require_relative "../test_helper" require 'contact_controller' -# Re-raise errors caught by the controller. -class ContactController; def rescue_action(e) raise e end; end - class ContactControllerTest < ActionController::TestCase all_fixtures @@ -140,7 +137,7 @@ class ContactControllerTest < ActionController::TestCase post :new, :profile => community.identifier assert_response :forbidden - assert_template :access_denied + assert_template 'shared/access_denied' end should 'show send e-mail page to members of private community' do diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index 3006e97..10f6c5a 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'content_viewer_controller' -# Re-raise errors caught by the controller. -class ContentViewerController; def rescue_action(e) raise e end; end - class ContentViewerControllerTest < ActionController::TestCase all_fixtures @@ -194,7 +191,7 @@ class ContentViewerControllerTest < ActionController::TestCase get :view_page, :profile => community.identifier, :page => [ folder.path ] - assert_template 'access_denied' + assert_template 'shared/access_denied' end should 'show private content to profile moderators' do @@ -297,7 +294,7 @@ class ContentViewerControllerTest < ActionController::TestCase get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] - assert_template 'access_denied' + assert_template 'shared/access_denied' end should 'give access to private articles if logged in and moderator' do diff --git a/test/functional/edit_template_controller_test.rb b/test/functional/edit_template_controller_test.rb index 75f81dc..8dd5e40 100644 --- a/test/functional/edit_template_controller_test.rb +++ b/test/functional/edit_template_controller_test.rb @@ -3,9 +3,6 @@ require_relative "../test_helper" require 'edit_template_controller' -# Re-raise errors caught by the controller. -class EditTemplateController; def rescue_action(e) raise e end; end - class EditTemplateControllerTest < ActionController::TestCase all_fixtures def setup diff --git a/test/functional/enterprise_registration_controller_test.rb b/test/functional/enterprise_registration_controller_test.rb index 68eee32..30767ac 100644 --- a/test/functional/enterprise_registration_controller_test.rb +++ b/test/functional/enterprise_registration_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'enterprise_registration_controller' -# Re-raise errors caught by the controller. -class EnterpriseRegistrationController; def rescue_action(e) raise e end; end - class EnterpriseRegistrationControllerTest < ActionController::TestCase # all_fixtures:users @@ -159,7 +156,7 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase post :index, :create_enterprise => { 'name' => 'name', 'identifier' => 'mynew', :economic_activity => 'economic_activity' } assert_sanitized assigns(:create_enterprise).economic_activity end - + should 'filter html from management_information' do post :index, :create_enterprise => { 'name' => 'name', 'identifier' => 'mynew', :management_information => 'management_information' } assert_sanitized assigns(:create_enterprise).management_information diff --git a/test/functional/enterprise_validation_controller_test.rb b/test/functional/enterprise_validation_controller_test.rb index d43758d..bae0823 100644 --- a/test/functional/enterprise_validation_controller_test.rb +++ b/test/functional/enterprise_validation_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'enterprise_validation_controller' -# Re-raise errors caught by the controller. -class EnterpriseValidationController; def rescue_action(e) raise e end; end - class EnterpriseValidationControllerTest < ActionController::TestCase all_fixtures @@ -12,7 +9,7 @@ class EnterpriseValidationControllerTest < ActionController::TestCase @controller = EnterpriseValidationController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - + login_as 'ze' @org = Organization.create!(:identifier => 'myorg', :name => "My Org") give_permission('ze', 'validate_enterprise', @org) @@ -78,7 +75,7 @@ class EnterpriseValidationControllerTest < ActionController::TestCase should 'list validations already processed' do processed_validations = [CreateEnterprise.new] @org.expects(:processed_validations).returns(processed_validations) - + get :list_processed, :profile => 'myorg' assert_equal processed_validations, assigns(:processed_validations) @@ -86,7 +83,7 @@ class EnterpriseValidationControllerTest < ActionController::TestCase assert_response :success assert_template 'list_processed' end - + should 'be able to display a validation that was already processed' do validation = CreateEnterprise.new @org.expects(:find_processed_validation).with('kakakaka').returns(validation) @@ -106,7 +103,7 @@ class EnterpriseValidationControllerTest < ActionController::TestCase info = ValidationInfo.new(:validation_methodology => 'none') @org.expects(:validation_info).returns(info) post :edit_validation_info, :profile => 'myorg', :info => {:validation_methodology => 'new methodology'} - + assert_response :redirect assert_redirected_to :action => 'index' assert_equal info, assigns(:info) @@ -116,7 +113,7 @@ class EnterpriseValidationControllerTest < ActionController::TestCase info = ValidationInfo.new(:validation_methodology => 'none') @org.expects(:validation_info).returns(info) post :edit_validation_info, :profile => 'myorg', :info => {:validation_methodology => ''} - + assert_response :success assert_equal info, assigns(:info) end diff --git a/test/functional/environment_design_controller_test.rb b/test/functional/environment_design_controller_test.rb index 51dd1c8..3dda9db 100644 --- a/test/functional/environment_design_controller_test.rb +++ b/test/functional/environment_design_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'environment_design_controller' -# Re-raise errors caught by the controller. -class EnvironmentDesignController; def rescue_action(e) raise e end; end - class EnvironmentDesignControllerTest < ActionController::TestCase ALL_BLOCKS = [ArticleBlock, LoginBlock, RecentDocumentsBlock, EnterprisesBlock, CommunitiesBlock, SellersSearchBlock, LinkListBlock, FeedReaderBlock, SlideshowBlock, HighlightsBlock, FeaturedProductsBlock, CategoriesBlock, RawHTMLBlock, TagsBlock ] diff --git a/test/functional/environment_role_manager_controller_test.rb b/test/functional/environment_role_manager_controller_test.rb index ad1cad3..1b44c65 100644 --- a/test/functional/environment_role_manager_controller_test.rb +++ b/test/functional/environment_role_manager_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'environment_role_manager_controller' -# Re-raise errors caught by the controller. -class EnvironmentRoleManagerController; def rescue_action(e) raise e end; end - class EnvironmentRoleManagerControllerTest < ActionController::TestCase def setup @controller = EnvironmentRoleManagerController.new diff --git a/test/functional/environment_themes_controller_test.rb b/test/functional/environment_themes_controller_test.rb index c9cff84..e8c7512 100644 --- a/test/functional/environment_themes_controller_test.rb +++ b/test/functional/environment_themes_controller_test.rb @@ -1,7 +1,5 @@ require_relative "../test_helper" -class EnvironmentThemesController; def rescue_action(e) raise e end; end - class EnvironmentThemesControllerTest < ActionController::TestCase def setup diff --git a/test/functional/events_controller_test.rb b/test/functional/events_controller_test.rb index a9f8444..a1d8e86 100644 --- a/test/functional/events_controller_test.rb +++ b/test/functional/events_controller_test.rb @@ -69,7 +69,7 @@ class EventsControllerTest < ActionController::TestCase post :events, :profile => community.identifier assert_response :forbidden - assert_template :access_denied + assert_template 'shared/access_denied' end should 'show events page to members of private community' do diff --git a/test/functional/favorite_enterprises_controller_test.rb b/test/functional/favorite_enterprises_controller_test.rb index 9e5b9ca..f58d0a7 100644 --- a/test/functional/favorite_enterprises_controller_test.rb +++ b/test/functional/favorite_enterprises_controller_test.rb @@ -1,12 +1,9 @@ require_relative "../test_helper" require 'favorite_enterprises_controller' -class FavoriteEnterprisesController; def rescue_action(e) raise e end; end - class FavoriteEnterprisesControllerTest < ActionController::TestCase - noosfero_test :profile => 'testuser' - + self.default_params = {profile: 'testuser'} def setup @controller = FavoriteEnterprisesController.new @request = ActionController::TestRequest.new @@ -31,7 +28,7 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase assert_response :success assert_template 'add' - ok("must load the favorite enterprise being added to display") { favorite_enterprise == assigns(:favorite_enterprise) } + ok("must load the favorite enterprise being added to display") { favorite_enterprise == assigns(:favorite_enterprise) } end diff --git a/test/functional/features_controller_test.rb b/test/functional/features_controller_test.rb index d906b66..3be51c1 100644 --- a/test/functional/features_controller_test.rb +++ b/test/functional/features_controller_test.rb @@ -1,19 +1,16 @@ require_relative "../test_helper" require 'features_controller' -# Re-raise errors caught by the controller. -class FeaturesController; def rescue_action(e) raise e end; end - class FeaturesControllerTest < ActionController::TestCase - all_fixtures + all_fixtures def setup @controller = FeaturesController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new login_as(create_admin_user(Environment.find(2))) end - + def test_listing_features uses_host 'anhetegua.net' get :index @@ -37,7 +34,7 @@ class FeaturesControllerTest < ActionController::TestCase assert_kind_of String, session[:notice] v = Environment.find(environments(:anhetegua_net).id) assert v.enabled?('feature2') - assert v.enabled?('feature2') + assert v.enabled?('feature2') assert !v.enabled?('feature3') end diff --git a/test/functional/friends_controller_test.rb b/test/functional/friends_controller_test.rb index e216b73..2391eca 100644 --- a/test/functional/friends_controller_test.rb +++ b/test/functional/friends_controller_test.rb @@ -1,12 +1,9 @@ require_relative "../test_helper" require 'friends_controller' -class FriendsController; def rescue_action(e) raise e end; end - class FriendsControllerTest < ActionController::TestCase - noosfero_test :profile => 'testuser' - + self.default_params = {profile: 'testuser'} def setup @controller = FriendsController.new @request = ActionController::TestRequest.new diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb index 9f60daa..32d076f 100644 --- a/test/functional/home_controller_test.rb +++ b/test/functional/home_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'home_controller' -# Re-raise errors caught by the controller. -class HomeController; def rescue_action(e) raise e end; end - class HomeControllerTest < ActionController::TestCase def teardown diff --git a/test/functional/licenses_controller_test.rb b/test/functional/licenses_controller_test.rb index 79b49ec..1742710 100644 --- a/test/functional/licenses_controller_test.rb +++ b/test/functional/licenses_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'licenses_controller' -# Re-raise errors caught by the controller. -class LIcensesController; def rescue_action(e) raise e end; end - class LicensesControllerTest < ActionController::TestCase def setup diff --git a/test/functional/manage_products_controller_test.rb b/test/functional/manage_products_controller_test.rb index 2285b77..dfddb40 100644 --- a/test/functional/manage_products_controller_test.rb +++ b/test/functional/manage_products_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'manage_products_controller' -# Re-raise errors caught by the controller. -class ManageProductsController; def rescue_action(e) raise e end; end - class ManageProductsControllerTest < ActionController::TestCase all_fixtures def setup @@ -23,7 +20,7 @@ class ManageProductsControllerTest < ActionController::TestCase login_as :user_test get 'index', :profile => @enterprise.identifier assert :success - assert_template 'access_denied' + assert_template 'shared/access_denied' end should "get index" do diff --git a/test/functional/map_balloon_controller_test.rb b/test/functional/map_balloon_controller_test.rb index b447cba..7001257 100644 --- a/test/functional/map_balloon_controller_test.rb +++ b/test/functional/map_balloon_controller_test.rb @@ -1,10 +1,6 @@ require_relative "../test_helper" require 'map_balloon_controller' - -# Re-raise errors caught by the controller. -class MapBalloonController; def rescue_action(e) raise e end; end - class MapBalloonControllerTest < ActionController::TestCase def setup diff --git a/test/functional/maps_controller_test.rb b/test/functional/maps_controller_test.rb index 850b46e..d078d14 100644 --- a/test/functional/maps_controller_test.rb +++ b/test/functional/maps_controller_test.rb @@ -2,9 +2,6 @@ require_relative "../test_helper" require 'maps_controller' -# Re-raise errors caught by the controller. -class MapsController; def rescue_action(e) raise e end; end - class MapsControllerTest < ActionController::TestCase def setup @@ -30,8 +27,8 @@ class MapsControllerTest < ActionController::TestCase city = 'Santo Afonso' state = 'Mato Grosso' - fast_create(NationalRegion, :name => 'Brasil', - :national_region_code => 'BR', + fast_create(NationalRegion, :name => 'Brasil', + :national_region_code => 'BR', :national_region_type_id => NationalRegionType::COUNTRY) parent_region = fast_create(NationalRegion, :name => state, @@ -43,7 +40,7 @@ class MapsControllerTest < ActionController::TestCase :national_region_type_id => NationalRegionType::CITY, :parent_national_region_code => parent_region.national_region_code) - post :edit_location, :profile => profile.identifier, :profile_data => { + post :edit_location, :profile => profile.identifier, :profile_data => { :address => 'new address', :country => 'BR', :city => city, diff --git a/test/functional/memberships_controller_test.rb b/test/functional/memberships_controller_test.rb index 28a3de1..a253aec 100644 --- a/test/functional/memberships_controller_test.rb +++ b/test/functional/memberships_controller_test.rb @@ -1,10 +1,6 @@ require_relative "../test_helper" require 'memberships_controller' - -# Re-raise errors caught by the controller. -class MembershipsController; def rescue_action(e) raise e end; end - class MembershipsControllerTest < ActionController::TestCase include ApplicationHelper diff --git a/test/functional/my_profile_controller_test.rb b/test/functional/my_profile_controller_test.rb index 847c5c0..615eab4 100644 --- a/test/functional/my_profile_controller_test.rb +++ b/test/functional/my_profile_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'my_profile_controller' -# Re-raise errors caught by the controller. -class MyProfileController; def rescue_action(e) raise e end; end - class OnlyForPersonTestController < MyProfileController requires_profile_class Person def index diff --git a/test/functional/organizations_controller_test.rb b/test/functional/organizations_controller_test.rb index 7400611..fb95fba 100644 --- a/test/functional/organizations_controller_test.rb +++ b/test/functional/organizations_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'organizations_controller' -# Re-raise errors caught by the controller. -class OrganizationsController; def rescue_action(e) raise e end; end - class OrganizationsControllerTest < ActionController::TestCase def setup @@ -11,13 +8,11 @@ class OrganizationsControllerTest < ActionController::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - Environment.destroy_all - @environment = fast_create(Environment, :is_default => true) + @environment = Environment.default admin_user = create_user_with_permission('adminuser', 'manage_environment_organizations', environment) login_as('adminuser') end - attr_accessor :environment should 'not access without right permission' do @@ -40,7 +35,7 @@ class OrganizationsControllerTest < ActionController::TestCase get :index, :filter => 'enabled' assert_match(/enabled community/, @response.body) - assert_not_match(/disabled community/, @response.body) + assert_no_match(/disabled community/, @response.body) end should 'show list to activate organizations' do @@ -50,7 +45,7 @@ class OrganizationsControllerTest < ActionController::TestCase get :index, :filter => 'disabled' - assert_not_match(/enabled community/, @response.body) + assert_no_match(/enabled community/, @response.body) assert_match(/disabled community/, @response.body) end @@ -61,7 +56,7 @@ class OrganizationsControllerTest < ActionController::TestCase get :index, :type => 'Enterprise' assert_match(/Enterprise Test/, @response.body) - assert_not_match(/Community Test/, @response.body) + assert_no_match(/Community Test/, @response.body) end should 'show list only of communities' do @@ -70,7 +65,7 @@ class OrganizationsControllerTest < ActionController::TestCase get :index, :type => 'Community' - assert_not_match(/Enterprise Test/, @response.body) + assert_no_match(/Enterprise Test/, @response.body) assert_match(/Community Test/, @response.body) end diff --git a/test/functional/plugin_admin_controller_test.rb b/test/functional/plugin_admin_controller_test.rb index b17d63f..46a1b50 100644 --- a/test/functional/plugin_admin_controller_test.rb +++ b/test/functional/plugin_admin_controller_test.rb @@ -1,4 +1,5 @@ require_relative "../test_helper" +require 'plugin_admin_controller' class PluginAdminController def index @@ -8,6 +9,10 @@ end class PluginAdminControllerTest < ActionController::TestCase + def setup + @controller = PluginAdminController.new + end + should 'allow user with the required permission to access plugin administration page' do create_user_with_permission('testuser', 'edit_environment_features', Environment.default) login_as('testuser') diff --git a/test/functional/plugins_controller_test.rb b/test/functional/plugins_controller_test.rb index 7b87632..d49e3c9 100644 --- a/test/functional/plugins_controller_test.rb +++ b/test/functional/plugins_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'plugins_controller' -# Re-raise errors caught by the controller. -class PluginsController; def rescue_action(e) raise e end; end - class PluginsControllerTest < ActionController::TestCase all_fixtures diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index 5f4a779..b2f1270 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -1,18 +1,15 @@ require_relative "../test_helper" require 'profile_controller' -# Re-raise errors caught by the controller. -class ProfileController; def rescue_action(e) raise e end; end - class ProfileControllerTest < ActionController::TestCase + + self.default_params = {profile: 'testuser'} def setup Environment.default.enable('products_for_enterprises') @profile = create_user('testuser').person end attr_reader :profile - noosfero_test :profile => 'testuser' - should 'list friends' do get :friends diff --git a/test/functional/profile_design_controller_test.rb b/test/functional/profile_design_controller_test.rb index 3770477..e47122d 100644 --- a/test/functional/profile_design_controller_test.rb +++ b/test/functional/profile_design_controller_test.rb @@ -1,8 +1,6 @@ require_relative "../test_helper" require 'profile_design_controller' -class ProfileDesignController; def rescue_action(e) raise e end; end - class ProfileDesignControllerTest < ActionController::TestCase COMMOM_BLOCKS = [ ArticleBlock, TagsBlock, RecentDocumentsBlock, ProfileInfoBlock, LinkListBlock, MyNetworkBlock, FeedReaderBlock, ProfileImageBlock, LocationBlock, SlideshowBlock, ProfileSearchBlock, HighlightsBlock ] diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index fde38e3..c5938d2 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'profile_editor_controller' -# Re-raise errors caught by the controller. -class ProfileEditorController; def rescue_action(e) raise e end; end - class ProfileEditorControllerTest < ActionController::TestCase all_fixtures diff --git a/test/functional/profile_members_controller_test.rb b/test/functional/profile_members_controller_test.rb index bc3bdfa..f4d010e 100644 --- a/test/functional/profile_members_controller_test.rb +++ b/test/functional/profile_members_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'profile_members_controller' -# Re-raise errors caught by the controller. -class ProfileMembersController; def rescue_action(e) raise e end; end - class ProfileMembersControllerTest < ActionController::TestCase def setup super @@ -20,7 +17,7 @@ class ProfileMembersControllerTest < ActionController::TestCase get 'index', :profile => 'test_enterprise' assert_response 403 - assert_template 'access_denied' + assert_template 'shared/access_denied' end should 'access index' do diff --git a/test/functional/profile_roles_controller_test.rb b/test/functional/profile_roles_controller_test.rb index 0d83cc9..796ea77 100644 --- a/test/functional/profile_roles_controller_test.rb +++ b/test/functional/profile_roles_controller_test.rb @@ -28,7 +28,7 @@ class ProfileRolesControllerTest < ActionController::TestCase post :create, :profile => community.identifier, :role => {:name => "new_admin", :permissions => ["edit_profile"] } assert_response 403 - assert_template 'access_denied' + assert_template 'shared/access_denied' role = Role.where(:name => 'new_admin') diff --git a/test/functional/profile_search_controller_test.rb b/test/functional/profile_search_controller_test.rb index 6f05e51..358e240 100644 --- a/test/functional/profile_search_controller_test.rb +++ b/test/functional/profile_search_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'profile_search_controller' -# Re-raise errors caught by the controller. -class ProfileSearchController; def rescue_action(e) raise e end; end - class ProfileSearchControllerTest < ActionController::TestCase def setup @controller = ProfileSearchController.new @@ -96,7 +93,7 @@ class ProfileSearchControllerTest < ActionController::TestCase end should 'display number of results found' do - article1 = TextileArticle.create(:name => 'Article 1', :body => 'Article to test profile search', :body => 'Article to test profile search', :profile => person) + article1 = TextileArticle.create(:name => 'Article 1', :body => 'Article to test profile search', :profile => person) article2 = TextileArticle.create(:name => 'Article 2', :body => 'Another article to test profile search', :profile => person) get 'index', :profile => person.identifier, :q => 'article to test' diff --git a/test/functional/profile_themes_controller_test.rb b/test/functional/profile_themes_controller_test.rb index ee53a6e..9745c36 100644 --- a/test/functional/profile_themes_controller_test.rb +++ b/test/functional/profile_themes_controller_test.rb @@ -1,7 +1,4 @@ require_relative "../test_helper" -# require 'profile_themes_controller' - -class ProfileThemesController; def rescue_action(e) raise e end; end class ProfileThemesControllerTest < ActionController::TestCase @@ -116,7 +113,7 @@ class ProfileThemesControllerTest < ActionController::TestCase should 'create a new theme' do post :new, :profile => 'testinguser', :name => 'My theme' - + ok('theme should be created') do profile.themes.first.id == 'my-theme' end @@ -197,7 +194,7 @@ class ProfileThemesControllerTest < ActionController::TestCase should 'display "add image" button' do theme = Theme.create('mytheme', :owner => profile) get :edit, :profile => 'testinguser', :id => 'mytheme' - + assert_tag :tag => 'a', :attributes => { :href => '/myprofile/testinguser/profile_themes/add_image/mytheme' } end diff --git a/test/functional/public_controller_test.rb b/test/functional/public_controller_test.rb index 8e6fb26..a28574a 100644 --- a/test/functional/public_controller_test.rb +++ b/test/functional/public_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'public_controller' -# Re-raise errors caught by the controller. -class PublicController; def rescue_action(e) raise e end; end - class PublicControllerTest < ActionController::TestCase should 'inherit from ApplicationController' do diff --git a/test/functional/region_validators_controller_test.rb b/test/functional/region_validators_controller_test.rb index 7ecf997..51345e1 100644 --- a/test/functional/region_validators_controller_test.rb +++ b/test/functional/region_validators_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'region_validators_controller' -# Re-raise errors caught by the controller. -class RegionValidatorsController; def rescue_action(e) raise e end; end - class RegionValidatorsControllerTest < ActionController::TestCase all_fixtures def setup @@ -12,7 +9,7 @@ class RegionValidatorsControllerTest < ActionController::TestCase @response = ActionController::TestResponse.new login_as('ze') end - + # Replace this with your real tests. should 'list regions at index' do get :index @@ -39,7 +36,7 @@ class RegionValidatorsControllerTest < ActionController::TestCase should 'search possible validators by name' do environment = fast_create(Environment, :name => "my environment") - give_permission('ze', 'manage_environment_validators', environment) + give_permission('ze', 'manage_environment_validators', environment) region = Region.new(:name => 'my region') environment.regions << region assert !region.new_record? @@ -84,7 +81,7 @@ class RegionValidatorsControllerTest < ActionController::TestCase post :remove, :id => region.id, :validator_id => org.id assert_response :redirect assert_redirected_to :action => 'region', :id => region.id - + assert !Region.find(region.id).validators.include?(org) end diff --git a/test/functional/role_controller_test.rb b/test/functional/role_controller_test.rb index 2027325..b7271cf 100644 --- a/test/functional/role_controller_test.rb +++ b/test/functional/role_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'role_controller' -# Re-raise errors caught by the controller. -class RoleController; def rescue_action(e) raise e end; end - class RoleControllerTest < ActionController::TestCase all_fixtures @@ -26,13 +23,13 @@ class RoleControllerTest < ActionController::TestCase assert_response :success assert_template 'show' assert assigns(:role) - assert_equal @role.id, assigns(:role).id + assert_equal @role.id, assigns(:role).id end def test_can_edit get 'edit', :id => @role.id assert_not_nil assigns(:role) - assert_equal @role.id, assigns(:role).id + assert_equal @role.id, assigns(:role).id end def test_should_update_to_valid_parameters @@ -42,7 +39,7 @@ class RoleControllerTest < ActionController::TestCase assert_not_nil assigns(:role) assert_nil session[:notice] end - + def test_should_not_update_to_invalid_paramters Role.any_instance.stubs(:valid?).returns(false) post 'update', :id => @role.id diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index 21d23b8..0ec0a55 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -2,9 +2,6 @@ require_relative "../test_helper" require 'search_controller' -# Re-raise errors caught by the controller. -class SearchController; def rescue_action(e) raise e end; end - class SearchControllerTest < ActionController::TestCase def setup @@ -54,7 +51,7 @@ class SearchControllerTest < ActionController::TestCase should 'search only in specified types of content' do get :articles, :query => 'something not important' - assert_equal ['articles'], assigns(:searches).keys + assert_equal [:articles], assigns(:searches).keys end should 'render success in search' do diff --git a/test/functional/system_controller_test.rb b/test/functional/system_controller_test.rb index 2e6cc3a..b3ba8ea 100644 --- a/test/functional/system_controller_test.rb +++ b/test/functional/system_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'system_controller' -# Re-raise errors caught by the controller. -class SystemController; def rescue_action(e) raise e end; end - class SystemControllerTest < ActionController::TestCase def setup @controller = SystemController.new diff --git a/test/functional/tasks_controller_test.rb b/test/functional/tasks_controller_test.rb index 49d0d6d..399bb04 100644 --- a/test/functional/tasks_controller_test.rb +++ b/test/functional/tasks_controller_test.rb @@ -1,12 +1,9 @@ require_relative "../test_helper" require 'tasks_controller' -class TasksController; def rescue_action(e) raise e end; end - class TasksControllerTest < ActionController::TestCase - noosfero_test :profile => 'testuser' - + self.default_params = {profile: 'testuser'} def setup @controller = TasksController.new @request = ActionController::TestRequest.new @@ -149,7 +146,7 @@ class TasksControllerTest < ActionController::TestCase should 'create a ticket with profile requestor' do post :new, :profile => profile.identifier, :ticket => {:name => 'new task'} - + assert_equal profile, assigns(:ticket).requestor end @@ -628,7 +625,7 @@ class TasksControllerTest < ActionController::TestCase assert_select ".task_responsible select", 0 assert_select ".task_responsible .value" - end + end should 'store the person who closes a task' do t = profile.tasks.build; t.save! diff --git a/test/functional/templates_controller_test.rb b/test/functional/templates_controller_test.rb index c011818..ec765c8 100644 --- a/test/functional/templates_controller_test.rb +++ b/test/functional/templates_controller_test.rb @@ -1,20 +1,16 @@ require_relative "../test_helper" require 'templates_controller' -# Re-raise errors caught by the controller. -class TemplatesController; def rescue_action(e) raise e end; end - class TemplatesControllerTest < ActionController::TestCase def setup @controller = TemplatesController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - Environment.destroy_all - @environment = fast_create(Environment, :is_default => true) + + @environment = Environment.default login_as(create_admin_user(@environment)) end - attr_accessor :environment should 'create person template' do @@ -37,9 +33,9 @@ class TemplatesControllerTest < ActionController::TestCase c1= fast_create(Community, :is_template => true, :environment_id => environment.id) environment.community_default_template= c1 environment.save - + c3 = fast_create(Community, :is_template => true, :environment_id => environment.id) - + post :set_community_as_default, :template_id => c3.id environment.reload assert_equal c3, environment.community_default_template @@ -50,9 +46,9 @@ class TemplatesControllerTest < ActionController::TestCase p1= fast_create(Person, :is_template => true, :environment_id => environment.id) environment.person_default_template= p1 environment.save - + p3 = fast_create(Person, :is_template => true, :environment_id => environment.id) - + post :set_person_as_default, :template_id => p3.id environment.reload assert_equal p3, environment.person_default_template @@ -63,9 +59,9 @@ class TemplatesControllerTest < ActionController::TestCase e1= fast_create(Enterprise, :is_template => true, :environment_id => environment.id) environment.enterprise_default_template= e1 environment.save - + e3 = fast_create(Enterprise, :is_template => true, :environment_id => environment.id) - + post :set_enterprise_as_default, :template_id => e3.id environment.reload assert_equal e3, environment.enterprise_default_template @@ -89,10 +85,10 @@ class TemplatesControllerTest < ActionController::TestCase p1= fast_create(Person, :is_template => true, :environment_id => environment.id) environment.person_default_template= p1 environment.save - + env2 = fast_create(Environment) p3 = fast_create(Person, :is_template => true, :environment_id => env2.id) - + post :set_person_as_default, :template_id => p3.id environment.reload assert_not_equal p3, environment.person_default_template @@ -103,10 +99,10 @@ class TemplatesControllerTest < ActionController::TestCase e1= fast_create(Enterprise, :is_template => true, :environment_id => environment.id) environment.enterprise_default_template= e1 environment.save - + env2 = fast_create(Environment) e3 = fast_create(Enterprise, :is_template => true, :environment_id => env2.id) - + post :set_enterprise_as_default, :template_id => e3.id environment.reload assert_not_equal e3, environment.enterprise_default_template diff --git a/test/functional/trusted_sites_controller_test.rb b/test/functional/trusted_sites_controller_test.rb index 62edf85..158d650 100644 --- a/test/functional/trusted_sites_controller_test.rb +++ b/test/functional/trusted_sites_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'trusted_sites_controller' -# Re-raise errors caught by the controller. -class TrustedSitesController; def rescue_action(e) raise e end; end - class TrustedSitesControllerTest < ActionController::TestCase all_fixtures diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index 70e52fc..a488ce5 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -1,9 +1,6 @@ require_relative "../test_helper" require 'users_controller' -# Re-raise errors caught by the controller. -class UsersController; def rescue_action(e) raise e end; end - class UsersControllerTest < ActionController::TestCase def setup @@ -11,14 +8,11 @@ class UsersControllerTest < ActionController::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - Environment.destroy_all - @environment = fast_create(Environment, :is_default => true) - + @environment = Environment.default admin_user = create_user_with_permission('adminuser', 'manage_environment_users', environment) login_as('adminuser') end - attr_accessor :environment should 'not access without right permission' do @@ -69,7 +63,6 @@ class UsersControllerTest < ActionController::TestCase should 'set admin role' do person = create_user.person - Role.create!(:name => 'Admin', :key => 'environment_administrator', :environment => environment, :permissions => ['view_environment_admin_panel']) assert_equal false, person.is_admin? post :set_admin_role, :id => person.id, :q => '' person.reload @@ -78,7 +71,6 @@ class UsersControllerTest < ActionController::TestCase should 'reset admin role' do person = create_user.person - Role.create!(:name => 'Admin', :key => 'environment_administrator', :environment => environment, :permissions => ['view_environment_admin_panel']) environment.add_admin(person) assert person.is_admin? diff --git a/test/test_helper.rb b/test/test_helper.rb index ca7724b..9d9e77a 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -80,21 +80,6 @@ class ActiveSupport::TestCase end - def self.noosfero_test parameters - instance_variable_set('@noosfero_test_extra_parameters', parameters) - def extra_parameters - @noosfero_test_extra_parameters - end - end - - def get(path, parameters = nil, headers = nil) - super(path, (parameters ? self.class.extra_parameters.merge(parameters) : self.class.extra_parameters) , headers) - end - - def post(path, parameters = nil, headers = nil) - super(path, (parameters ? self.class.extra_parameters.merge(parameters) : self.class.extra_parameters), headers) - end - # deprecated on minitest def assert_block message=nil assert message || 'yield' do @@ -298,6 +283,21 @@ module NoosferoTestHelper end +class ActionController::TestCase + + class_attribute :default_params + self.default_params = {} + + def get path, parameters = nil, session = nil, flash = nil + super path, if parameters then self.default_params.merge parameters else self.default_params end, session, flash + end + + def post path, parameters = nil, session = nil, flash = nil + super path, if parameters then self.default_params.merge parameters else self.default_params end, session, flash + end + +end + class ActionController::IntegrationTest def assert_can_login assert_tag :tag => 'a', :attributes => { :id => 'link_login' } diff --git a/vendor/plugins/access_control/test/permission_check_test.rb b/vendor/plugins/access_control/test/permission_check_test.rb index 81b84fc..9cb43d5 100644 --- a/vendor/plugins/access_control/test/permission_check_test.rb +++ b/vendor/plugins/access_control/test/permission_check_test.rb @@ -1,6 +1,5 @@ require File.join(File.dirname(__FILE__), 'test_helper') -class AccessControlTestController; def rescue_action(e) raise e end; end class PermissionCheckTest < ActionController::TestCase def setup @@ -12,7 +11,7 @@ class PermissionCheckTest < ActionController::TestCase def test_access_denied get :index assert_response 403 - assert_template 'access_denied.html' + assert_template 'shared/access_denied' end def test_specific_permission_granted diff --git a/vendor/plugins/honeypot/init.rb b/vendor/plugins/honeypot/init.rb index 994ec92..0ef34dd 100644 --- a/vendor/plugins/honeypot/init.rb +++ b/vendor/plugins/honeypot/init.rb @@ -1,5 +1,5 @@ # Inpired on https://github.com/curtis/honeypot-captcha -require File.join(File.dirname(__FILE__), 'lib', 'form_tag_helper') +require_dependency File.join(File.dirname(__FILE__), 'lib', 'form_tag_helper') module Honeypot def honeypot_fields diff --git a/vendor/plugins/honeypot/lib/form_tag_helper.rb b/vendor/plugins/honeypot/lib/form_tag_helper.rb index d9b4217..d0aa995 100644 --- a/vendor/plugins/honeypot/lib/form_tag_helper.rb +++ b/vendor/plugins/honeypot/lib/form_tag_helper.rb @@ -1,20 +1,16 @@ module ActionView module Helpers module FormTagHelper - def form_tag_with_honeypot(url_for_options = {}, options = {}, *parameters_for_url, &block) - honeypot = options.delete(:honeypot) - html = form_tag_without_honeypot(url_for_options, options, *parameters_for_url, &block) + def form_tag_with_body_with_honeypot html_options = {}, content + honeypot = html_options.delete 'honeypot' + html = form_tag_with_body_without_honeypot html_options, content if honeypot - captcha = "".respond_to?(:html_safe) ? honey_pot_captcha.html_safe : honey_pot_captcha - if block_given? - html.insert(html.index(''), captcha) - else - html += captcha - end + captcha = honey_pot_captcha.html_safe + html.insert html.index(''), captcha end html end - alias_method_chain :form_tag, :honeypot + alias_method_chain :form_tag_with_body, :honeypot private -- libgit2 0.21.2