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 class AccountControllerTest < ActionController::TestCase
9 9 def setup
10 10 @controller = AccountController.new
11   - @request = ActionController::TestRequest.new
12   - @response = ActionController::TestResponse.new
  11 +
13 12 @person = create_user('person').person
14 13  
15 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 4 class AdminNotificationsPluginAdminControllerTest < ActionController::TestCase
5 5 def setup
6 6 @controller = AdminNotificationsPluginAdminController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
9 7 @person = create_user('person').person
10 8  
11 9 @environment = Environment.default
... ...
plugins/admin_notifications/test/functional/admin_notifications_plugin_myprofile_controller_test.rb
... ... @@ -7,8 +7,6 @@ require(
7 7 class AdminNotificationsPluginMyprofileControllerTest < ActionController::TestCase
8 8 def setup
9 9 @controller = AdminNotificationsPluginMyprofileController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
12 10 @person = create_user('person').person
13 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 7 class AdminNotificationsPluginPublicControllerTest < ActionController::TestCase
8 8 def setup
9 9 @controller = AdminNotificationsPluginPublicController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
12 10 @person = create_user('person').person
13 11  
14 12 @environment = Environment.default
... ...
plugins/admin_notifications/test/functional/home_controller_test.rb
... ... @@ -7,8 +7,7 @@ end
7 7 class HomeControllerTest < ActionController::TestCase
8 8 def setup
9 9 @controller = HomeController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
  10 +
12 11 @person = create_user('person').person
13 12  
14 13 @environment = Environment.default
... ...
plugins/analytics/test/functional/content_viewer_controller_test.rb
... ... @@ -5,8 +5,6 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
5 5  
6 6 def setup
7 7 @controller = ContentViewerController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8  
11 9 @environment = Environment.default
12 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 5  
6 6 def setup
7 7 @controller = CommentGroupPluginProfileController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8  
11 9 @profile = create_user('testuser').person
12 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 5  
6 6 def setup
7 7 @controller = CommentGroupPluginPublicController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8  
11 9 @profile = create_user('testuser').person
12 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 4 class CustomFormsPluginMyprofileControllerTest < ActionController::TestCase
5 5 def setup
6 6 @controller = CustomFormsPluginMyprofileController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
  7 +
9 8 @profile = create_user('profile').person
10 9 login_as(@profile.identifier)
11 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 4 class CustomFormsPluginProfileControllerTest < ActionController::TestCase
5 5 def setup
6 6 @controller = CustomFormsPluginProfileController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
  7 +
9 8 @profile = create_user('profile').person
10 9 login_as(@profile.identifier)
11 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 5  
6 6 def setup
7 7 @controller = DisplayContentPluginAdminController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8  
11 9 @environment = Environment.default
12 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 5  
6 6 def setup
7 7 @controller = DisplayContentPluginMyprofileController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8  
11 9 user = create_user('testinguser')
12 10 login_as(user.login)
... ...
plugins/driven_signup/test/integration/account_controller_test.rb
... ... @@ -7,8 +7,7 @@ class AccountControllerTest &lt; ActionDispatch::IntegrationTest
7 7  
8 8 def setup
9 9 @controller = AccountController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
  10 + @request = ActionController::TestRequest.new
12 11  
13 12 e = Environment.default
14 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 5  
6 6 def setup
7 7 @controller = ProfileEditorController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
  8 +
10 9 @profile = create_user('default_user').person
11 10 login_as(@profile.identifier)
12 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 5  
6 6 def setup
7 7 @controller = GoogleCsePluginController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8 end
11 9  
12 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 7  
8 8 def setup
9 9 @controller = ContentViewerController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
12 10  
13 11 @profile = create_user('testinguser').person
14 12 @environment = @profile.environment
... ...
plugins/ldap/test/functional/account_controller_plugin_test.rb
... ... @@ -4,8 +4,6 @@ class AccountControllerPluginTest &lt; ActionController::TestCase
4 4  
5 5 def setup
6 6 @controller = AccountController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
9 7  
10 8 @environment = Environment.default
11 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 4 class MarkCommentAsReadPluginProfileControllerTest < ActionController::TestCase
5 5 def setup
6 6 @controller = MarkCommentAsReadPluginProfileController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
  7 +
9 8 @profile = create_user('profile').person
10 9 @article = TinyMceArticle.create!(:profile => @profile, :name => 'An article')
11 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 6  
7 7 def setup
8 8 @controller = ContentViewerController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
11 9  
12 10 @profile = create_user('testinguser').person
13 11 @environment = @profile.environment
... ...
plugins/metadata/test/functional/home_controller_test.rb
... ... @@ -5,8 +5,6 @@ class HomeControllerTest &lt; ActionController::TestCase
5 5  
6 6 def setup
7 7 @controller = HomeController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8  
11 9 @environment = Environment.default
12 10 @environment.enabled_plugins += ['MetadataPlugin']
... ...
plugins/metadata/test/functional/products_plugin/page_controller_test.rb
... ... @@ -6,8 +6,6 @@ if defined? ProductsPlugin
6 6  
7 7 def setup
8 8 @controller = PageController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
11 9 @enterprise = fast_create(Enterprise, name: 'test', identifier: 'test_ent')
12 10 @user = create_user_with_permission('test_user', 'manage_products', @enterprise)
13 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 4  
5 5 def setup
6 6 @controller = NewsletterPluginAdminController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
9 7  
10 8 @admin = create_user('admin_newsletter').person
11 9 @environment = @admin.environment
... ...
plugins/newsletter/test/functional/newsletter_plugin_controller_test.rb
... ... @@ -4,8 +4,7 @@ class NewsletterPluginControllerTest &lt; ActionController::TestCase
4 4  
5 5 def setup
6 6 @controller = NewsletterPluginController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
  7 +
9 8 environment = fast_create(Environment)
10 9 environment.enable_plugin(NewsletterPlugin)
11 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  
9 9 def setup
10 10 @controller = OpenGraphPlugin::MyprofileController.new
11   - @request = ActionController::TestRequest.new
12   - @response = ActionController::TestResponse.new
  11 +
13 12 @actor = create_user.person
14 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  
9 9 def setup
10 10 @controller = OrganizationRatingsPluginAdminController.new
11   - @request = ActionController::TestRequest.new
12   - @response = ActionController::TestResponse.new
13 11  
14 12 @environment = Environment.default
15 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  
9 9 def setup
10 10 @controller = OrganizationRatingsPluginProfileController.new
11   - @request = ActionController::TestRequest.new
12   - @response = ActionController::TestResponse.new
13 11  
14 12 @environment = Environment.default
15 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 4  
5 5 def setup
6 6 @controller = EnvironmentDesignController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
  7 +
9 8 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([PeopleBlockPlugin.new])
10 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 4  
5 5 def setup
6 6 @controller = ProfileDesignController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
  7 +
9 8 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([PeopleBlockPlugin.new])
10 9 end
11 10  
... ...
plugins/people_block/test/functional/profile_controller_test.rb
... ... @@ -4,8 +4,7 @@ class ProfileControllerTest &lt; ActionController::TestCase
4 4  
5 5 def setup
6 6 @controller = ProfileController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
  7 +
9 8 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([PeopleBlockPlugin.new])
10 9 end
11 10  
... ...
plugins/relevant_content/test/unit/article.rb
... ... @@ -8,8 +8,7 @@ class RelevantContentBlockTest &lt; ActiveSupport::TestCase
8 8  
9 9 def setup
10 10 @controller = CommentController.new
11   - @request = ActionController::TestRequest.new
12   - @response = ActionController::TestResponse.new
  11 +
13 12 @profile = create_user('testinguser').person
14 13 @environment = @profile.environment
15 14 end
... ...
plugins/relevant_content/test/unit/relevant_content_block_test.rb
... ... @@ -9,8 +9,6 @@ class RelevantContentBlockTest &lt; ActiveSupport::TestCase
9 9  
10 10 def setup
11 11 @controller = CommentController.new
12   - @request = ActionController::TestRequest.new
13   - @response = ActionController::TestResponse.new
14 12  
15 13 @profile = create_user('testinguser').person
16 14 @environment = @profile.environment
... ...
plugins/remote_user/test/functional/remote_user_plugin_test.rb
... ... @@ -2,6 +2,8 @@ require &#39;test_helper&#39;
2 2  
3 3 class AccountControllerTest < ActionController::TestCase
4 4 def setup
  5 + @controller = AccountController.new
  6 +
5 7 @environment = Environment.default
6 8 @environment.enabled_plugins = ['RemoteUserPlugin']
7 9 @environment.save
... ... @@ -9,10 +11,6 @@ class AccountControllerTest &lt; ActionController::TestCase
9 11 @another_environment = Environment.new(name: "AnotherEnvironment")
10 12 @another_environment.enabled_plugins = ['RemoteUserPlugin']
11 13 @another_environment.save
12   -
13   - @controller = AccountController.new
14   - @request = ActionController::TestRequest.new
15   - @response = ActionController::TestResponse.new
16 14 end
17 15  
18 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 5  
6 6 def setup
7 7 @controller = ShoppingCartPluginController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
  8 +
10 9 @profile = fast_create(Enterprise)
11 10 @profile.contact_email = 'enterprise@noosfero.org';@profile.save
12 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 5  
6 6 def setup
7 7 @controller = ContentViewerController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8  
11 9 @profile = create_user('testinguser').person
12 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 4 class SearchControllerTest < ActionController::TestCase
5 5  
6 6 def setup
  7 + @controller = SearchController.new
  8 +
7 9 TestSolr.enable
8 10 p1 = File.join(RAILS_ROOT, 'app', 'views')
9 11 p2 = File.join(File.dirname(__FILE__) + '/../../views')
10 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 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 4 class SpaminatorPluginAdminControllerTest < ActionController::TestCase
5 5 def setup
6 6 @controller = SpaminatorPluginAdminController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
  7 +
9 8 @environment = Environment.default
10 9 @settings = Noosfero::Plugin::Settings.new(@environment, SpaminatorPlugin)
11 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 19  
20 20 def setup
21 21 @controller = AccountController.new
22   - @request = ActionController::TestRequest.new
23   - @response = ActionController::TestResponse.new
24 22 StoaPlugin::UspUser.create!({:codpes => 12345678, :cpf => Digest::MD5.hexdigest(SALT+'12345678'), :birth_date => '1970-01-30'}, :without_protection => true)
25 23 Environment.default.enable_plugin(StoaPlugin.name)
26 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 5  
6 6 def setup
7 7 @controller = InviteController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
  8 +
10 9 environment = Environment.default
11 10 environment.enabled_plugins = ['StoaPlugin']
12 11 environment.save!
... ...
plugins/stoa/test/functional/profile_editor_controller_test.rb
... ... @@ -7,8 +7,7 @@ class StoaPluginProfileEditorControllerTest &lt; ActionController::TestCase
7 7  
8 8 def setup
9 9 @controller = ProfileEditorController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
  10 +
12 11 @person = User.create(:login => 'test_user', :email => 'test_user@example.com', :password => 'test', :password_confirmation => 'test').person
13 12 login_as(@person.identifier)
14 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 7  
8 8 def setup
9 9 @controller = StoaPluginController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
12 10 ApplicationRecord.configurations['stoa'] = {:adapter => 'sqlite3', :database => ':memory:', :verbosity => 'quiet'}
13 11 env = Environment.default
14 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 7 class SubOrganizationsPluginMyprofileControllerTest < ActionController::TestCase
8 8 def setup
9 9 @controller = SubOrganizationsPluginMyprofileController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
  10 +
12 11 @organization = Organization.create!(:name => 'My Organization', :identifier => 'my-organization')
13 12 @person = create_user('person').person
14 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  
9 9 def setup
10 10 @controller = SubOrganizationsPluginProfileController.new
11   - @request = ActionController::TestRequest.new
12   - @response = ActionController::TestResponse.new
  11 +
13 12 @organization = Organization.create!(:name => 'My Organization', :identifier => 'my-organization')
14 13 @person = create_user('person').person
15 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 4  
5 5 def setup
6 6 @controller = EnvironmentDesignController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
9 7  
10 8 Environment.delete_all
11 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 4  
5 5 def setup
6 6 @controller = ProfileDesignController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
9 7  
10 8 user = create_user('testinguser')
11 9 login_as(user.login)
... ...
plugins/work_assignment/test/functional/cms_controller_test.rb
... ... @@ -5,8 +5,7 @@ class CmsControllerTest &lt; ActionController::TestCase
5 5  
6 6 def setup
7 7 @controller = CmsController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
  8 +
10 9 @person = create_user('test_user').person
11 10 login_as :test_user
12 11 e = Environment.default
... ...
plugins/work_assignment/test/functional/content_viewer_controller_test.rb
... ... @@ -5,8 +5,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
5 5  
6 6 def setup
7 7 @controller = ContentViewerController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
  8 +
10 9 @profile = create_user('testinguser').person
11 10  
12 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 5  
6 6 def setup
7 7 @controller = WorkAssignmentPluginMyprofileController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
  8 +
10 9 @person = create_user('test_user').person
11 10 login_as :test_user
12 11 e = Environment.default
... ...
test/api/boxes_test.rb
... ... @@ -5,7 +5,6 @@ class BoxesTest &lt; ActiveSupport::TestCase
5 5 def setup
6 6 create_and_activate_user
7 7 login_api
8   -# @request = ActionController::TestRequest.new
9 8 end
10 9  
11 10 kinds= %w[Profile Community Person Enterprise Environment]
... ...
test/functional/account_controller_test.rb
... ... @@ -11,8 +11,7 @@ class AccountControllerTest &lt; ActionController::TestCase
11 11  
12 12 def setup
13 13 @controller = AccountController.new
14   - @request = ActionController::TestRequest.new
15   - @response = ActionController::TestResponse.new
  14 +
16 15 disable_signup_bot_check
17 16 end
18 17  
... ...
test/functional/admin_panel_controller_test.rb
... ... @@ -6,8 +6,7 @@ class AdminPanelControllerTest &lt; ActionController::TestCase
6 6 all_fixtures
7 7 def setup
8 8 @controller = AdminPanelController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
  9 +
11 10 login_as(create_admin_user(Environment.default))
12 11 end
13 12  
... ...
test/functional/application_controller_test.rb
... ... @@ -4,10 +4,9 @@ require &#39;test_controller&#39;
4 4  
5 5 class ApplicationControllerTest < ActionController::TestCase
6 6 all_fixtures
  7 +
7 8 def setup
8 9 @controller = TestController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
11 10 end
12 11  
13 12 def test_detection_of_environment_by_host
... ... @@ -50,7 +49,7 @@ class ApplicationControllerTest &lt; ActionController::TestCase
50 49 current = fast_create(Environment, :name => 'test environment')
51 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 53 get :index
55 54  
56 55 assert_equal current, assigns(:environment)
... ...
test/functional/categories_controller_test.rb
... ... @@ -5,8 +5,6 @@ class CategoriesControllerTest &lt; ActionController::TestCase
5 5 all_fixtures
6 6 def setup
7 7 @controller = CategoriesController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8  
11 9 @env = fast_create(Environment, :name => "My test environment")
12 10 Environment.stubs(:default).returns(env)
... ...
test/functional/comment_controller_test.rb
... ... @@ -5,8 +5,6 @@ class CommentControllerTest &lt; ActionController::TestCase
5 5  
6 6 def setup
7 7 @controller = CommentController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8  
11 9 @profile = create_user('testinguser').person
12 10 @environment = @profile.environment
... ...
test/functional/contact_controller_test.rb
... ... @@ -8,8 +8,6 @@ class ContactControllerTest &lt; ActionController::TestCase
8 8  
9 9 def setup
10 10 @controller = ContactController.new
11   - @request = ActionController::TestRequest.new
12   - @response = ActionController::TestResponse.new
13 11  
14 12 @profile = create_user('contact_test_user').person
15 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 7  
8 8 def setup
9 9 @controller = ContentViewerController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
12 10  
13 11 @profile = create_user('testinguser').person
14 12 @environment = @profile.environment
... ... @@ -220,8 +218,7 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
220 218 profile.domains << Domain.create!(:name => 'micojones.net')
221 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 222 get :view_page, :page => []
226 223  
227 224 assert_equal profile, assigns(:profile)
... ...
test/functional/edit_template_controller_test.rb
... ... @@ -7,8 +7,7 @@ class EditTemplateControllerTest &lt; ActionController::TestCase
7 7 all_fixtures
8 8 def setup
9 9 @controller = EditTemplateController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
  10 +
12 11 login_as 'ze'
13 12 end
14 13  
... ...
test/functional/enterprise_registration_controller_test.rb
... ... @@ -9,8 +9,7 @@ class EnterpriseRegistrationControllerTest &lt; ActionController::TestCase
9 9 def setup
10 10 super
11 11 @controller = EnterpriseRegistrationController.new
12   - @request = ActionController::TestRequest.new
13   - @response = ActionController::TestResponse.new
  12 +
14 13 login_as 'ze'
15 14 end
16 15  
... ...
test/functional/enterprise_validation_controller_test.rb
... ... @@ -7,8 +7,6 @@ class EnterpriseValidationControllerTest &lt; ActionController::TestCase
7 7  
8 8 def setup
9 9 @controller = EnterpriseValidationController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
12 10  
13 11 login_as 'ze'
14 12 @user = Profile['ze']
... ...
test/functional/environment_design_controller_test.rb
... ... @@ -7,8 +7,7 @@ class EnvironmentDesignControllerTest &lt; ActionController::TestCase
7 7  
8 8 def setup
9 9 @controller = EnvironmentDesignController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
  10 +
12 11 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([])
13 12 end
14 13  
... ...
test/functional/environment_role_manager_controller_test.rb
... ... @@ -4,8 +4,6 @@ require &#39;environment_role_manager_controller&#39;
4 4 class EnvironmentRoleManagerControllerTest < ActionController::TestCase
5 5 def setup
6 6 @controller = EnvironmentRoleManagerController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
9 7 end
10 8  
11 9 end
... ...
test/functional/environment_themes_controller_test.rb
... ... @@ -4,8 +4,6 @@ class EnvironmentThemesControllerTest &lt; ActionController::TestCase
4 4  
5 5 def setup
6 6 @controller = EnvironmentThemesController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
9 7  
10 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 6 self.default_params = {profile: 'testuser'}
7 7 def setup
8 8 @controller = FavoriteEnterprisesController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
11 9  
12 10 self.profile = create_user('testuser').person
13 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 6 all_fixtures
7 7 def setup
8 8 @controller = FeaturesController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
11 9  
12 10 login_as(create_admin_user(Environment.find(2)))
13 11 end
... ...
test/functional/friends_controller_test.rb
... ... @@ -6,8 +6,6 @@ class FriendsControllerTest &lt; ActionController::TestCase
6 6 self.default_params = {profile: 'testuser'}
7 7 def setup
8 8 @controller = FriendsController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
11 9  
12 10 self.profile = create_user('testuser').person
13 11 self.friend = create_user('thefriend').person
... ...
test/functional/home_controller_test.rb
... ... @@ -10,8 +10,6 @@ class HomeControllerTest &lt; ActionController::TestCase
10 10 all_fixtures
11 11 def setup
12 12 @controller = HomeController.new
13   - @request = ActionController::TestRequest.new
14   - @response = ActionController::TestResponse.new
15 13 end
16 14  
17 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 5  
6 6 def setup
7 7 @controller = LicensesController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
  8 +
10 9 @environment = Environment.default
11 10 login_as(create_admin_user(@environment))
12 11 end
... ...
test/functional/mailconf_controller_test.rb
... ... @@ -4,8 +4,7 @@ class MailconfControllerTest &lt; ActionController::TestCase
4 4  
5 5 def setup
6 6 @controller = MailconfController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
  7 +
9 8 User.destroy_all
10 9 @user = create_user('ze')
11 10  
... ...
test/functional/map_balloon_controller_test.rb
... ... @@ -5,8 +5,6 @@ class MapBalloonControllerTest &lt; ActionController::TestCase
5 5  
6 6 def setup
7 7 @controller = MapBalloonController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8  
11 9 @profile = create_user('test_profile').person
12 10 login_as(@profile.identifier)
... ...
test/functional/maps_controller_test.rb
... ... @@ -6,8 +6,6 @@ class MapsControllerTest &lt; ActionController::TestCase
6 6  
7 7 def setup
8 8 @controller = MapsController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
11 9  
12 10 @profile = create_user('test_profile').person
13 11 login_as(@profile.identifier)
... ...
test/functional/memberships_controller_test.rb
... ... @@ -7,8 +7,6 @@ class MembershipsControllerTest &lt; ActionController::TestCase
7 7  
8 8 def setup
9 9 @controller = MembershipsController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
12 10  
13 11 @profile = create_user('testuser').person
14 12 login_as('testuser')
... ...
test/functional/my_profile_controller_test.rb
... ... @@ -13,8 +13,6 @@ class MyProfileControllerTest &lt; ActionController::TestCase
13 13 all_fixtures
14 14 def setup
15 15 @controller = MyProfileController.new
16   - @request = ActionController::TestRequest.new
17   - @response = ActionController::TestResponse.new
18 16 end
19 17  
20 18 def test_should_allow_person
... ...
test/functional/organizations_controller_test.rb
... ... @@ -5,8 +5,6 @@ class OrganizationsControllerTest &lt; ActionController::TestCase
5 5  
6 6 def setup
7 7 @controller = OrganizationsController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8  
11 9 @environment = Environment.default
12 10  
... ...
test/functional/plugins_controller_test.rb
... ... @@ -6,8 +6,7 @@ class PluginsControllerTest &lt; ActionController::TestCase
6 6 all_fixtures
7 7 def setup
8 8 @controller = PluginsController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
  9 +
11 10 @environment = Environment.default
12 11 login_as(create_admin_user(@environment))
13 12 end
... ...
test/functional/profile_design_controller_test.rb
... ... @@ -11,8 +11,6 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase
11 11 attr_reader :holder
12 12 def setup
13 13 @controller = ProfileDesignController.new
14   - @request = ActionController::TestRequest.new
15   - @response = ActionController::TestResponse.new
16 14  
17 15 @profile = @holder = create_user('designtestuser').person
18 16 holder.save!
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -6,8 +6,7 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
6 6  
7 7 def setup
8 8 @controller = ProfileEditorController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
  9 +
11 10 @profile = create_user('default_user').person
12 11 Environment.default.affiliate(@profile, [Environment::Roles.admin(Environment.default.id)] + Profile::Roles.all_roles(Environment.default.id))
13 12 login_as('default_user')
... ... @@ -643,9 +642,10 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
643 642  
644 643 profile.domains << Domain.new(:name => 'myowndomain.net')
645 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 647 get :edit, :profile => profile.identifier
  648 +
649 649 assert_tag :tag => 'select', :attributes => { :name => 'profile_data[preferred_domain_id]' }, :descendant => { :tag => "option", :content => 'myowndomain.net' }
650 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 659  
660 660 profile.domains << Domain.new(:name => 'myowndomain.net')
661 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 664 get :edit, :profile => profile.identifier
  665 +
665 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 668 post :edit, :profile => profile.identifier, :profile_data => { :preferred_domain_id => '' }
... ... @@ -1112,8 +1113,10 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
1112 1113 should 'not redirect if the profile_hostname is the same as environment hostname' do
1113 1114 Person.any_instance.stubs(:hostname).returns('hostname.org')
1114 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 1118 get :index, :profile => profile.identifier
  1119 +
1117 1120 assert_response :success
1118 1121 end
1119 1122  
... ...
test/functional/profile_members_controller_test.rb
... ... @@ -5,8 +5,6 @@ class ProfileMembersControllerTest &lt; ActionController::TestCase
5 5 def setup
6 6 super
7 7 @controller = ProfileMembersController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8 end
11 9  
12 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 5  
6 6 def setup
7 7 @controller = ProfileRolesController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
  8 +
10 9 @role = Role.first
11 10 end
12 11  
... ...
test/functional/profile_search_controller_test.rb
... ... @@ -4,8 +4,6 @@ require &#39;profile_search_controller&#39;
4 4 class ProfileSearchControllerTest < ActionController::TestCase
5 5 def setup
6 6 @controller = ProfileSearchController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
9 7  
10 8 @person = fast_create(Person)
11 9 end
... ...
test/functional/profile_themes_controller_test.rb
... ... @@ -4,8 +4,6 @@ class ProfileThemesControllerTest &lt; ActionController::TestCase
4 4  
5 5 def setup
6 6 @controller = ProfileThemesController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
9 7  
10 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 5 all_fixtures
6 6 def setup
7 7 @controller = RegionValidatorsController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
  8 +
10 9 login_as('ze')
11 10 end
12 11  
... ...
test/functional/role_controller_test.rb
... ... @@ -6,8 +6,7 @@ class RoleControllerTest &lt; ActionController::TestCase
6 6  
7 7 def setup
8 8 @controller = RoleController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
  9 +
11 10 @role = Role.first
12 11 login_as(:ze)
13 12 end
... ...
test/functional/search_controller_test.rb
... ... @@ -4,9 +4,6 @@ class SearchControllerTest &lt; ActionController::TestCase
4 4  
5 5 def setup
6 6 @controller = SearchController.new
7   - @request = ActionController::TestRequest.new
8   - @request.stubs(:ssl?).returns(false)
9   - @response = ActionController::TestResponse.new
10 7  
11 8 @environment = Environment.default
12 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 4 class SystemControllerTest < ActionController::TestCase
5 5 def setup
6 6 @controller = SystemController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
9 7 end
10 8  
11 9 # Replace this with your real tests.
... ...
test/functional/tasks_controller_test.rb
... ... @@ -7,8 +7,6 @@ class TasksControllerTest &lt; ActionController::TestCase
7 7  
8 8 def setup
9 9 @controller = TasksController.new
10   - @request = ActionController::TestRequest.new
11   - @response = ActionController::TestResponse.new
12 10  
13 11 self.profile = create_user('testuser').person
14 12 @controller.stubs(:profile).returns(profile)
... ...
test/functional/templates_controller_test.rb
... ... @@ -5,8 +5,6 @@ class TemplatesControllerTest &lt; ActionController::TestCase
5 5  
6 6 def setup
7 7 @controller = TemplatesController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8  
11 9 @environment = Environment.default
12 10 login_as(create_admin_user(@environment))
... ...
test/functional/trusted_sites_controller_test.rb
... ... @@ -6,8 +6,7 @@ class TrustedSitesControllerTest &lt; ActionController::TestCase
6 6  
7 7 def setup
8 8 @controller = TrustedSitesController.new
9   - @request = ActionController::TestRequest.new
10   - @response = ActionController::TestResponse.new
  9 +
11 10 @role = Role.first
12 11 @environment = Environment.default
13 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 5  
6 6 def setup
7 7 @controller = UsersController.new
8   - @request = ActionController::TestRequest.new
9   - @response = ActionController::TestResponse.new
10 8  
11 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 4  
5 5 def setup
6 6 @controller = AccessControlTestController.new
7   - @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
9 7 end
10 8  
11 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 54 class ActionTrackerTest < ActiveSupport::TestCase
55 55  
56 56 def setup
  57 + @controller = ThingsController.new
  58 +
57 59 ActionTrackerConfig.current_user = proc{ SomeModel.first || SomeModel.create! }
58 60 ActionTracker::Record.delete_all
59 61 ActionTrackerConfig.verbs = { :some_verb => { :description => "Did something" } }
60   - @request = ActionController::TestRequest.new
61   - @response = ActionController::TestResponse.new
62   - @controller = ThingsController.new
63 62 end
64 63  
65 64 def test_index
... ...