From 94d22d696cc2bdfc67c45eacd0816f18ab6b06a1 Mon Sep 17 00:00:00 2001 From: Michael Frister Date: Mon, 8 Apr 2013 09:29:07 +0200 Subject: [PATCH 1/2] Fix GroupsController show --- app/controllers/groups_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 93d6fd802b..98bef21185 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -16,7 +16,7 @@ class GroupsController < ApplicationController layout 'admin' before_filter :require_admin - before_filter :find_group, :only => [:destroy, :autocomplete_for_user] + before_filter :find_group, :only => [:destroy, :autocomplete_for_user, :show] # GET /groups From 0a942d7f641951cc701ff11b7c95f68bc71c2e51 Mon Sep 17 00:00:00 2001 From: Michael Frister Date: Mon, 8 Apr 2013 10:46:54 +0200 Subject: [PATCH 2/2] Fix respond_with_content_type deprecation warning --- test/functional/wiki_controller_test.rb | 2 +- .../api_test/disabled_rest_api_test.rb | 12 ++++++------ test/test_helper.rb | 17 +++++++++++------ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 95199157e7..a545143142 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -397,7 +397,7 @@ class WikiControllerTest < ActionController::TestCase should respond_with :success should assign_to :pages - should respond_with_content_type "text/html" + should_respond_with_content_type "text/html" should "export all of the wiki pages to a single html file" do assert_select "a[name=?]", "CookBook_documentation" assert_select "a[name=?]", "Another_page" diff --git a/test/integration/api_test/disabled_rest_api_test.rb b/test/integration/api_test/disabled_rest_api_test.rb index 55732423fa..b894a8ba55 100644 --- a/test/integration/api_test/disabled_rest_api_test.rb +++ b/test/integration/api_test/disabled_rest_api_test.rb @@ -39,7 +39,7 @@ class ApiTest::DisabledRestApiTest < ActionDispatch::IntegrationTest end should respond_with :unauthorized - should respond_with_content_type :xml + should_respond_with_content_type "application/xml" should "not login as the user" do assert_equal User.anonymous, User.current end @@ -53,7 +53,7 @@ class ApiTest::DisabledRestApiTest < ActionDispatch::IntegrationTest end should respond_with :unauthorized - should respond_with_content_type :xml + should_respond_with_content_type "application/xml" should "not login as the user" do assert_equal User.anonymous, User.current end @@ -68,7 +68,7 @@ class ApiTest::DisabledRestApiTest < ActionDispatch::IntegrationTest end should respond_with :unauthorized - should respond_with_content_type :xml + should_respond_with_content_type "application/xml" should "not login as the user" do assert_equal User.anonymous, User.current end @@ -84,7 +84,7 @@ class ApiTest::DisabledRestApiTest < ActionDispatch::IntegrationTest end should respond_with :unauthorized - should respond_with_content_type :json + should_respond_with_content_type "application/json" should "not login as the user" do assert_equal User.anonymous, User.current end @@ -98,7 +98,7 @@ class ApiTest::DisabledRestApiTest < ActionDispatch::IntegrationTest end should respond_with :unauthorized - should respond_with_content_type :json + should_respond_with_content_type "application/json" should "not login as the user" do assert_equal User.anonymous, User.current end @@ -113,7 +113,7 @@ class ApiTest::DisabledRestApiTest < ActionDispatch::IntegrationTest end should respond_with :unauthorized - should respond_with_content_type :json + should_respond_with_content_type "application/json" should "not login as the user" do assert_equal User.anonymous, User.current end diff --git a/test/test_helper.rb b/test/test_helper.rb index 75e988a10b..50ee3e728f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -231,6 +231,12 @@ class ActiveSupport::TestCase end end + def self.should_respond_with_content_type(content_type) + should "respond with content type '#{content_type}'" do + assert_equal @response.content_type, content_type + end + end + def credentials(login, password = nil) { 'HTTP_AUTHORIZATION' => ActionController::HttpAuthentication::Basic.encode_credentials(login, password || login) } end @@ -435,22 +441,21 @@ class ActiveSupport::TestCase end end - # Uses should respond_with_content_type based on what's in the url: + # Uses should_respond_with_content_type based on what's in the url: # - # '/project/issues.xml' => should respond_with_content_type :xml - # '/project/issues.json' => should respond_with_content_type :json + # '/project/issues.xml' => should_respond_with_content_type :xml + # '/project/issues.json' => should_respond_with_content_type :json # # @param [String] url Request def self.should_respond_with_content_type_based_on_url(url) case when url.match(/xml/i) - should respond_with_content_type :xml + should_respond_with_content_type 'application/xml' when url.match(/json/i) - should respond_with_content_type :json + should_respond_with_content_type 'application/json' else raise "Unknown content type for should_respond_with_content_type_based_on_url: #{url}" end - end # Uses the url to assert which format the response should be in