Merge branch 'feature/rails3' of github.com:opf/openproject into feature/rails3

pull/65/merge
Philipp Tessenow 12 years ago
commit 2770d804fc
  1. 2
      app/controllers/groups_controller.rb
  2. 2
      test/functional/wiki_controller_test.rb
  3. 12
      test/integration/api_test/disabled_rest_api_test.rb
  4. 17
      test/test_helper.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

@ -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"

@ -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

@ -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

Loading…
Cancel
Save