get :index, :params => { :bbox => "-10,-10,12,12", :format => :json }
assert_response :bad_request
- assert_equal "text/plain", @response.content_type
+ assert_equal "application/json", @response.content_type
get :index, :params => { :l => "-10", :b => "-10", :r => "12", :t => "12", :format => :json }
assert_response :bad_request
- assert_equal "text/plain", @response.content_type
+ assert_equal "application/json", @response.content_type
end
def test_index_closed
# Updating the description should work
user.description = "new description"
+ user.preferred_editor = "default"
post :account, :params => { :display_name => user.display_name, :user => user.attributes }, :session => { :user => user }
assert_response :success
assert_template :account
post :list, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
end
assert_response :redirect
- assert_redirected_to :action => :login, :referer => users_path(:confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 })
+ assert_redirected_to :action => :login, :referer => users_path
assert_equal "pending", inactive_user.reload.status
assert_equal "suspended", suspended_user.reload.status
post :list, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
end
assert_response :redirect
- assert_redirected_to :action => :login, :referer => users_path(:confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 })
+ assert_redirected_to :action => :login, :referer => users_path
assert_equal "pending", inactive_user.reload.status
assert_equal "suspended", suspended_user.reload.status
post :list, :params => { :confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 } }
end
assert_response :redirect
- assert_redirected_to :action => :login, :referer => users_path(:confirm => 1, :user => { inactive_user.id => 1, suspended_user.id => 1 })
+ assert_redirected_to :action => :login, :referer => users_path
assert_equal "pending", inactive_user.reload.status
assert_equal "suspended", suspended_user.reload.status
post :list, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
end
assert_response :redirect
- assert_redirected_to :action => :login, :referer => users_path(:hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 })
+ assert_redirected_to :action => :login, :referer => users_path
assert_equal "active", normal_user.reload.status
assert_equal "confirmed", confirmed_user.reload.status
post :list, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
end
assert_response :redirect
- assert_redirected_to :action => :login, :referer => users_path(:hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 })
+ assert_redirected_to :action => :login, :referer => users_path
assert_equal "active", normal_user.reload.status
assert_equal "confirmed", confirmed_user.reload.status
post :list, :params => { :hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 } }
end
assert_response :redirect
- assert_redirected_to :action => :login, :referer => users_path(:hide => 1, :user => { normal_user.id => 1, confirmed_user.id => 1 })
+ assert_redirected_to :action => :login, :referer => users_path
assert_equal "active", normal_user.reload.status
assert_equal "confirmed", confirmed_user.reload.status
require "test_helper"
class CORSTest < ActionDispatch::IntegrationTest
- # Rails 4 adds a built-in `options` method. When we upgrade, we can remove
- # this definition.
- unless instance_methods.include?(:options)
- def options(*args)
- reset! unless integration_session
- @html_document = nil
- integration_session.send(:process, :options, *args).tap do
- copy_session_variables!
- end
- end
- end
-
def test_api_routes_allow_cross_origin_requests
- options "/api/capabilities", nil,
- "HTTP_ORIGIN" => "http://www.example.com",
- "HTTP_ACCESS_CONTROL_REQUEST_METHOD" => "GET"
+ process :options, "/api/capabilities", :headers => {
+ "HTTP_ORIGIN" => "http://www.example.com",
+ "HTTP_ACCESS_CONTROL_REQUEST_METHOD" => "GET"
+ }
assert_response :success
assert_equal "http://www.example.com", response.headers["Access-Control-Allow-Origin"]
def test_non_api_routes_dont_allow_cross_origin_requests
assert_raises ActionController::RoutingError do
- options "/", nil,
- "HTTP_ORIGIN" => "http://www.example.com",
- "HTTP_ACCESS_CONTROL_REQUEST_METHOD" => "GET"
+ process :options, "/", :headers => {
+ "HTTP_ORIGIN" => "http://www.example.com",
+ "HTTP_ACCESS_CONTROL_REQUEST_METHOD" => "GET"
+ }
end
end
end