Commit fceeac682c863b5c387900b325dc414a3e17d343

Authored by Braulio Bhavamitra
1 parent 76e29aed

tests: Remove unecessary test request/response

Showing 89 changed files with 51 additions and 189 deletions   Show diff stats
plugins/admin_notifications/test/functional/account_controller_test.rb
@@ -8,8 +8,7 @@ end @@ -8,8 +8,7 @@ end
8 class AccountControllerTest < ActionController::TestCase 8 class AccountControllerTest < ActionController::TestCase
9 def setup 9 def setup
10 @controller = AccountController.new 10 @controller = AccountController.new
11 - @request = ActionController::TestRequest.new  
12 - @response = ActionController::TestResponse.new 11 +
13 @person = create_user('person').person 12 @person = create_user('person').person
14 13
15 @environment = Environment.default 14 @environment = Environment.default
plugins/admin_notifications/test/functional/admin_notifications_plugin_admin_controller_test.rb
@@ -4,8 +4,6 @@ require_relative &#39;../../controllers/admin_notifications_plugin_admin_controller&#39; @@ -4,8 +4,6 @@ require_relative &#39;../../controllers/admin_notifications_plugin_admin_controller&#39;
4 class AdminNotificationsPluginAdminControllerTest < ActionController::TestCase 4 class AdminNotificationsPluginAdminControllerTest < ActionController::TestCase
5 def setup 5 def setup
6 @controller = AdminNotificationsPluginAdminController.new 6 @controller = AdminNotificationsPluginAdminController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new  
9 @person = create_user('person').person 7 @person = create_user('person').person
10 8
11 @environment = Environment.default 9 @environment = Environment.default
plugins/admin_notifications/test/functional/admin_notifications_plugin_myprofile_controller_test.rb
@@ -7,8 +7,6 @@ require( @@ -7,8 +7,6 @@ require(
7 class AdminNotificationsPluginMyprofileControllerTest < ActionController::TestCase 7 class AdminNotificationsPluginMyprofileControllerTest < ActionController::TestCase
8 def setup 8 def setup
9 @controller = AdminNotificationsPluginMyprofileController.new 9 @controller = AdminNotificationsPluginMyprofileController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new  
12 @person = create_user('person').person 10 @person = create_user('person').person
13 @community = fast_create(Community) 11 @community = fast_create(Community)
14 12
plugins/admin_notifications/test/functional/admin_notifications_plugin_public_controller_test.rb
@@ -7,8 +7,6 @@ require( @@ -7,8 +7,6 @@ require(
7 class AdminNotificationsPluginPublicControllerTest < ActionController::TestCase 7 class AdminNotificationsPluginPublicControllerTest < ActionController::TestCase
8 def setup 8 def setup
9 @controller = AdminNotificationsPluginPublicController.new 9 @controller = AdminNotificationsPluginPublicController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new  
12 @person = create_user('person').person 10 @person = create_user('person').person
13 11
14 @environment = Environment.default 12 @environment = Environment.default
plugins/admin_notifications/test/functional/home_controller_test.rb
@@ -7,8 +7,7 @@ end @@ -7,8 +7,7 @@ end
7 class HomeControllerTest < ActionController::TestCase 7 class HomeControllerTest < ActionController::TestCase
8 def setup 8 def setup
9 @controller = HomeController.new 9 @controller = HomeController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new 10 +
12 @person = create_user('person').person 11 @person = create_user('person').person
13 12
14 @environment = Environment.default 13 @environment = Environment.default
plugins/analytics/test/functional/content_viewer_controller_test.rb
@@ -5,8 +5,6 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = ContentViewerController.new 7 @controller = ContentViewerController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 8
11 @environment = Environment.default 9 @environment = Environment.default
12 @environment.enabled_plugins += ['AnalyticsPlugin'] 10 @environment.enabled_plugins += ['AnalyticsPlugin']
plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb
@@ -5,8 +5,6 @@ class CommentGroupPluginProfileControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class CommentGroupPluginProfileControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = CommentGroupPluginProfileController.new 7 @controller = CommentGroupPluginProfileController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 8
11 @profile = create_user('testuser').person 9 @profile = create_user('testuser').person
12 @article = profile.articles.build(:name => 'test') 10 @article = profile.articles.build(:name => 'test')
plugins/comment_group/test/functional/comment_group_plugin_public_controller_test.rb
@@ -5,8 +5,6 @@ class CommentGroupPluginPublicControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class CommentGroupPluginPublicControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = CommentGroupPluginPublicController.new 7 @controller = CommentGroupPluginPublicController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 8
11 @profile = create_user('testuser').person 9 @profile = create_user('testuser').person
12 @article = profile.articles.build(:name => 'test') 10 @article = profile.articles.build(:name => 'test')
plugins/custom_forms/test/functional/custom_forms_plugin_myprofile_controller_test.rb
@@ -4,8 +4,7 @@ require_relative &#39;../../controllers/custom_forms_plugin_myprofile_controller&#39; @@ -4,8 +4,7 @@ require_relative &#39;../../controllers/custom_forms_plugin_myprofile_controller&#39;
4 class CustomFormsPluginMyprofileControllerTest < ActionController::TestCase 4 class CustomFormsPluginMyprofileControllerTest < ActionController::TestCase
5 def setup 5 def setup
6 @controller = CustomFormsPluginMyprofileController.new 6 @controller = CustomFormsPluginMyprofileController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new 7 +
9 @profile = create_user('profile').person 8 @profile = create_user('profile').person
10 login_as(@profile.identifier) 9 login_as(@profile.identifier)
11 environment = Environment.default 10 environment = Environment.default
plugins/custom_forms/test/functional/custom_forms_plugin_profile_controller_test.rb
@@ -4,8 +4,7 @@ require_relative &#39;../../controllers/custom_forms_plugin_profile_controller&#39; @@ -4,8 +4,7 @@ require_relative &#39;../../controllers/custom_forms_plugin_profile_controller&#39;
4 class CustomFormsPluginProfileControllerTest < ActionController::TestCase 4 class CustomFormsPluginProfileControllerTest < ActionController::TestCase
5 def setup 5 def setup
6 @controller = CustomFormsPluginProfileController.new 6 @controller = CustomFormsPluginProfileController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new 7 +
9 @profile = create_user('profile').person 8 @profile = create_user('profile').person
10 login_as(@profile.identifier) 9 login_as(@profile.identifier)
11 environment = Environment.default 10 environment = Environment.default
plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb
@@ -5,8 +5,6 @@ class DisplayContentPluginAdminControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class DisplayContentPluginAdminControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = DisplayContentPluginAdminController.new 7 @controller = DisplayContentPluginAdminController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 8
11 @environment = Environment.default 9 @environment = Environment.default
12 user_login = create_admin_user(@environment) 10 user_login = create_admin_user(@environment)
plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb
@@ -5,8 +5,6 @@ class DisplayContentPluginMyprofileControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class DisplayContentPluginMyprofileControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = DisplayContentPluginMyprofileController.new 7 @controller = DisplayContentPluginMyprofileController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 8
11 user = create_user('testinguser') 9 user = create_user('testinguser')
12 login_as(user.login) 10 login_as(user.login)
plugins/driven_signup/test/integration/account_controller_test.rb
@@ -7,8 +7,7 @@ class AccountControllerTest &lt; ActionDispatch::IntegrationTest @@ -7,8 +7,7 @@ class AccountControllerTest &lt; ActionDispatch::IntegrationTest
7 7
8 def setup 8 def setup
9 @controller = AccountController.new 9 @controller = AccountController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new 10 + @request = ActionController::TestRequest.new
12 11
13 e = Environment.default 12 e = Environment.default
14 e.enable 'skip_new_user_email_confirmation', true 13 e.enable 'skip_new_user_email_confirmation', true
plugins/google_analytics/test/functional/profile_editor_controller_test.rb
@@ -5,8 +5,7 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase @@ -5,8 +5,7 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = ProfileEditorController.new 7 @controller = ProfileEditorController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new 8 +
10 @profile = create_user('default_user').person 9 @profile = create_user('default_user').person
11 login_as(@profile.identifier) 10 login_as(@profile.identifier)
12 Environment.default.enable_plugin(GoogleAnalyticsPlugin.name) 11 Environment.default.enable_plugin(GoogleAnalyticsPlugin.name)
plugins/google_cse/test/functional/google_cse_plugin_controller_test.rb
@@ -5,8 +5,6 @@ class GoogleCsePluginControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class GoogleCsePluginControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = GoogleCsePluginController.new 7 @controller = GoogleCsePluginController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 end 8 end
11 9
12 should 'get results page' do 10 should 'get results page' do
plugins/html5_video/test/functional/content_viewer_controler_test.rb
@@ -7,8 +7,6 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -7,8 +7,6 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
7 7
8 def setup 8 def setup
9 @controller = ContentViewerController.new 9 @controller = ContentViewerController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new  
12 10
13 @profile = create_user('testinguser').person 11 @profile = create_user('testinguser').person
14 @environment = @profile.environment 12 @environment = @profile.environment
plugins/ldap/test/functional/account_controller_plugin_test.rb
@@ -4,8 +4,6 @@ class AccountControllerPluginTest &lt; ActionController::TestCase @@ -4,8 +4,6 @@ class AccountControllerPluginTest &lt; ActionController::TestCase
4 4
5 def setup 5 def setup
6 @controller = AccountController.new 6 @controller = AccountController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new  
9 7
10 @environment = Environment.default 8 @environment = Environment.default
11 @environment.enabled_plugins = ['LdapPlugin'] 9 @environment.enabled_plugins = ['LdapPlugin']
plugins/mark_comment_as_read/test/functional/mark_comment_as_read_plugin_profile_controller_test.rb
@@ -4,8 +4,7 @@ require_relative &#39;../../controllers/mark_comment_as_read_plugin_profile_controll @@ -4,8 +4,7 @@ require_relative &#39;../../controllers/mark_comment_as_read_plugin_profile_controll
4 class MarkCommentAsReadPluginProfileControllerTest < ActionController::TestCase 4 class MarkCommentAsReadPluginProfileControllerTest < ActionController::TestCase
5 def setup 5 def setup
6 @controller = MarkCommentAsReadPluginProfileController.new 6 @controller = MarkCommentAsReadPluginProfileController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new 7 +
9 @profile = create_user('profile').person 8 @profile = create_user('profile').person
10 @article = TinyMceArticle.create!(:profile => @profile, :name => 'An article') 9 @article = TinyMceArticle.create!(:profile => @profile, :name => 'An article')
11 @comment = Comment.new(:source => @article, :author => @profile, :body => 'test') 10 @comment = Comment.new(:source => @article, :author => @profile, :body => 'test')
plugins/metadata/test/functional/content_viewer_controller_test.rb
@@ -6,8 +6,6 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -6,8 +6,6 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
6 6
7 def setup 7 def setup
8 @controller = ContentViewerController.new 8 @controller = ContentViewerController.new
9 - @request = ActionController::TestRequest.new  
10 - @response = ActionController::TestResponse.new  
11 9
12 @profile = create_user('testinguser').person 10 @profile = create_user('testinguser').person
13 @environment = @profile.environment 11 @environment = @profile.environment
plugins/metadata/test/functional/home_controller_test.rb
@@ -5,8 +5,6 @@ class HomeControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class HomeControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = HomeController.new 7 @controller = HomeController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 8
11 @environment = Environment.default 9 @environment = Environment.default
12 @environment.enabled_plugins += ['MetadataPlugin'] 10 @environment.enabled_plugins += ['MetadataPlugin']
plugins/metadata/test/functional/products_plugin/page_controller_test.rb
@@ -6,8 +6,6 @@ if defined? ProductsPlugin @@ -6,8 +6,6 @@ if defined? ProductsPlugin
6 6
7 def setup 7 def setup
8 @controller = PageController.new 8 @controller = PageController.new
9 - @request = ActionController::TestRequest.new  
10 - @response = ActionController::TestResponse.new  
11 @enterprise = fast_create(Enterprise, name: 'test', identifier: 'test_ent') 9 @enterprise = fast_create(Enterprise, name: 'test', identifier: 'test_ent')
12 @user = create_user_with_permission('test_user', 'manage_products', @enterprise) 10 @user = create_user_with_permission('test_user', 'manage_products', @enterprise)
13 login_as :test_user 11 login_as :test_user
plugins/newsletter/test/functional/newsletter_plugin_admin_controller_test.rb
@@ -4,8 +4,6 @@ class NewsletterPluginAdminControllerTest &lt; ActionController::TestCase @@ -4,8 +4,6 @@ class NewsletterPluginAdminControllerTest &lt; ActionController::TestCase
4 4
5 def setup 5 def setup
6 @controller = NewsletterPluginAdminController.new 6 @controller = NewsletterPluginAdminController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new  
9 7
10 @admin = create_user('admin_newsletter').person 8 @admin = create_user('admin_newsletter').person
11 @environment = @admin.environment 9 @environment = @admin.environment
plugins/newsletter/test/functional/newsletter_plugin_controller_test.rb
@@ -4,8 +4,7 @@ class NewsletterPluginControllerTest &lt; ActionController::TestCase @@ -4,8 +4,7 @@ class NewsletterPluginControllerTest &lt; ActionController::TestCase
4 4
5 def setup 5 def setup
6 @controller = NewsletterPluginController.new 6 @controller = NewsletterPluginController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new 7 +
9 environment = fast_create(Environment) 8 environment = fast_create(Environment)
10 environment.enable_plugin(NewsletterPlugin) 9 environment.enable_plugin(NewsletterPlugin)
11 @controller.stubs(:environment).returns(environment) 10 @controller.stubs(:environment).returns(environment)
plugins/open_graph/test/functional/open_graph_graph/my_profile_controller_test.rb
@@ -8,8 +8,7 @@ class OpenGraphPlugin::MyprofileControllerTest &lt; ActionController::TestCase @@ -8,8 +8,7 @@ class OpenGraphPlugin::MyprofileControllerTest &lt; ActionController::TestCase
8 8
9 def setup 9 def setup
10 @controller = OpenGraphPlugin::MyprofileController.new 10 @controller = OpenGraphPlugin::MyprofileController.new
11 - @request = ActionController::TestRequest.new  
12 - @response = ActionController::TestResponse.new 11 +
13 @actor = create_user.person 12 @actor = create_user.person
14 end 13 end
15 14
plugins/organization_ratings/test/functional/organization_ratings_plugin_admin_controller_test.rb
@@ -8,8 +8,6 @@ class OrganizationRatingsPluginAdminControllerTest &lt; ActionController::TestCase @@ -8,8 +8,6 @@ class OrganizationRatingsPluginAdminControllerTest &lt; ActionController::TestCase
8 8
9 def setup 9 def setup
10 @controller = OrganizationRatingsPluginAdminController.new 10 @controller = OrganizationRatingsPluginAdminController.new
11 - @request = ActionController::TestRequest.new  
12 - @response = ActionController::TestResponse.new  
13 11
14 @environment = Environment.default 12 @environment = Environment.default
15 @environment.enabled_plugins = ['OrganizationRatingsPlugin'] 13 @environment.enabled_plugins = ['OrganizationRatingsPlugin']
plugins/organization_ratings/test/functional/organization_ratings_plugin_profile_controller_test.rb
@@ -8,8 +8,6 @@ class OrganizationRatingsPluginProfileControllerTest &lt; ActionController::TestCas @@ -8,8 +8,6 @@ class OrganizationRatingsPluginProfileControllerTest &lt; ActionController::TestCas
8 8
9 def setup 9 def setup
10 @controller = OrganizationRatingsPluginProfileController.new 10 @controller = OrganizationRatingsPluginProfileController.new
11 - @request = ActionController::TestRequest.new  
12 - @response = ActionController::TestResponse.new  
13 11
14 @environment = Environment.default 12 @environment = Environment.default
15 @environment.enabled_plugins = ['OrganizationRatingsPlugin'] 13 @environment.enabled_plugins = ['OrganizationRatingsPlugin']
plugins/people_block/test/functional/people_block_plugin_environment_design_controller_test.rb
@@ -4,8 +4,7 @@ class EnvironmentDesignControllerTest &lt; ActionController::TestCase @@ -4,8 +4,7 @@ class EnvironmentDesignControllerTest &lt; ActionController::TestCase
4 4
5 def setup 5 def setup
6 @controller = EnvironmentDesignController.new 6 @controller = EnvironmentDesignController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new 7 +
9 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([PeopleBlockPlugin.new]) 8 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([PeopleBlockPlugin.new])
10 end 9 end
11 10
plugins/people_block/test/functional/people_block_plugin_profile_design_controller_test.rb
@@ -4,8 +4,7 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase @@ -4,8 +4,7 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase
4 4
5 def setup 5 def setup
6 @controller = ProfileDesignController.new 6 @controller = ProfileDesignController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new 7 +
9 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([PeopleBlockPlugin.new]) 8 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([PeopleBlockPlugin.new])
10 end 9 end
11 10
plugins/people_block/test/functional/profile_controller_test.rb
@@ -4,8 +4,7 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -4,8 +4,7 @@ class ProfileControllerTest &lt; ActionController::TestCase
4 4
5 def setup 5 def setup
6 @controller = ProfileController.new 6 @controller = ProfileController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new 7 +
9 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([PeopleBlockPlugin.new]) 8 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([PeopleBlockPlugin.new])
10 end 9 end
11 10
plugins/relevant_content/test/unit/article.rb
@@ -8,8 +8,7 @@ class RelevantContentBlockTest &lt; ActiveSupport::TestCase @@ -8,8 +8,7 @@ class RelevantContentBlockTest &lt; ActiveSupport::TestCase
8 8
9 def setup 9 def setup
10 @controller = CommentController.new 10 @controller = CommentController.new
11 - @request = ActionController::TestRequest.new  
12 - @response = ActionController::TestResponse.new 11 +
13 @profile = create_user('testinguser').person 12 @profile = create_user('testinguser').person
14 @environment = @profile.environment 13 @environment = @profile.environment
15 end 14 end
plugins/relevant_content/test/unit/relevant_content_block_test.rb
@@ -9,8 +9,6 @@ class RelevantContentBlockTest &lt; ActiveSupport::TestCase @@ -9,8 +9,6 @@ class RelevantContentBlockTest &lt; ActiveSupport::TestCase
9 9
10 def setup 10 def setup
11 @controller = CommentController.new 11 @controller = CommentController.new
12 - @request = ActionController::TestRequest.new  
13 - @response = ActionController::TestResponse.new  
14 12
15 @profile = create_user('testinguser').person 13 @profile = create_user('testinguser').person
16 @environment = @profile.environment 14 @environment = @profile.environment
plugins/remote_user/test/functional/remote_user_plugin_test.rb
@@ -2,6 +2,8 @@ require &#39;test_helper&#39; @@ -2,6 +2,8 @@ require &#39;test_helper&#39;
2 2
3 class AccountControllerTest < ActionController::TestCase 3 class AccountControllerTest < ActionController::TestCase
4 def setup 4 def setup
  5 + @controller = AccountController.new
  6 +
5 @environment = Environment.default 7 @environment = Environment.default
6 @environment.enabled_plugins = ['RemoteUserPlugin'] 8 @environment.enabled_plugins = ['RemoteUserPlugin']
7 @environment.save 9 @environment.save
@@ -9,10 +11,6 @@ class AccountControllerTest &lt; ActionController::TestCase @@ -9,10 +11,6 @@ class AccountControllerTest &lt; ActionController::TestCase
9 @another_environment = Environment.new(name: "AnotherEnvironment") 11 @another_environment = Environment.new(name: "AnotherEnvironment")
10 @another_environment.enabled_plugins = ['RemoteUserPlugin'] 12 @another_environment.enabled_plugins = ['RemoteUserPlugin']
11 @another_environment.save 13 @another_environment.save
12 -  
13 - @controller = AccountController.new  
14 - @request = ActionController::TestRequest.new  
15 - @response = ActionController::TestResponse.new  
16 end 14 end
17 15
18 should 'not authenticate user if there is no remote user' do 16 should 'not authenticate user if there is no remote user' do
plugins/shopping_cart/test/functional/shopping_cart_plugin_controller_test.rb
@@ -5,8 +5,7 @@ class ShoppingCartPluginControllerTest &lt; ActionController::TestCase @@ -5,8 +5,7 @@ class ShoppingCartPluginControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = ShoppingCartPluginController.new 7 @controller = ShoppingCartPluginController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new 8 +
10 @profile = fast_create(Enterprise) 9 @profile = fast_create(Enterprise)
11 @profile.contact_email = 'enterprise@noosfero.org';@profile.save 10 @profile.contact_email = 'enterprise@noosfero.org';@profile.save
12 @product = fast_create(Product, profile_id: @profile.id) 11 @product = fast_create(Product, profile_id: @profile.id)
plugins/social_share_privacy/test/functional/content_viewer_controller_test.rb
@@ -5,8 +5,6 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = ContentViewerController.new 7 @controller = ContentViewerController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 8
11 @profile = create_user('testinguser').person 9 @profile = create_user('testinguser').person
12 @environment = @profile.environment 10 @environment = @profile.environment
plugins/solr/test/functional/search_controller_test.rb
@@ -4,14 +4,12 @@ require_relative &#39;../../lib/ext/facets_browse&#39; @@ -4,14 +4,12 @@ require_relative &#39;../../lib/ext/facets_browse&#39;
4 class SearchControllerTest < ActionController::TestCase 4 class SearchControllerTest < ActionController::TestCase
5 5
6 def setup 6 def setup
  7 + @controller = SearchController.new
  8 +
7 TestSolr.enable 9 TestSolr.enable
8 p1 = File.join(RAILS_ROOT, 'app', 'views') 10 p1 = File.join(RAILS_ROOT, 'app', 'views')
9 p2 = File.join(File.dirname(__FILE__) + '/../../views') 11 p2 = File.join(File.dirname(__FILE__) + '/../../views')
10 SearchController.append_view_path([p1,p2]) 12 SearchController.append_view_path([p1,p2])
11 - @controller = SearchController.new  
12 - @request = ActionController::TestRequest.new  
13 - @request.stubs(:ssl?).returns(false)  
14 - @response = ActionController::TestResponse.new  
15 13
16 @category = Category.create!(:name => 'my category', :environment => Environment.default) 14 @category = Category.create!(:name => 'my category', :environment => Environment.default)
17 15
plugins/spaminator/test/functional/spaminator_plugin_admin_controller_test.rb
@@ -4,8 +4,7 @@ require_relative &#39;../../controllers/spaminator_plugin_admin_controller&#39; @@ -4,8 +4,7 @@ require_relative &#39;../../controllers/spaminator_plugin_admin_controller&#39;
4 class SpaminatorPluginAdminControllerTest < ActionController::TestCase 4 class SpaminatorPluginAdminControllerTest < ActionController::TestCase
5 def setup 5 def setup
6 @controller = SpaminatorPluginAdminController.new 6 @controller = SpaminatorPluginAdminController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new 7 +
9 @environment = Environment.default 8 @environment = Environment.default
10 @settings = Noosfero::Plugin::Settings.new(@environment, SpaminatorPlugin) 9 @settings = Noosfero::Plugin::Settings.new(@environment, SpaminatorPlugin)
11 login_as(create_admin_user(@environment)) 10 login_as(create_admin_user(@environment))
plugins/stoa/test/functional/account_controller_test.rb
@@ -19,8 +19,6 @@ class AccountControllerTest &lt; ActionController::TestCase @@ -19,8 +19,6 @@ class AccountControllerTest &lt; ActionController::TestCase
19 19
20 def setup 20 def setup
21 @controller = AccountController.new 21 @controller = AccountController.new
22 - @request = ActionController::TestRequest.new  
23 - @response = ActionController::TestResponse.new  
24 StoaPlugin::UspUser.create!({:codpes => 12345678, :cpf => Digest::MD5.hexdigest(SALT+'12345678'), :birth_date => '1970-01-30'}, :without_protection => true) 22 StoaPlugin::UspUser.create!({:codpes => 12345678, :cpf => Digest::MD5.hexdigest(SALT+'12345678'), :birth_date => '1970-01-30'}, :without_protection => true)
25 Environment.default.enable_plugin(StoaPlugin.name) 23 Environment.default.enable_plugin(StoaPlugin.name)
26 @user = create_user('joao-stoa', {:password => 'pass', :password_confirmation => 'pass'},:usp_id=>'87654321') 24 @user = create_user('joao-stoa', {:password => 'pass', :password_confirmation => 'pass'},:usp_id=>'87654321')
plugins/stoa/test/functional/invite_controller_test.rb
@@ -5,8 +5,7 @@ class InviteControllerTest &lt; ActionController::TestCase @@ -5,8 +5,7 @@ class InviteControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = InviteController.new 7 @controller = InviteController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new 8 +
10 environment = Environment.default 9 environment = Environment.default
11 environment.enabled_plugins = ['StoaPlugin'] 10 environment.enabled_plugins = ['StoaPlugin']
12 environment.save! 11 environment.save!
plugins/stoa/test/functional/profile_editor_controller_test.rb
@@ -7,8 +7,7 @@ class StoaPluginProfileEditorControllerTest &lt; ActionController::TestCase @@ -7,8 +7,7 @@ class StoaPluginProfileEditorControllerTest &lt; ActionController::TestCase
7 7
8 def setup 8 def setup
9 @controller = ProfileEditorController.new 9 @controller = ProfileEditorController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new 10 +
12 @person = User.create(:login => 'test_user', :email => 'test_user@example.com', :password => 'test', :password_confirmation => 'test').person 11 @person = User.create(:login => 'test_user', :email => 'test_user@example.com', :password => 'test', :password_confirmation => 'test').person
13 login_as(@person.identifier) 12 login_as(@person.identifier)
14 Environment.default.enable_plugin(StoaPlugin.name) 13 Environment.default.enable_plugin(StoaPlugin.name)
plugins/stoa/test/functional/stoa_plugin_controller_test.rb
@@ -7,8 +7,6 @@ class StoaPluginControllerTest &lt; ActionController::TestCase @@ -7,8 +7,6 @@ class StoaPluginControllerTest &lt; ActionController::TestCase
7 7
8 def setup 8 def setup
9 @controller = StoaPluginController.new 9 @controller = StoaPluginController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new  
12 ApplicationRecord.configurations['stoa'] = {:adapter => 'sqlite3', :database => ':memory:', :verbosity => 'quiet'} 10 ApplicationRecord.configurations['stoa'] = {:adapter => 'sqlite3', :database => ':memory:', :verbosity => 'quiet'}
13 env = Environment.default 11 env = Environment.default
14 env.enable_plugin(StoaPlugin.name) 12 env.enable_plugin(StoaPlugin.name)
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 @@ -7,8 +7,7 @@ class SubOrganizationsPluginMyprofileController; def rescue_action(e) raise e en
7 class SubOrganizationsPluginMyprofileControllerTest < ActionController::TestCase 7 class SubOrganizationsPluginMyprofileControllerTest < ActionController::TestCase
8 def setup 8 def setup
9 @controller = SubOrganizationsPluginMyprofileController.new 9 @controller = SubOrganizationsPluginMyprofileController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new 10 +
12 @organization = Organization.create!(:name => 'My Organization', :identifier => 'my-organization') 11 @organization = Organization.create!(:name => 'My Organization', :identifier => 'my-organization')
13 @person = create_user('person').person 12 @person = create_user('person').person
14 @organization.add_admin(@person) 13 @organization.add_admin(@person)
plugins/sub_organizations/test/functional/sub_organizations_plugin_profile_controller_test.rb
@@ -8,8 +8,7 @@ class SubOrganizationsPluginProfileControllerTest &lt; ActionController::TestCase @@ -8,8 +8,7 @@ class SubOrganizationsPluginProfileControllerTest &lt; ActionController::TestCase
8 8
9 def setup 9 def setup
10 @controller = SubOrganizationsPluginProfileController.new 10 @controller = SubOrganizationsPluginProfileController.new
11 - @request = ActionController::TestRequest.new  
12 - @response = ActionController::TestResponse.new 11 +
13 @organization = Organization.create!(:name => 'My Organization', :identifier => 'my-organization') 12 @organization = Organization.create!(:name => 'My Organization', :identifier => 'my-organization')
14 @person = create_user('person').person 13 @person = create_user('person').person
15 @organization.add_admin(@person) 14 @organization.add_admin(@person)
plugins/video/test/functional/video_plugin_environment_design_controller_test.rb
@@ -4,8 +4,6 @@ class EnvironmentDesignControllerTest &lt; ActionController::TestCase @@ -4,8 +4,6 @@ class EnvironmentDesignControllerTest &lt; ActionController::TestCase
4 4
5 def setup 5 def setup
6 @controller = EnvironmentDesignController.new 6 @controller = EnvironmentDesignController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new  
9 7
10 Environment.delete_all 8 Environment.delete_all
11 User.delete_all 9 User.delete_all
plugins/video/test/functional/video_plugin_profile_design_controller_test.rb
@@ -4,8 +4,6 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase @@ -4,8 +4,6 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase
4 4
5 def setup 5 def setup
6 @controller = ProfileDesignController.new 6 @controller = ProfileDesignController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new  
9 7
10 user = create_user('testinguser') 8 user = create_user('testinguser')
11 login_as(user.login) 9 login_as(user.login)
plugins/work_assignment/test/functional/cms_controller_test.rb
@@ -5,8 +5,7 @@ class CmsControllerTest &lt; ActionController::TestCase @@ -5,8 +5,7 @@ class CmsControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = CmsController.new 7 @controller = CmsController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new 8 +
10 @person = create_user('test_user').person 9 @person = create_user('test_user').person
11 login_as :test_user 10 login_as :test_user
12 e = Environment.default 11 e = Environment.default
plugins/work_assignment/test/functional/content_viewer_controller_test.rb
@@ -5,8 +5,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -5,8 +5,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = ContentViewerController.new 7 @controller = ContentViewerController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new 8 +
10 @profile = create_user('testinguser').person 9 @profile = create_user('testinguser').person
11 10
12 @organization = fast_create(Organization) 11 @organization = fast_create(Organization)
plugins/work_assignment/test/functional/work_assignment_plugin_myprofile_controller_test.rb
@@ -5,8 +5,7 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase @@ -5,8 +5,7 @@ class WorkAssignmentPluginMyprofileControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = WorkAssignmentPluginMyprofileController.new 7 @controller = WorkAssignmentPluginMyprofileController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new 8 +
10 @person = create_user('test_user').person 9 @person = create_user('test_user').person
11 login_as :test_user 10 login_as :test_user
12 e = Environment.default 11 e = Environment.default
test/api/boxes_test.rb
@@ -5,7 +5,6 @@ class BoxesTest &lt; ActiveSupport::TestCase @@ -5,7 +5,6 @@ class BoxesTest &lt; ActiveSupport::TestCase
5 def setup 5 def setup
6 create_and_activate_user 6 create_and_activate_user
7 login_api 7 login_api
8 -# @request = ActionController::TestRequest.new  
9 end 8 end
10 9
11 kinds= %w[Profile Community Person Enterprise Environment] 10 kinds= %w[Profile Community Person Enterprise Environment]
test/functional/account_controller_test.rb
@@ -11,8 +11,7 @@ class AccountControllerTest &lt; ActionController::TestCase @@ -11,8 +11,7 @@ class AccountControllerTest &lt; ActionController::TestCase
11 11
12 def setup 12 def setup
13 @controller = AccountController.new 13 @controller = AccountController.new
14 - @request = ActionController::TestRequest.new  
15 - @response = ActionController::TestResponse.new 14 +
16 disable_signup_bot_check 15 disable_signup_bot_check
17 end 16 end
18 17
test/functional/admin_panel_controller_test.rb
@@ -6,8 +6,7 @@ class AdminPanelControllerTest &lt; ActionController::TestCase @@ -6,8 +6,7 @@ class AdminPanelControllerTest &lt; ActionController::TestCase
6 all_fixtures 6 all_fixtures
7 def setup 7 def setup
8 @controller = AdminPanelController.new 8 @controller = AdminPanelController.new
9 - @request = ActionController::TestRequest.new  
10 - @response = ActionController::TestResponse.new 9 +
11 login_as(create_admin_user(Environment.default)) 10 login_as(create_admin_user(Environment.default))
12 end 11 end
13 12
test/functional/application_controller_test.rb
@@ -4,10 +4,9 @@ require &#39;test_controller&#39; @@ -4,10 +4,9 @@ require &#39;test_controller&#39;
4 4
5 class ApplicationControllerTest < ActionController::TestCase 5 class ApplicationControllerTest < ActionController::TestCase
6 all_fixtures 6 all_fixtures
  7 +
7 def setup 8 def setup
8 @controller = TestController.new 9 @controller = TestController.new
9 - @request = ActionController::TestRequest.new  
10 - @response = ActionController::TestResponse.new  
11 end 10 end
12 11
13 def test_detection_of_environment_by_host 12 def test_detection_of_environment_by_host
@@ -50,7 +49,7 @@ class ApplicationControllerTest &lt; ActionController::TestCase @@ -50,7 +49,7 @@ class ApplicationControllerTest &lt; ActionController::TestCase
50 current = fast_create(Environment, :name => 'test environment') 49 current = fast_create(Environment, :name => 'test environment')
51 current.domains.create!(:name => 'example.com') 50 current.domains.create!(:name => 'example.com')
52 51
53 - @request.expects(:host).returns('example.com').at_least_once 52 + @request.env['HTTP_HOST'] = 'example.com'
54 get :index 53 get :index
55 54
56 assert_equal current, assigns(:environment) 55 assert_equal current, assigns(:environment)
test/functional/categories_controller_test.rb
@@ -5,8 +5,6 @@ class CategoriesControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class CategoriesControllerTest &lt; ActionController::TestCase
5 all_fixtures 5 all_fixtures
6 def setup 6 def setup
7 @controller = CategoriesController.new 7 @controller = CategoriesController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 8
11 @env = fast_create(Environment, :name => "My test environment") 9 @env = fast_create(Environment, :name => "My test environment")
12 Environment.stubs(:default).returns(env) 10 Environment.stubs(:default).returns(env)
test/functional/comment_controller_test.rb
@@ -5,8 +5,6 @@ class CommentControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class CommentControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = CommentController.new 7 @controller = CommentController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 8
11 @profile = create_user('testinguser').person 9 @profile = create_user('testinguser').person
12 @environment = @profile.environment 10 @environment = @profile.environment
test/functional/contact_controller_test.rb
@@ -8,8 +8,6 @@ class ContactControllerTest &lt; ActionController::TestCase @@ -8,8 +8,6 @@ class ContactControllerTest &lt; ActionController::TestCase
8 8
9 def setup 9 def setup
10 @controller = ContactController.new 10 @controller = ContactController.new
11 - @request = ActionController::TestRequest.new  
12 - @response = ActionController::TestResponse.new  
13 11
14 @profile = create_user('contact_test_user').person 12 @profile = create_user('contact_test_user').person
15 @enterprise = fast_create(Enterprise, :identifier => 'contact_test_enterprise', :name => 'Test contact enteprise') 13 @enterprise = fast_create(Enterprise, :identifier => 'contact_test_enterprise', :name => 'Test contact enteprise')
test/functional/content_viewer_controller_test.rb
@@ -7,8 +7,6 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -7,8 +7,6 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
7 7
8 def setup 8 def setup
9 @controller = ContentViewerController.new 9 @controller = ContentViewerController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new  
12 10
13 @profile = create_user('testinguser').person 11 @profile = create_user('testinguser').person
14 @environment = @profile.environment 12 @environment = @profile.environment
@@ -220,8 +218,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -220,8 +218,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
220 profile.domains << Domain.create!(:name => 'micojones.net') 218 profile.domains << Domain.create!(:name => 'micojones.net')
221 profile.save! 219 profile.save!
222 220
223 - ActionController::TestRequest.any_instance.expects(:host).returns('www.micojones.net').at_least_once  
224 - 221 + @request.env['HTTP_HOST'] = 'www.micojones.net'
225 get :view_page, :page => [] 222 get :view_page, :page => []
226 223
227 assert_equal profile, assigns(:profile) 224 assert_equal profile, assigns(:profile)
test/functional/edit_template_controller_test.rb
@@ -7,8 +7,7 @@ class EditTemplateControllerTest &lt; ActionController::TestCase @@ -7,8 +7,7 @@ class EditTemplateControllerTest &lt; ActionController::TestCase
7 all_fixtures 7 all_fixtures
8 def setup 8 def setup
9 @controller = EditTemplateController.new 9 @controller = EditTemplateController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new 10 +
12 login_as 'ze' 11 login_as 'ze'
13 end 12 end
14 13
test/functional/enterprise_registration_controller_test.rb
@@ -9,8 +9,7 @@ class EnterpriseRegistrationControllerTest &lt; ActionController::TestCase @@ -9,8 +9,7 @@ class EnterpriseRegistrationControllerTest &lt; ActionController::TestCase
9 def setup 9 def setup
10 super 10 super
11 @controller = EnterpriseRegistrationController.new 11 @controller = EnterpriseRegistrationController.new
12 - @request = ActionController::TestRequest.new  
13 - @response = ActionController::TestResponse.new 12 +
14 login_as 'ze' 13 login_as 'ze'
15 end 14 end
16 15
test/functional/enterprise_validation_controller_test.rb
@@ -7,8 +7,6 @@ class EnterpriseValidationControllerTest &lt; ActionController::TestCase @@ -7,8 +7,6 @@ class EnterpriseValidationControllerTest &lt; ActionController::TestCase
7 7
8 def setup 8 def setup
9 @controller = EnterpriseValidationController.new 9 @controller = EnterpriseValidationController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new  
12 10
13 login_as 'ze' 11 login_as 'ze'
14 @user = Profile['ze'] 12 @user = Profile['ze']
test/functional/environment_design_controller_test.rb
@@ -7,8 +7,7 @@ class EnvironmentDesignControllerTest &lt; ActionController::TestCase @@ -7,8 +7,7 @@ class EnvironmentDesignControllerTest &lt; ActionController::TestCase
7 7
8 def setup 8 def setup
9 @controller = EnvironmentDesignController.new 9 @controller = EnvironmentDesignController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new 10 +
12 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) 11 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([])
13 end 12 end
14 13
test/functional/environment_role_manager_controller_test.rb
@@ -4,8 +4,6 @@ require &#39;environment_role_manager_controller&#39; @@ -4,8 +4,6 @@ require &#39;environment_role_manager_controller&#39;
4 class EnvironmentRoleManagerControllerTest < ActionController::TestCase 4 class EnvironmentRoleManagerControllerTest < ActionController::TestCase
5 def setup 5 def setup
6 @controller = EnvironmentRoleManagerController.new 6 @controller = EnvironmentRoleManagerController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new  
9 end 7 end
10 8
11 end 9 end
test/functional/environment_themes_controller_test.rb
@@ -4,8 +4,6 @@ class EnvironmentThemesControllerTest &lt; ActionController::TestCase @@ -4,8 +4,6 @@ class EnvironmentThemesControllerTest &lt; ActionController::TestCase
4 4
5 def setup 5 def setup
6 @controller = EnvironmentThemesController.new 6 @controller = EnvironmentThemesController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new  
9 7
10 Theme.stubs(:user_themes_dir).returns(TMP_THEMES_DIR) 8 Theme.stubs(:user_themes_dir).returns(TMP_THEMES_DIR)
11 9
test/functional/favorite_enterprises_controller_test.rb
@@ -6,8 +6,6 @@ class FavoriteEnterprisesControllerTest &lt; ActionController::TestCase @@ -6,8 +6,6 @@ class FavoriteEnterprisesControllerTest &lt; ActionController::TestCase
6 self.default_params = {profile: 'testuser'} 6 self.default_params = {profile: 'testuser'}
7 def setup 7 def setup
8 @controller = FavoriteEnterprisesController.new 8 @controller = FavoriteEnterprisesController.new
9 - @request = ActionController::TestRequest.new  
10 - @response = ActionController::TestResponse.new  
11 9
12 self.profile = create_user('testuser').person 10 self.profile = create_user('testuser').person
13 self.favorite_enterprise = fast_create(Enterprise, :name => 'the_enterprise', :identifier => 'the_enterprise') 11 self.favorite_enterprise = fast_create(Enterprise, :name => 'the_enterprise', :identifier => 'the_enterprise')
test/functional/features_controller_test.rb
@@ -6,8 +6,6 @@ class FeaturesControllerTest &lt; ActionController::TestCase @@ -6,8 +6,6 @@ class FeaturesControllerTest &lt; ActionController::TestCase
6 all_fixtures 6 all_fixtures
7 def setup 7 def setup
8 @controller = FeaturesController.new 8 @controller = FeaturesController.new
9 - @request = ActionController::TestRequest.new  
10 - @response = ActionController::TestResponse.new  
11 9
12 login_as(create_admin_user(Environment.find(2))) 10 login_as(create_admin_user(Environment.find(2)))
13 end 11 end
test/functional/friends_controller_test.rb
@@ -6,8 +6,6 @@ class FriendsControllerTest &lt; ActionController::TestCase @@ -6,8 +6,6 @@ class FriendsControllerTest &lt; ActionController::TestCase
6 self.default_params = {profile: 'testuser'} 6 self.default_params = {profile: 'testuser'}
7 def setup 7 def setup
8 @controller = FriendsController.new 8 @controller = FriendsController.new
9 - @request = ActionController::TestRequest.new  
10 - @response = ActionController::TestResponse.new  
11 9
12 self.profile = create_user('testuser').person 10 self.profile = create_user('testuser').person
13 self.friend = create_user('thefriend').person 11 self.friend = create_user('thefriend').person
test/functional/home_controller_test.rb
@@ -10,8 +10,6 @@ class HomeControllerTest &lt; ActionController::TestCase @@ -10,8 +10,6 @@ class HomeControllerTest &lt; ActionController::TestCase
10 all_fixtures 10 all_fixtures
11 def setup 11 def setup
12 @controller = HomeController.new 12 @controller = HomeController.new
13 - @request = ActionController::TestRequest.new  
14 - @response = ActionController::TestResponse.new  
15 end 13 end
16 14
17 should 'not display news from portal if disabled in environment' do 15 should 'not display news from portal if disabled in environment' do
test/functional/licenses_controller_test.rb
@@ -5,8 +5,7 @@ class LicensesControllerTest &lt; ActionController::TestCase @@ -5,8 +5,7 @@ class LicensesControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = LicensesController.new 7 @controller = LicensesController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new 8 +
10 @environment = Environment.default 9 @environment = Environment.default
11 login_as(create_admin_user(@environment)) 10 login_as(create_admin_user(@environment))
12 end 11 end
test/functional/mailconf_controller_test.rb
@@ -4,8 +4,7 @@ class MailconfControllerTest &lt; ActionController::TestCase @@ -4,8 +4,7 @@ class MailconfControllerTest &lt; ActionController::TestCase
4 4
5 def setup 5 def setup
6 @controller = MailconfController.new 6 @controller = MailconfController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new 7 +
9 User.destroy_all 8 User.destroy_all
10 @user = create_user('ze') 9 @user = create_user('ze')
11 10
test/functional/map_balloon_controller_test.rb
@@ -5,8 +5,6 @@ class MapBalloonControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class MapBalloonControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = MapBalloonController.new 7 @controller = MapBalloonController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 8
11 @profile = create_user('test_profile').person 9 @profile = create_user('test_profile').person
12 login_as(@profile.identifier) 10 login_as(@profile.identifier)
test/functional/maps_controller_test.rb
@@ -6,8 +6,6 @@ class MapsControllerTest &lt; ActionController::TestCase @@ -6,8 +6,6 @@ class MapsControllerTest &lt; ActionController::TestCase
6 6
7 def setup 7 def setup
8 @controller = MapsController.new 8 @controller = MapsController.new
9 - @request = ActionController::TestRequest.new  
10 - @response = ActionController::TestResponse.new  
11 9
12 @profile = create_user('test_profile').person 10 @profile = create_user('test_profile').person
13 login_as(@profile.identifier) 11 login_as(@profile.identifier)
test/functional/memberships_controller_test.rb
@@ -7,8 +7,6 @@ class MembershipsControllerTest &lt; ActionController::TestCase @@ -7,8 +7,6 @@ class MembershipsControllerTest &lt; ActionController::TestCase
7 7
8 def setup 8 def setup
9 @controller = MembershipsController.new 9 @controller = MembershipsController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new  
12 10
13 @profile = create_user('testuser').person 11 @profile = create_user('testuser').person
14 login_as('testuser') 12 login_as('testuser')
test/functional/my_profile_controller_test.rb
@@ -13,8 +13,6 @@ class MyProfileControllerTest &lt; ActionController::TestCase @@ -13,8 +13,6 @@ class MyProfileControllerTest &lt; ActionController::TestCase
13 all_fixtures 13 all_fixtures
14 def setup 14 def setup
15 @controller = MyProfileController.new 15 @controller = MyProfileController.new
16 - @request = ActionController::TestRequest.new  
17 - @response = ActionController::TestResponse.new  
18 end 16 end
19 17
20 def test_should_allow_person 18 def test_should_allow_person
test/functional/organizations_controller_test.rb
@@ -5,8 +5,6 @@ class OrganizationsControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class OrganizationsControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = OrganizationsController.new 7 @controller = OrganizationsController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 8
11 @environment = Environment.default 9 @environment = Environment.default
12 10
test/functional/plugins_controller_test.rb
@@ -6,8 +6,7 @@ class PluginsControllerTest &lt; ActionController::TestCase @@ -6,8 +6,7 @@ class PluginsControllerTest &lt; ActionController::TestCase
6 all_fixtures 6 all_fixtures
7 def setup 7 def setup
8 @controller = PluginsController.new 8 @controller = PluginsController.new
9 - @request = ActionController::TestRequest.new  
10 - @response = ActionController::TestResponse.new 9 +
11 @environment = Environment.default 10 @environment = Environment.default
12 login_as(create_admin_user(@environment)) 11 login_as(create_admin_user(@environment))
13 end 12 end
test/functional/profile_design_controller_test.rb
@@ -11,8 +11,6 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase @@ -11,8 +11,6 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase
11 attr_reader :holder 11 attr_reader :holder
12 def setup 12 def setup
13 @controller = ProfileDesignController.new 13 @controller = ProfileDesignController.new
14 - @request = ActionController::TestRequest.new  
15 - @response = ActionController::TestResponse.new  
16 14
17 @profile = @holder = create_user('designtestuser').person 15 @profile = @holder = create_user('designtestuser').person
18 holder.save! 16 holder.save!
test/functional/profile_editor_controller_test.rb
@@ -6,8 +6,7 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase @@ -6,8 +6,7 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
6 6
7 def setup 7 def setup
8 @controller = ProfileEditorController.new 8 @controller = ProfileEditorController.new
9 - @request = ActionController::TestRequest.new  
10 - @response = ActionController::TestResponse.new 9 +
11 @profile = create_user('default_user').person 10 @profile = create_user('default_user').person
12 Environment.default.affiliate(@profile, [Environment::Roles.admin(Environment.default.id)] + Profile::Roles.all_roles(Environment.default.id)) 11 Environment.default.affiliate(@profile, [Environment::Roles.admin(Environment.default.id)] + Profile::Roles.all_roles(Environment.default.id))
13 login_as('default_user') 12 login_as('default_user')
@@ -643,9 +642,10 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase @@ -643,9 +642,10 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
643 642
644 profile.domains << Domain.new(:name => 'myowndomain.net') 643 profile.domains << Domain.new(:name => 'myowndomain.net')
645 profile.environment.domains << Domain.new(:name => 'myenv.net') 644 profile.environment.domains << Domain.new(:name => 'myenv.net')
646 - ActionController::TestRequest.any_instance.stubs(:host).returns(profile.hostname)  
647 645
  646 + @request.env['HTTP_HOST'] = profile.hostname
648 get :edit, :profile => profile.identifier 647 get :edit, :profile => profile.identifier
  648 +
649 assert_tag :tag => 'select', :attributes => { :name => 'profile_data[preferred_domain_id]' }, :descendant => { :tag => "option", :content => 'myowndomain.net' } 649 assert_tag :tag => 'select', :attributes => { :name => 'profile_data[preferred_domain_id]' }, :descendant => { :tag => "option", :content => 'myowndomain.net' }
650 assert_tag :tag => 'select', :attributes => { :name => 'profile_data[preferred_domain_id]' }, :descendant => { :tag => "option", :content => 'myenv.net' } 650 assert_tag :tag => 'select', :attributes => { :name => 'profile_data[preferred_domain_id]' }, :descendant => { :tag => "option", :content => 'myenv.net' }
651 651
@@ -659,9 +659,10 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase @@ -659,9 +659,10 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
659 659
660 profile.domains << Domain.new(:name => 'myowndomain.net') 660 profile.domains << Domain.new(:name => 'myowndomain.net')
661 profile.environment.domains << Domain.new(:name => 'myenv.net') 661 profile.environment.domains << Domain.new(:name => 'myenv.net')
662 - ActionController::TestRequest.any_instance.stubs(:host).returns(profile.hostname)  
663 662
  663 + @request.env['HTTP_HOST'] = profile.hostname
664 get :edit, :profile => profile.identifier 664 get :edit, :profile => profile.identifier
  665 +
665 assert_tag :tag => "select", :attributes => { :name => 'profile_data[preferred_domain_id]'}, :descendant => { :tag => 'option', :content => '&lt;Select domain&gt;', :attributes => { :value => '' } } 666 assert_tag :tag => "select", :attributes => { :name => 'profile_data[preferred_domain_id]'}, :descendant => { :tag => 'option', :content => '&lt;Select domain&gt;', :attributes => { :value => '' } }
666 667
667 post :edit, :profile => profile.identifier, :profile_data => { :preferred_domain_id => '' } 668 post :edit, :profile => profile.identifier, :profile_data => { :preferred_domain_id => '' }
@@ -1112,8 +1113,10 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase @@ -1112,8 +1113,10 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
1112 should 'not redirect if the profile_hostname is the same as environment hostname' do 1113 should 'not redirect if the profile_hostname is the same as environment hostname' do
1113 Person.any_instance.stubs(:hostname).returns('hostname.org') 1114 Person.any_instance.stubs(:hostname).returns('hostname.org')
1114 Environment.any_instance.stubs(:default_hostname).returns('hostname.org') 1115 Environment.any_instance.stubs(:default_hostname).returns('hostname.org')
1115 - ActionController::TestRequest.any_instance.stubs(:host).returns('hostname.org') 1116 +
  1117 + @request.env['HTTP_HOST'] = 'hostname.org'
1116 get :index, :profile => profile.identifier 1118 get :index, :profile => profile.identifier
  1119 +
1117 assert_response :success 1120 assert_response :success
1118 end 1121 end
1119 1122
test/functional/profile_members_controller_test.rb
@@ -5,8 +5,6 @@ class ProfileMembersControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class ProfileMembersControllerTest &lt; ActionController::TestCase
5 def setup 5 def setup
6 super 6 super
7 @controller = ProfileMembersController.new 7 @controller = ProfileMembersController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 end 8 end
11 9
12 should 'not access index if dont have permission' do 10 should 'not access index if dont have permission' do
test/functional/profile_roles_controller_test.rb
@@ -5,8 +5,7 @@ class ProfileRolesControllerTest &lt; ActionController::TestCase @@ -5,8 +5,7 @@ class ProfileRolesControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = ProfileRolesController.new 7 @controller = ProfileRolesController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new 8 +
10 @role = Role.first 9 @role = Role.first
11 end 10 end
12 11
test/functional/profile_search_controller_test.rb
@@ -4,8 +4,6 @@ require &#39;profile_search_controller&#39; @@ -4,8 +4,6 @@ require &#39;profile_search_controller&#39;
4 class ProfileSearchControllerTest < ActionController::TestCase 4 class ProfileSearchControllerTest < ActionController::TestCase
5 def setup 5 def setup
6 @controller = ProfileSearchController.new 6 @controller = ProfileSearchController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new  
9 7
10 @person = fast_create(Person) 8 @person = fast_create(Person)
11 end 9 end
test/functional/profile_themes_controller_test.rb
@@ -4,8 +4,6 @@ class ProfileThemesControllerTest &lt; ActionController::TestCase @@ -4,8 +4,6 @@ class ProfileThemesControllerTest &lt; ActionController::TestCase
4 4
5 def setup 5 def setup
6 @controller = ProfileThemesController.new 6 @controller = ProfileThemesController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new  
9 7
10 Theme.stubs(:user_themes_dir).returns(TMP_THEMES_DIR) 8 Theme.stubs(:user_themes_dir).returns(TMP_THEMES_DIR)
11 9
test/functional/region_validators_controller_test.rb
@@ -5,8 +5,7 @@ class RegionValidatorsControllerTest &lt; ActionController::TestCase @@ -5,8 +5,7 @@ class RegionValidatorsControllerTest &lt; ActionController::TestCase
5 all_fixtures 5 all_fixtures
6 def setup 6 def setup
7 @controller = RegionValidatorsController.new 7 @controller = RegionValidatorsController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new 8 +
10 login_as('ze') 9 login_as('ze')
11 end 10 end
12 11
test/functional/role_controller_test.rb
@@ -6,8 +6,7 @@ class RoleControllerTest &lt; ActionController::TestCase @@ -6,8 +6,7 @@ class RoleControllerTest &lt; ActionController::TestCase
6 6
7 def setup 7 def setup
8 @controller = RoleController.new 8 @controller = RoleController.new
9 - @request = ActionController::TestRequest.new  
10 - @response = ActionController::TestResponse.new 9 +
11 @role = Role.first 10 @role = Role.first
12 login_as(:ze) 11 login_as(:ze)
13 end 12 end
test/functional/search_controller_test.rb
@@ -4,9 +4,6 @@ class SearchControllerTest &lt; ActionController::TestCase @@ -4,9 +4,6 @@ class SearchControllerTest &lt; ActionController::TestCase
4 4
5 def setup 5 def setup
6 @controller = SearchController.new 6 @controller = SearchController.new
7 - @request = ActionController::TestRequest.new  
8 - @request.stubs(:ssl?).returns(false)  
9 - @response = ActionController::TestResponse.new  
10 7
11 @environment = Environment.default 8 @environment = Environment.default
12 @category = Category.create!(:name => 'my-category', :environment => @environment) 9 @category = Category.create!(:name => 'my-category', :environment => @environment)
test/functional/system_controller_test.rb
@@ -4,8 +4,6 @@ require &#39;system_controller&#39; @@ -4,8 +4,6 @@ require &#39;system_controller&#39;
4 class SystemControllerTest < ActionController::TestCase 4 class SystemControllerTest < ActionController::TestCase
5 def setup 5 def setup
6 @controller = SystemController.new 6 @controller = SystemController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new  
9 end 7 end
10 8
11 # Replace this with your real tests. 9 # Replace this with your real tests.
test/functional/tasks_controller_test.rb
@@ -7,8 +7,6 @@ class TasksControllerTest &lt; ActionController::TestCase @@ -7,8 +7,6 @@ class TasksControllerTest &lt; ActionController::TestCase
7 7
8 def setup 8 def setup
9 @controller = TasksController.new 9 @controller = TasksController.new
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new  
12 10
13 self.profile = create_user('testuser').person 11 self.profile = create_user('testuser').person
14 @controller.stubs(:profile).returns(profile) 12 @controller.stubs(:profile).returns(profile)
test/functional/templates_controller_test.rb
@@ -5,8 +5,6 @@ class TemplatesControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class TemplatesControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = TemplatesController.new 7 @controller = TemplatesController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 8
11 @environment = Environment.default 9 @environment = Environment.default
12 login_as(create_admin_user(@environment)) 10 login_as(create_admin_user(@environment))
test/functional/trusted_sites_controller_test.rb
@@ -6,8 +6,7 @@ class TrustedSitesControllerTest &lt; ActionController::TestCase @@ -6,8 +6,7 @@ class TrustedSitesControllerTest &lt; ActionController::TestCase
6 6
7 def setup 7 def setup
8 @controller = TrustedSitesController.new 8 @controller = TrustedSitesController.new
9 - @request = ActionController::TestRequest.new  
10 - @response = ActionController::TestResponse.new 9 +
11 @role = Role.first 10 @role = Role.first
12 @environment = Environment.default 11 @environment = Environment.default
13 @environment.trusted_sites_for_iframe = ['existing.site.com'] 12 @environment.trusted_sites_for_iframe = ['existing.site.com']
test/functional/users_controller_test.rb
@@ -5,8 +5,6 @@ class UsersControllerTest &lt; ActionController::TestCase @@ -5,8 +5,6 @@ class UsersControllerTest &lt; ActionController::TestCase
5 5
6 def setup 6 def setup
7 @controller = UsersController.new 7 @controller = UsersController.new
8 - @request = ActionController::TestRequest.new  
9 - @response = ActionController::TestResponse.new  
10 8
11 @environment = Environment.default 9 @environment = Environment.default
12 10
vendor/plugins/access_control/test/permission_check_test.rb
@@ -4,8 +4,6 @@ class PermissionCheckTest &lt; ActionController::TestCase @@ -4,8 +4,6 @@ class PermissionCheckTest &lt; ActionController::TestCase
4 4
5 def setup 5 def setup
6 @controller = AccessControlTestController.new 6 @controller = AccessControlTestController.new
7 - @request = ActionController::TestRequest.new  
8 - @response = ActionController::TestResponse.new  
9 end 7 end
10 8
11 def test_access_denied 9 def test_access_denied
vendor/plugins/action_tracker/test/action_tracker_test.rb
@@ -54,12 +54,11 @@ ActionController::Routing::Routes.draw { |map| map.resources :things, :collectio @@ -54,12 +54,11 @@ ActionController::Routing::Routes.draw { |map| map.resources :things, :collectio
54 class ActionTrackerTest < ActiveSupport::TestCase 54 class ActionTrackerTest < ActiveSupport::TestCase
55 55
56 def setup 56 def setup
  57 + @controller = ThingsController.new
  58 +
57 ActionTrackerConfig.current_user = proc{ SomeModel.first || SomeModel.create! } 59 ActionTrackerConfig.current_user = proc{ SomeModel.first || SomeModel.create! }
58 ActionTracker::Record.delete_all 60 ActionTracker::Record.delete_all
59 ActionTrackerConfig.verbs = { :some_verb => { :description => "Did something" } } 61 ActionTrackerConfig.verbs = { :some_verb => { :description => "Did something" } }
60 - @request = ActionController::TestRequest.new  
61 - @response = ActionController::TestResponse.new  
62 - @controller = ThingsController.new  
63 end 62 end
64 63
65 def test_index 64 def test_index