diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4a3a1c6..1a5954d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -6,6 +6,8 @@ require 'redcloth' # application. module ApplicationHelper + include JavascriptHelper + include PermissionNameHelper include UrlHelper diff --git a/app/helpers/javascript_helper.rb b/app/helpers/javascript_helper.rb new file mode 100644 index 0000000..e8f88dc --- /dev/null +++ b/app/helpers/javascript_helper.rb @@ -0,0 +1,10 @@ +module JavascriptHelper + + def link_to_function name, function, html_options={} + + onclick = "#{"#{html_options[:onclick]}; " if html_options[:onclick]}#{function}; return false;" + href = html_options[:href] || '#' + + content_tag :a, name, html_options.merge(href: href, onclick: onclick) + end +end diff --git a/lib/noosfero/multi_tenancy.rb b/lib/noosfero/multi_tenancy.rb index 823eaa8..7d0c88b 100644 --- a/lib/noosfero/multi_tenancy.rb +++ b/lib/noosfero/multi_tenancy.rb @@ -17,7 +17,7 @@ module Noosfero end def self.setup!(host) - if Noosfero::MultiTenancy.on? and ActiveRecord::Base.postgresql? + if Noosfero::MultiTenancy.on? and ApplicationRecord.postgresql? Noosfero::MultiTenancy.db_by_host = host end end diff --git a/plugins/analytics/test/functional/content_viewer_controller_test.rb b/plugins/analytics/test/functional/content_viewer_controller_test.rb index a64bf45..4fd0aff 100644 --- a/plugins/analytics/test/functional/content_viewer_controller_test.rb +++ b/plugins/analytics/test/functional/content_viewer_controller_test.rb @@ -5,8 +5,6 @@ class ContentViewerControllerTest < ActionController::TestCase def setup @controller = ContentViewerController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @environment = Environment.default @environment.enabled_plugins += ['AnalyticsPlugin'] 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 1f14315..51e3523 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 @@ -5,8 +5,6 @@ class CommentGroupPluginProfileControllerTest < ActionController::TestCase def setup @controller = CommentGroupPluginProfileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @profile = create_user('testuser').person @article = profile.articles.build(:name => 'test') 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 96c2cd0..7fcbe97 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 @@ -5,8 +5,6 @@ class CommentGroupPluginPublicControllerTest < ActionController::TestCase def setup @controller = CommentGroupPluginPublicController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @profile = create_user('testuser').person @article = profile.articles.build(:name => 'test') 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 f3737df..dc966ea 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 @@ -4,8 +4,7 @@ require_relative '../../controllers/custom_forms_plugin_myprofile_controller' class CustomFormsPluginMyprofileControllerTest < ActionController::TestCase def setup @controller = CustomFormsPluginMyprofileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @profile = create_user('profile').person login_as(@profile.identifier) environment = Environment.default 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 74b90cf..84f68d8 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 @@ -4,8 +4,7 @@ require_relative '../../controllers/custom_forms_plugin_profile_controller' class CustomFormsPluginProfileControllerTest < ActionController::TestCase def setup @controller = CustomFormsPluginProfileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @profile = create_user('profile').person login_as(@profile.identifier) environment = Environment.default 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 fefd2d1..adf2a3b 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 @@ -5,8 +5,6 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase def setup @controller = DisplayContentPluginAdminController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @environment = Environment.default user_login = create_admin_user(@environment) 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 d6a8510..e7cbbeb 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 @@ -5,8 +5,6 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase def setup @controller = DisplayContentPluginMyprofileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new user = create_user('testinguser') login_as(user.login) diff --git a/plugins/driven_signup/test/integration/account_controller_test.rb b/plugins/driven_signup/test/integration/account_controller_test.rb index 1dd6fe4..aecb43e 100644 --- a/plugins/driven_signup/test/integration/account_controller_test.rb +++ b/plugins/driven_signup/test/integration/account_controller_test.rb @@ -7,8 +7,6 @@ class AccountControllerTest < ActionDispatch::IntegrationTest def setup @controller = AccountController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new e = Environment.default e.enable 'skip_new_user_email_confirmation', true diff --git a/plugins/environment_notification/test/functional/account_controller_test.rb b/plugins/environment_notification/test/functional/account_controller_test.rb index 8eef307..e119e6f 100644 --- a/plugins/environment_notification/test/functional/account_controller_test.rb +++ b/plugins/environment_notification/test/functional/account_controller_test.rb @@ -8,8 +8,7 @@ end class AccountControllerTest < ActionController::TestCase def setup @controller = AccountController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @person = create_user('person').person @environment = Environment.default diff --git a/plugins/environment_notification/test/functional/environment_notification_plugin_admin_controller_test.rb b/plugins/environment_notification/test/functional/environment_notification_plugin_admin_controller_test.rb index a0b784a..a5ac9ef 100644 --- a/plugins/environment_notification/test/functional/environment_notification_plugin_admin_controller_test.rb +++ b/plugins/environment_notification/test/functional/environment_notification_plugin_admin_controller_test.rb @@ -7,8 +7,7 @@ end class EnvironmentNotificationPluginAdminControllerTest < ActionController::TestCase def setup @controller = EnvironmentNotificationPluginAdminController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @person = create_user('person').person @environment = Environment.default diff --git a/plugins/environment_notification/test/functional/home_controller_test.rb b/plugins/environment_notification/test/functional/home_controller_test.rb index 73dfd33..0f3a43f 100644 --- a/plugins/environment_notification/test/functional/home_controller_test.rb +++ b/plugins/environment_notification/test/functional/home_controller_test.rb @@ -7,8 +7,7 @@ end class HomeControllerTest < ActionController::TestCase def setup @controller = HomeController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @person = create_user('person').person @environment = Environment.default 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 69e6123..31066c0 100644 --- a/plugins/google_analytics/test/functional/profile_editor_controller_test.rb +++ b/plugins/google_analytics/test/functional/profile_editor_controller_test.rb @@ -5,8 +5,7 @@ class ProfileEditorControllerTest < ActionController::TestCase def setup @controller = ProfileEditorController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @profile = create_user('default_user').person login_as(@profile.identifier) Environment.default.enable_plugin(GoogleAnalyticsPlugin.name) 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 3cd99fb..1d3d46d 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 @@ -5,8 +5,6 @@ class GoogleCsePluginControllerTest < ActionController::TestCase def setup @controller = GoogleCsePluginController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new end should 'get results page' do 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 0564d04..76a6786 100644 --- a/plugins/html5_video/test/functional/content_viewer_controler_test.rb +++ b/plugins/html5_video/test/functional/content_viewer_controler_test.rb @@ -7,8 +7,6 @@ class ContentViewerControllerTest < ActionController::TestCase def setup @controller = ContentViewerController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @profile = create_user('testinguser').person @environment = @profile.environment diff --git a/plugins/ldap/test/functional/account_controller_plugin_test.rb b/plugins/ldap/test/functional/account_controller_plugin_test.rb index 7c103f3..3ef686f 100644 --- a/plugins/ldap/test/functional/account_controller_plugin_test.rb +++ b/plugins/ldap/test/functional/account_controller_plugin_test.rb @@ -4,8 +4,6 @@ class AccountControllerPluginTest < ActionController::TestCase def setup @controller = AccountController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @environment = Environment.default @environment.enabled_plugins = ['LdapPlugin'] 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 715da97..e1d8559 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 @@ -4,8 +4,7 @@ require_relative '../../controllers/mark_comment_as_read_plugin_profile_controll class MarkCommentAsReadPluginProfileControllerTest < ActionController::TestCase def setup @controller = MarkCommentAsReadPluginProfileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @profile = create_user('profile').person @article = TinyMceArticle.create!(:profile => @profile, :name => 'An article') @comment = Comment.new(:source => @article, :author => @profile, :body => 'test') diff --git a/plugins/metadata/test/functional/content_viewer_controller_test.rb b/plugins/metadata/test/functional/content_viewer_controller_test.rb index 58e4d20..9c6c086 100644 --- a/plugins/metadata/test/functional/content_viewer_controller_test.rb +++ b/plugins/metadata/test/functional/content_viewer_controller_test.rb @@ -6,8 +6,6 @@ class ContentViewerControllerTest < ActionController::TestCase def setup @controller = ContentViewerController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @profile = create_user('testinguser').person @environment = @profile.environment diff --git a/plugins/metadata/test/functional/home_controller_test.rb b/plugins/metadata/test/functional/home_controller_test.rb index e8b5f9c..d9f2f87 100644 --- a/plugins/metadata/test/functional/home_controller_test.rb +++ b/plugins/metadata/test/functional/home_controller_test.rb @@ -5,8 +5,6 @@ class HomeControllerTest < ActionController::TestCase def setup @controller = HomeController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @environment = Environment.default @environment.enabled_plugins += ['MetadataPlugin'] diff --git a/plugins/metadata/test/functional/manage_products_controller_test.rb b/plugins/metadata/test/functional/manage_products_controller_test.rb index b75c8a6..b739471 100644 --- a/plugins/metadata/test/functional/manage_products_controller_test.rb +++ b/plugins/metadata/test/functional/manage_products_controller_test.rb @@ -5,8 +5,7 @@ class ManageProductsControllerTest < ActionController::TestCase def setup @controller = ManageProductsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @enterprise = fast_create(Enterprise, name: 'test', identifier: 'test_ent') @user = create_user_with_permission('test_user', 'manage_products', @enterprise) @environment = @enterprise.environment diff --git a/plugins/newsletter/test/functional/newsletter_plugin_admin_controller_test.rb b/plugins/newsletter/test/functional/newsletter_plugin_admin_controller_test.rb index f32c480..8aaf4cc 100644 --- a/plugins/newsletter/test/functional/newsletter_plugin_admin_controller_test.rb +++ b/plugins/newsletter/test/functional/newsletter_plugin_admin_controller_test.rb @@ -4,8 +4,6 @@ class NewsletterPluginAdminControllerTest < ActionController::TestCase def setup @controller = NewsletterPluginAdminController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @admin = create_user('admin_newsletter').person @environment = @admin.environment diff --git a/plugins/newsletter/test/functional/newsletter_plugin_controller_test.rb b/plugins/newsletter/test/functional/newsletter_plugin_controller_test.rb index 0e73b25..b15a156 100644 --- a/plugins/newsletter/test/functional/newsletter_plugin_controller_test.rb +++ b/plugins/newsletter/test/functional/newsletter_plugin_controller_test.rb @@ -4,8 +4,7 @@ class NewsletterPluginControllerTest < ActionController::TestCase def setup @controller = NewsletterPluginController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + environment = fast_create(Environment) environment.enable_plugin(NewsletterPlugin) @controller.stubs(:environment).returns(environment) diff --git a/plugins/open_graph/test/functional/open_graph_graph/my_profile_controller_test.rb b/plugins/open_graph/test/functional/open_graph_graph/my_profile_controller_test.rb index cb06a6b..49eebb4 100644 --- a/plugins/open_graph/test/functional/open_graph_graph/my_profile_controller_test.rb +++ b/plugins/open_graph/test/functional/open_graph_graph/my_profile_controller_test.rb @@ -8,8 +8,7 @@ class OpenGraphPlugin::MyprofileControllerTest < ActionController::TestCase def setup @controller = OpenGraphPlugin::MyprofileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @actor = create_user.person end diff --git a/plugins/organization_ratings/test/functional/organization_ratings_plugin_admin_controller_test.rb b/plugins/organization_ratings/test/functional/organization_ratings_plugin_admin_controller_test.rb index c635d37..a4b03d1 100644 --- a/plugins/organization_ratings/test/functional/organization_ratings_plugin_admin_controller_test.rb +++ b/plugins/organization_ratings/test/functional/organization_ratings_plugin_admin_controller_test.rb @@ -8,8 +8,6 @@ class OrganizationRatingsPluginAdminControllerTest < ActionController::TestCase def setup @controller = OrganizationRatingsPluginAdminController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @environment = Environment.default @environment.enabled_plugins = ['OrganizationRatingsPlugin'] diff --git a/plugins/organization_ratings/test/functional/organization_ratings_plugin_profile_controller_test.rb b/plugins/organization_ratings/test/functional/organization_ratings_plugin_profile_controller_test.rb index c7e4a14..a1b95fe 100644 --- a/plugins/organization_ratings/test/functional/organization_ratings_plugin_profile_controller_test.rb +++ b/plugins/organization_ratings/test/functional/organization_ratings_plugin_profile_controller_test.rb @@ -8,8 +8,6 @@ class OrganizationRatingsPluginProfileControllerTest < ActionController::TestCas def setup @controller = OrganizationRatingsPluginProfileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @environment = Environment.default @environment.enabled_plugins = ['OrganizationRatingsPlugin'] 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 f73214a..b0a80b6 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 @@ -4,8 +4,7 @@ class EnvironmentDesignControllerTest < ActionController::TestCase def setup @controller = EnvironmentDesignController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([PeopleBlockPlugin.new]) end 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 d3ea2eb..5d8ed61 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 @@ -4,8 +4,7 @@ class ProfileDesignControllerTest < ActionController::TestCase def setup @controller = ProfileDesignController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([PeopleBlockPlugin.new]) end diff --git a/plugins/people_block/test/functional/profile_controller_test.rb b/plugins/people_block/test/functional/profile_controller_test.rb index cb077c5..c7efefb 100644 --- a/plugins/people_block/test/functional/profile_controller_test.rb +++ b/plugins/people_block/test/functional/profile_controller_test.rb @@ -4,8 +4,7 @@ class ProfileControllerTest < ActionController::TestCase def setup @controller = ProfileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([PeopleBlockPlugin.new]) end diff --git a/plugins/relevant_content/test/unit/article.rb b/plugins/relevant_content/test/unit/article.rb index 4c70d88..877f81c 100644 --- a/plugins/relevant_content/test/unit/article.rb +++ b/plugins/relevant_content/test/unit/article.rb @@ -8,8 +8,7 @@ class RelevantContentBlockTest < ActiveSupport::TestCase def setup @controller = CommentController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @profile = create_user('testinguser').person @environment = @profile.environment end 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 920cbce..16be229 100644 --- a/plugins/relevant_content/test/unit/relevant_content_block_test.rb +++ b/plugins/relevant_content/test/unit/relevant_content_block_test.rb @@ -9,8 +9,6 @@ class RelevantContentBlockTest < ActiveSupport::TestCase def setup @controller = CommentController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @profile = create_user('testinguser').person @environment = @profile.environment 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 2b527f3..43859e9 100644 --- a/plugins/remote_user/test/functional/remote_user_plugin_test.rb +++ b/plugins/remote_user/test/functional/remote_user_plugin_test.rb @@ -2,6 +2,8 @@ require 'test_helper' class AccountControllerTest < ActionController::TestCase def setup + @controller = AccountController.new + @environment = Environment.default @environment.enabled_plugins = ['RemoteUserPlugin'] @environment.save @@ -9,10 +11,6 @@ class AccountControllerTest < ActionController::TestCase @another_environment = Environment.new(name: "AnotherEnvironment") @another_environment.enabled_plugins = ['RemoteUserPlugin'] @another_environment.save - - @controller = AccountController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new end should 'not authenticate user if there is no remote user' do 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 71d20df..e219e57 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 @@ -5,8 +5,7 @@ class ShoppingCartPluginControllerTest < ActionController::TestCase def setup @controller = ShoppingCartPluginController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @profile = fast_create(Enterprise) @profile.contact_email = 'enterprise@noosfero.org';@profile.save @product = fast_create(Product, profile_id: @profile.id) 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 1941a68..27bcd9b 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 @@ -5,8 +5,6 @@ class ContentViewerControllerTest < ActionController::TestCase def setup @controller = ContentViewerController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @profile = create_user('testinguser').person @environment = @profile.environment diff --git a/plugins/solr/lib/acts_as_searchable.rb b/plugins/solr/lib/acts_as_searchable.rb index bd26a5d..f05f09b 100644 --- a/plugins/solr/lib/acts_as_searchable.rb +++ b/plugins/solr/lib/acts_as_searchable.rb @@ -35,7 +35,7 @@ module ActsAsSearchable module FindByContents def schema_name - (Noosfero::MultiTenancy.on? and ActiveRecord::Base.postgresql?) ? ActiveRecord::Base.connection.schema_search_path : '' + (Noosfero::MultiTenancy.on? and ApplicationRecord.postgresql?) ? ActiveRecord::Base.connection.schema_search_path : '' end def find_by_contents(query, pg_options = {}, options = {}, db_options = {}) diff --git a/plugins/solr/test/functional/search_controller_test.rb b/plugins/solr/test/functional/search_controller_test.rb index 399a226..38091b5 100644 --- a/plugins/solr/test/functional/search_controller_test.rb +++ b/plugins/solr/test/functional/search_controller_test.rb @@ -4,14 +4,12 @@ require_relative '../../lib/ext/facets_browse' class SearchControllerTest < ActionController::TestCase def setup + @controller = SearchController.new + TestSolr.enable p1 = File.join(RAILS_ROOT, 'app', 'views') p2 = File.join(File.dirname(__FILE__) + '/../../views') SearchController.append_view_path([p1,p2]) - @controller = SearchController.new - @request = ActionController::TestRequest.new - @request.stubs(:ssl?).returns(false) - @response = ActionController::TestResponse.new @category = Category.create!(:name => 'my category', :environment => Environment.default) 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 a417d13..850553f 100644 --- a/plugins/spaminator/test/functional/spaminator_plugin_admin_controller_test.rb +++ b/plugins/spaminator/test/functional/spaminator_plugin_admin_controller_test.rb @@ -4,8 +4,7 @@ require_relative '../../controllers/spaminator_plugin_admin_controller' class SpaminatorPluginAdminControllerTest < ActionController::TestCase def setup @controller = SpaminatorPluginAdminController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @environment = Environment.default @settings = Noosfero::Plugin::Settings.new(@environment, SpaminatorPlugin) login_as(create_admin_user(@environment)) diff --git a/plugins/stoa/test/functional/account_controller_test.rb b/plugins/stoa/test/functional/account_controller_test.rb index ea49746..a5cd985 100644 --- a/plugins/stoa/test/functional/account_controller_test.rb +++ b/plugins/stoa/test/functional/account_controller_test.rb @@ -19,8 +19,7 @@ class AccountControllerTest < ActionController::TestCase def setup @controller = AccountController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + StoaPlugin::UspUser.create! codpes: 12345678, cpf: Digest::MD5.hexdigest(SALT+'12345678'), birth_date: '1970-01-30' Environment.default.enable_plugin(StoaPlugin.name) @user = create_user('joao-stoa', {:password => 'pass', :password_confirmation => 'pass'},:usp_id=>'87654321') diff --git a/plugins/stoa/test/functional/invite_controller_test.rb b/plugins/stoa/test/functional/invite_controller_test.rb index 4ef83a6..0649782 100644 --- a/plugins/stoa/test/functional/invite_controller_test.rb +++ b/plugins/stoa/test/functional/invite_controller_test.rb @@ -5,8 +5,7 @@ class InviteControllerTest < ActionController::TestCase def setup @controller = InviteController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + environment = Environment.default environment.enabled_plugins = ['StoaPlugin'] environment.save! diff --git a/plugins/stoa/test/functional/profile_editor_controller_test.rb b/plugins/stoa/test/functional/profile_editor_controller_test.rb index 9ad9ba7..e03a00c 100644 --- a/plugins/stoa/test/functional/profile_editor_controller_test.rb +++ b/plugins/stoa/test/functional/profile_editor_controller_test.rb @@ -7,8 +7,7 @@ class StoaPluginProfileEditorControllerTest < ActionController::TestCase def setup @controller = ProfileEditorController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @person = User.create(:login => 'test_user', :email => 'test_user@example.com', :password => 'test', :password_confirmation => 'test').person login_as(@person.identifier) Environment.default.enable_plugin(StoaPlugin.name) diff --git a/plugins/stoa/test/functional/stoa_plugin_controller_test.rb b/plugins/stoa/test/functional/stoa_plugin_controller_test.rb index dd842cb..9e3f03c 100644 --- a/plugins/stoa/test/functional/stoa_plugin_controller_test.rb +++ b/plugins/stoa/test/functional/stoa_plugin_controller_test.rb @@ -7,8 +7,7 @@ class StoaPluginControllerTest < ActionController::TestCase def setup @controller = StoaPluginController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + ActiveRecord::Base.configurations['stoa'] = {:adapter => 'sqlite3', :database => ':memory:', :verbosity => 'quiet'} env = Environment.default env.enable_plugin(StoaPlugin.name) 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 09c4913..da300c6 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 @@ -7,8 +7,7 @@ class SubOrganizationsPluginMyprofileController; def rescue_action(e) raise e en class SubOrganizationsPluginMyprofileControllerTest < ActionController::TestCase def setup @controller = SubOrganizationsPluginMyprofileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @organization = Organization.create!(:name => 'My Organization', :identifier => 'my-organization') @person = create_user('person').person @organization.add_admin(@person) 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 a3b123b..afa2fd7 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 @@ -8,8 +8,7 @@ class SubOrganizationsPluginProfileControllerTest < ActionController::TestCase def setup @controller = SubOrganizationsPluginProfileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @organization = Organization.create!(:name => 'My Organization', :identifier => 'my-organization') @person = create_user('person').person @organization.add_admin(@person) 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 367defe..51d41cc 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 @@ -4,8 +4,6 @@ class EnvironmentDesignControllerTest < ActionController::TestCase def setup @controller = EnvironmentDesignController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new Environment.delete_all User.delete_all 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 3cf520d..b8f3c82 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 @@ -4,8 +4,6 @@ class ProfileDesignControllerTest < ActionController::TestCase def setup @controller = ProfileDesignController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new user = create_user('testinguser') login_as(user.login) diff --git a/plugins/work_assignment/test/functional/cms_controller_test.rb b/plugins/work_assignment/test/functional/cms_controller_test.rb index 9d61001..364faf2 100644 --- a/plugins/work_assignment/test/functional/cms_controller_test.rb +++ b/plugins/work_assignment/test/functional/cms_controller_test.rb @@ -5,8 +5,7 @@ class CmsControllerTest < ActionController::TestCase def setup @controller = CmsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @person = create_user('test_user').person login_as :test_user e = Environment.default 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 e249497..8c4f3eb 100644 --- a/plugins/work_assignment/test/functional/content_viewer_controller_test.rb +++ b/plugins/work_assignment/test/functional/content_viewer_controller_test.rb @@ -5,8 +5,7 @@ class ContentViewerControllerTest < ActionController::TestCase def setup @controller = ContentViewerController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @profile = create_user('testinguser').person @organization = fast_create(Organization) 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 f57cff8..b2bce1a 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 @@ -5,8 +5,7 @@ class WorkAssignmentPluginMyprofileControllerTest < ActionController::TestCase def setup @controller = WorkAssignmentPluginMyprofileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @person = create_user('test_user').person login_as :test_user e = Environment.default diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index 12156a9..5fd8eb7 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -11,8 +11,7 @@ class AccountControllerTest < ActionController::TestCase def setup @controller = AccountController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + disable_signup_bot_check end diff --git a/test/functional/admin_panel_controller_test.rb b/test/functional/admin_panel_controller_test.rb index ba38412..86c5b8d 100644 --- a/test/functional/admin_panel_controller_test.rb +++ b/test/functional/admin_panel_controller_test.rb @@ -6,8 +6,7 @@ class AdminPanelControllerTest < ActionController::TestCase all_fixtures def setup @controller = AdminPanelController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + login_as(create_admin_user(Environment.default)) end diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb index 1032ba2..5c0ff3b 100644 --- a/test/functional/application_controller_test.rb +++ b/test/functional/application_controller_test.rb @@ -4,10 +4,9 @@ require 'test_controller' class ApplicationControllerTest < ActionController::TestCase all_fixtures + def setup @controller = TestController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new end def test_detection_of_environment_by_host @@ -50,7 +49,7 @@ class ApplicationControllerTest < ActionController::TestCase current = fast_create(Environment, :name => 'test environment') current.domains.create!(:name => 'example.com') - @request.expects(:host).returns('example.com').at_least_once + @request.env['HTTP_HOST'] = 'example.com' get :index assert_equal current, assigns(:environment) diff --git a/test/functional/catalog_controller_test.rb b/test/functional/catalog_controller_test.rb index 14370f5..5a564a6 100644 --- a/test/functional/catalog_controller_test.rb +++ b/test/functional/catalog_controller_test.rb @@ -4,8 +4,6 @@ require 'catalog_controller' class CatalogControllerTest < ActionController::TestCase def setup @controller = CatalogController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new Environment.default.enable('products_for_enterprises') @enterprise = fast_create(Enterprise, :name => 'My enterprise', :identifier => 'testent') diff --git a/test/functional/categories_controller_test.rb b/test/functional/categories_controller_test.rb index b96b4cb..8565c20 100644 --- a/test/functional/categories_controller_test.rb +++ b/test/functional/categories_controller_test.rb @@ -5,8 +5,6 @@ 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) diff --git a/test/functional/comment_controller_test.rb b/test/functional/comment_controller_test.rb index 08d5365..aa6c333 100644 --- a/test/functional/comment_controller_test.rb +++ b/test/functional/comment_controller_test.rb @@ -5,8 +5,6 @@ class CommentControllerTest < ActionController::TestCase def setup @controller = CommentController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @profile = create_user('testinguser').person @environment = @profile.environment diff --git a/test/functional/contact_controller_test.rb b/test/functional/contact_controller_test.rb index e456e28..c2098f7 100644 --- a/test/functional/contact_controller_test.rb +++ b/test/functional/contact_controller_test.rb @@ -8,8 +8,6 @@ class ContactControllerTest < ActionController::TestCase def setup @controller = ContactController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @profile = create_user('contact_test_user').person @enterprise = fast_create(Enterprise, :identifier => 'contact_test_enterprise', :name => 'Test contact enteprise') diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index c0f9d16..a91a4cd 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -7,8 +7,6 @@ class ContentViewerControllerTest < ActionController::TestCase def setup @controller = ContentViewerController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @profile = create_user('testinguser').person @environment = @profile.environment @@ -220,8 +218,7 @@ class ContentViewerControllerTest < ActionController::TestCase profile.domains << Domain.create!(:name => 'micojones.net') profile.save! - ActionController::TestRequest.any_instance.expects(:host).returns('www.micojones.net').at_least_once - + @request.env['HTTP_HOST'] = 'www.micojones.net' get :view_page, :page => [] assert_equal profile, assigns(:profile) diff --git a/test/functional/edit_template_controller_test.rb b/test/functional/edit_template_controller_test.rb index 8dd5e40..a4f2f59 100644 --- a/test/functional/edit_template_controller_test.rb +++ b/test/functional/edit_template_controller_test.rb @@ -7,8 +7,7 @@ class EditTemplateControllerTest < ActionController::TestCase all_fixtures def setup @controller = EditTemplateController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + login_as 'ze' end diff --git a/test/functional/enterprise_registration_controller_test.rb b/test/functional/enterprise_registration_controller_test.rb index 30767ac..ba8f041 100644 --- a/test/functional/enterprise_registration_controller_test.rb +++ b/test/functional/enterprise_registration_controller_test.rb @@ -9,8 +9,7 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase def setup super @controller = EnterpriseRegistrationController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + login_as 'ze' end diff --git a/test/functional/enterprise_validation_controller_test.rb b/test/functional/enterprise_validation_controller_test.rb index 8654aaf..097a9b0 100644 --- a/test/functional/enterprise_validation_controller_test.rb +++ b/test/functional/enterprise_validation_controller_test.rb @@ -7,8 +7,6 @@ class EnterpriseValidationControllerTest < ActionController::TestCase def setup @controller = EnterpriseValidationController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new login_as 'ze' @user = Profile['ze'] diff --git a/test/functional/environment_design_controller_test.rb b/test/functional/environment_design_controller_test.rb index f411be5..389c817 100644 --- a/test/functional/environment_design_controller_test.rb +++ b/test/functional/environment_design_controller_test.rb @@ -7,8 +7,7 @@ class EnvironmentDesignControllerTest < ActionController::TestCase def setup @controller = EnvironmentDesignController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) end diff --git a/test/functional/environment_role_manager_controller_test.rb b/test/functional/environment_role_manager_controller_test.rb index 1b44c65..b8fbb7b 100644 --- a/test/functional/environment_role_manager_controller_test.rb +++ b/test/functional/environment_role_manager_controller_test.rb @@ -4,8 +4,6 @@ require 'environment_role_manager_controller' class EnvironmentRoleManagerControllerTest < ActionController::TestCase def setup @controller = EnvironmentRoleManagerController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new end end diff --git a/test/functional/environment_themes_controller_test.rb b/test/functional/environment_themes_controller_test.rb index 9ef4720..aec61e8 100644 --- a/test/functional/environment_themes_controller_test.rb +++ b/test/functional/environment_themes_controller_test.rb @@ -4,8 +4,6 @@ class EnvironmentThemesControllerTest < ActionController::TestCase def setup @controller = EnvironmentThemesController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new Theme.stubs(:user_themes_dir).returns(TMP_THEMES_DIR) diff --git a/test/functional/favorite_enterprises_controller_test.rb b/test/functional/favorite_enterprises_controller_test.rb index df534e8..1e6b5f4 100644 --- a/test/functional/favorite_enterprises_controller_test.rb +++ b/test/functional/favorite_enterprises_controller_test.rb @@ -6,8 +6,6 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase self.default_params = {profile: 'testuser'} def setup @controller = FavoriteEnterprisesController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new self.profile = create_user('testuser').person self.favorite_enterprise = fast_create(Enterprise, :name => 'the_enterprise', :identifier => 'the_enterprise') diff --git a/test/functional/features_controller_test.rb b/test/functional/features_controller_test.rb index 647d79f..1fb7956 100644 --- a/test/functional/features_controller_test.rb +++ b/test/functional/features_controller_test.rb @@ -6,8 +6,6 @@ class FeaturesControllerTest < ActionController::TestCase all_fixtures def setup @controller = FeaturesController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new login_as(create_admin_user(Environment.find(2))) end diff --git a/test/functional/friends_controller_test.rb b/test/functional/friends_controller_test.rb index 2391eca..40c1226 100644 --- a/test/functional/friends_controller_test.rb +++ b/test/functional/friends_controller_test.rb @@ -6,8 +6,6 @@ class FriendsControllerTest < ActionController::TestCase self.default_params = {profile: 'testuser'} def setup @controller = FriendsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new self.profile = create_user('testuser').person self.friend = create_user('thefriend').person diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb index 32d076f..06f52fc 100644 --- a/test/functional/home_controller_test.rb +++ b/test/functional/home_controller_test.rb @@ -10,8 +10,6 @@ class HomeControllerTest < ActionController::TestCase all_fixtures def setup @controller = HomeController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new end should 'not display news from portal if disabled in environment' do diff --git a/test/functional/licenses_controller_test.rb b/test/functional/licenses_controller_test.rb index 1742710..a4987c5 100644 --- a/test/functional/licenses_controller_test.rb +++ b/test/functional/licenses_controller_test.rb @@ -5,8 +5,7 @@ class LicensesControllerTest < ActionController::TestCase def setup @controller = LicensesController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @environment = Environment.default login_as(create_admin_user(@environment)) end diff --git a/test/functional/mailconf_controller_test.rb b/test/functional/mailconf_controller_test.rb index 7c1d8ec..97b4e40 100644 --- a/test/functional/mailconf_controller_test.rb +++ b/test/functional/mailconf_controller_test.rb @@ -4,8 +4,7 @@ class MailconfControllerTest < ActionController::TestCase def setup @controller = MailconfController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + User.destroy_all @user = create_user('ze') diff --git a/test/functional/manage_products_controller_test.rb b/test/functional/manage_products_controller_test.rb index 78a6ab1..7a524ff 100644 --- a/test/functional/manage_products_controller_test.rb +++ b/test/functional/manage_products_controller_test.rb @@ -5,8 +5,7 @@ class ManageProductsControllerTest < ActionController::TestCase all_fixtures def setup @controller = ManageProductsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @enterprise = fast_create(Enterprise, :name => 'teste', :identifier => 'test_ent') @user = create_user_with_permission('test_user', 'manage_products', @enterprise) @environment = @enterprise.environment diff --git a/test/functional/map_balloon_controller_test.rb b/test/functional/map_balloon_controller_test.rb index 7001257..64fedf7 100644 --- a/test/functional/map_balloon_controller_test.rb +++ b/test/functional/map_balloon_controller_test.rb @@ -5,8 +5,6 @@ class MapBalloonControllerTest < ActionController::TestCase def setup @controller = MapBalloonController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @profile = create_user('test_profile').person login_as(@profile.identifier) diff --git a/test/functional/maps_controller_test.rb b/test/functional/maps_controller_test.rb index d3abeab..d383fe8 100644 --- a/test/functional/maps_controller_test.rb +++ b/test/functional/maps_controller_test.rb @@ -6,8 +6,6 @@ class MapsControllerTest < ActionController::TestCase def setup @controller = MapsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @profile = create_user('test_profile').person login_as(@profile.identifier) diff --git a/test/functional/memberships_controller_test.rb b/test/functional/memberships_controller_test.rb index 1fddf6b..33bdaad 100644 --- a/test/functional/memberships_controller_test.rb +++ b/test/functional/memberships_controller_test.rb @@ -7,8 +7,6 @@ class MembershipsControllerTest < ActionController::TestCase def setup @controller = MembershipsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @profile = create_user('testuser').person login_as('testuser') diff --git a/test/functional/my_profile_controller_test.rb b/test/functional/my_profile_controller_test.rb index 615eab4..26d31d6 100644 --- a/test/functional/my_profile_controller_test.rb +++ b/test/functional/my_profile_controller_test.rb @@ -13,8 +13,6 @@ class MyProfileControllerTest < ActionController::TestCase all_fixtures def setup @controller = MyProfileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new end def test_should_allow_person diff --git a/test/functional/organizations_controller_test.rb b/test/functional/organizations_controller_test.rb index dc8f4fa..50f7e5f 100644 --- a/test/functional/organizations_controller_test.rb +++ b/test/functional/organizations_controller_test.rb @@ -5,8 +5,6 @@ class OrganizationsControllerTest < ActionController::TestCase def setup @controller = OrganizationsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @environment = Environment.default diff --git a/test/functional/plugins_controller_test.rb b/test/functional/plugins_controller_test.rb index d49e3c9..795fe8b 100644 --- a/test/functional/plugins_controller_test.rb +++ b/test/functional/plugins_controller_test.rb @@ -6,8 +6,7 @@ class PluginsControllerTest < ActionController::TestCase all_fixtures def setup @controller = PluginsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @environment = Environment.default login_as(create_admin_user(@environment)) end diff --git a/test/functional/profile_design_controller_test.rb b/test/functional/profile_design_controller_test.rb index 1015844..38ece4d 100644 --- a/test/functional/profile_design_controller_test.rb +++ b/test/functional/profile_design_controller_test.rb @@ -13,8 +13,6 @@ class ProfileDesignControllerTest < ActionController::TestCase attr_reader :holder def setup @controller = ProfileDesignController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @profile = @holder = create_user('designtestuser').person holder.save! diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index 0602082..d217adb 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -6,8 +6,7 @@ class ProfileEditorControllerTest < ActionController::TestCase def setup @controller = ProfileEditorController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @profile = create_user('default_user').person Environment.default.affiliate(@profile, [Environment::Roles.admin(Environment.default.id)] + Profile::Roles.all_roles(Environment.default.id)) login_as('default_user') @@ -657,9 +656,10 @@ class ProfileEditorControllerTest < ActionController::TestCase profile.domains << Domain.new(:name => 'myowndomain.net') profile.environment.domains << Domain.new(:name => 'myenv.net') - ActionController::TestRequest.any_instance.stubs(:host).returns(profile.hostname) + @request.env['HTTP_HOST'] = profile.hostname get :edit, :profile => profile.identifier + assert_tag :tag => 'select', :attributes => { :name => 'profile_data[preferred_domain_id]' }, :descendant => { :tag => "option", :content => 'myowndomain.net' } assert_tag :tag => 'select', :attributes => { :name => 'profile_data[preferred_domain_id]' }, :descendant => { :tag => "option", :content => 'myenv.net' } @@ -673,9 +673,10 @@ class ProfileEditorControllerTest < ActionController::TestCase profile.domains << Domain.new(:name => 'myowndomain.net') profile.environment.domains << Domain.new(:name => 'myenv.net') - ActionController::TestRequest.any_instance.stubs(:host).returns(profile.hostname) + @request.env['HTTP_HOST'] = profile.hostname get :edit, :profile => profile.identifier + assert_tag :tag => "select", :attributes => { :name => 'profile_data[preferred_domain_id]'}, :descendant => { :tag => 'option', :content => '<Select domain>', :attributes => { :value => '' } } post :edit, :profile => profile.identifier, :profile_data => { :preferred_domain_id => '' } @@ -1126,8 +1127,10 @@ class ProfileEditorControllerTest < ActionController::TestCase should 'not redirect if the profile_hostname is the same as environment hostname' do Person.any_instance.stubs(:hostname).returns('hostname.org') Environment.any_instance.stubs(:default_hostname).returns('hostname.org') - ActionController::TestRequest.any_instance.stubs(:host).returns('hostname.org') + + @request.env['HTTP_HOST'] = 'hostname.org' get :index, :profile => profile.identifier + assert_response :success end diff --git a/test/functional/profile_members_controller_test.rb b/test/functional/profile_members_controller_test.rb index 67d5158..8795e19 100644 --- a/test/functional/profile_members_controller_test.rb +++ b/test/functional/profile_members_controller_test.rb @@ -5,8 +5,6 @@ class ProfileMembersControllerTest < ActionController::TestCase def setup super @controller = ProfileMembersController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new end should 'not access index if dont have permission' do diff --git a/test/functional/profile_roles_controller_test.rb b/test/functional/profile_roles_controller_test.rb index a9f3452..03a8720 100644 --- a/test/functional/profile_roles_controller_test.rb +++ b/test/functional/profile_roles_controller_test.rb @@ -5,8 +5,7 @@ class ProfileRolesControllerTest < ActionController::TestCase def setup @controller = ProfileRolesController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @role = Role.first end diff --git a/test/functional/profile_search_controller_test.rb b/test/functional/profile_search_controller_test.rb index 358e240..c9c219c 100644 --- a/test/functional/profile_search_controller_test.rb +++ b/test/functional/profile_search_controller_test.rb @@ -4,8 +4,6 @@ require 'profile_search_controller' class ProfileSearchControllerTest < ActionController::TestCase def setup @controller = ProfileSearchController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @person = fast_create(Person) end diff --git a/test/functional/profile_themes_controller_test.rb b/test/functional/profile_themes_controller_test.rb index 5c52361..2be846b 100644 --- a/test/functional/profile_themes_controller_test.rb +++ b/test/functional/profile_themes_controller_test.rb @@ -4,8 +4,6 @@ class ProfileThemesControllerTest < ActionController::TestCase def setup @controller = ProfileThemesController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new Theme.stubs(:user_themes_dir).returns(TMP_THEMES_DIR) diff --git a/test/functional/region_validators_controller_test.rb b/test/functional/region_validators_controller_test.rb index bd7ea8f..8d5a196 100644 --- a/test/functional/region_validators_controller_test.rb +++ b/test/functional/region_validators_controller_test.rb @@ -5,8 +5,7 @@ class RegionValidatorsControllerTest < ActionController::TestCase all_fixtures def setup @controller = RegionValidatorsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + login_as('ze') end diff --git a/test/functional/role_controller_test.rb b/test/functional/role_controller_test.rb index 0c77394..e3c84e0 100644 --- a/test/functional/role_controller_test.rb +++ b/test/functional/role_controller_test.rb @@ -6,8 +6,7 @@ class RoleControllerTest < ActionController::TestCase def setup @controller = RoleController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @role = Role.first login_as(:ze) end diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index 92b7d61..604ba1a 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -6,9 +6,6 @@ class SearchControllerTest < ActionController::TestCase def setup @controller = SearchController.new - @request = ActionController::TestRequest.new - @request.stubs(:ssl?).returns(false) - @response = ActionController::TestResponse.new @environment = Environment.default @category = Category.create!(:name => 'my-category', :environment => @environment) diff --git a/test/functional/system_controller_test.rb b/test/functional/system_controller_test.rb index b3ba8ea..ff67c95 100644 --- a/test/functional/system_controller_test.rb +++ b/test/functional/system_controller_test.rb @@ -4,8 +4,6 @@ require 'system_controller' class SystemControllerTest < ActionController::TestCase def setup @controller = SystemController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new end # Replace this with your real tests. diff --git a/test/functional/tasks_controller_test.rb b/test/functional/tasks_controller_test.rb index 8137ce6..70e9bd3 100644 --- a/test/functional/tasks_controller_test.rb +++ b/test/functional/tasks_controller_test.rb @@ -6,8 +6,6 @@ class TasksControllerTest < ActionController::TestCase self.default_params = {profile: 'testuser'} def setup @controller = TasksController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new self.profile = create_user('testuser').person @controller.stubs(:profile).returns(profile) diff --git a/test/functional/templates_controller_test.rb b/test/functional/templates_controller_test.rb index ec765c8..6c20afb 100644 --- a/test/functional/templates_controller_test.rb +++ b/test/functional/templates_controller_test.rb @@ -5,8 +5,6 @@ class TemplatesControllerTest < ActionController::TestCase def setup @controller = TemplatesController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @environment = Environment.default login_as(create_admin_user(@environment)) diff --git a/test/functional/trusted_sites_controller_test.rb b/test/functional/trusted_sites_controller_test.rb index 3ff191e..332b28c 100644 --- a/test/functional/trusted_sites_controller_test.rb +++ b/test/functional/trusted_sites_controller_test.rb @@ -6,8 +6,7 @@ class TrustedSitesControllerTest < ActionController::TestCase def setup @controller = TrustedSitesController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + @role = Role.first @environment = Environment.default @environment.trusted_sites_for_iframe = ['existing.site.com'] diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index 1a180f5..254c552 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -5,8 +5,6 @@ class UsersControllerTest < ActionController::TestCase def setup @controller = UsersController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @environment = Environment.default diff --git a/vendor/plugins/access_control/test/permission_check_test.rb b/vendor/plugins/access_control/test/permission_check_test.rb index 9cb43d5..e6b9e74 100644 --- a/vendor/plugins/access_control/test/permission_check_test.rb +++ b/vendor/plugins/access_control/test/permission_check_test.rb @@ -4,8 +4,6 @@ class PermissionCheckTest < ActionController::TestCase def setup @controller = AccessControlTestController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new end def test_access_denied diff --git a/vendor/plugins/action_tracker/test/action_tracker_test.rb b/vendor/plugins/action_tracker/test/action_tracker_test.rb index f5738e5..002eee5 100644 --- a/vendor/plugins/action_tracker/test/action_tracker_test.rb +++ b/vendor/plugins/action_tracker/test/action_tracker_test.rb @@ -54,12 +54,11 @@ ActionController::Routing::Routes.draw { |map| map.resources :things, :collectio class ActionTrackerTest < ActiveSupport::TestCase def setup + @controller = ThingsController.new + ActionTrackerConfig.current_user = proc{ SomeModel.first || SomeModel.create! } ActionTracker::Record.delete_all ActionTrackerConfig.verbs = { :some_verb => { :description => "Did something" } } - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - @controller = ThingsController.new end def test_index -- libgit2 0.21.2