def update
@updates ||= params[@object.resource_param_name.to_sym]
+ if @updates.is_a? ActionController::Parameters
+ @updates = @updates.to_unsafe_hash
+ end
@updates.keys.each do |attr|
if @object.send(attr).is_a? Hash
if @updates[attr].is_a? String
if params[:merge] || params["merge_#{attr}".to_sym]
# Merge provided Hash with current Hash, instead of
# replacing.
+ if @updates[attr].is_a? ActionController::Parameters
+ @updates[attr] = @updates[attr].to_unsafe_hash
+ end
@updates[attr] = @object.send(attr).with_indifferent_access.
deep_merge(@updates[attr].with_indifferent_access)
end
end
def human_readable_bytes_html(n)
- return h(n) unless n.is_a? Fixnum
+ return h(n) unless n.is_a? Integer
return "0 bytes" if (n == 0)
orders = {
# network. 100::/64 is the IPv6 discard prefix, so it's perfect.
Rails.configuration.arvados_v1_base = "https://[100::f]:1/"
@controller = NodesController.new
- get(:index, {}, session_for(:active))
+ get(:index, params: {}, session: session_for(:active))
assert_includes(405..422, @response.code.to_i,
"bad response code when API server is unreachable")
ensure
def assert_hash_includes(actual_hash, expected_hash, msg=nil)
expected_hash.each do |key, value|
- assert_equal(value, actual_hash[key], msg)
+ if value.nil?
+ assert_nil(actual_hash[key], msg)
+ else
+ assert_equal(value, actual_hash[key], msg)
+ end
end
end
class JobsControllerTest < ActionController::TestCase
test "visit jobs index page" do
- get :index, {}, session_for(:active)
+ get :index, params: {}, session: session_for(:active)
assert_response :success
end
include Rails.application.routes.url_helpers
test 'Get search dialog' do
- xhr :get, :choose, {
+ get :choose, params: {
format: :js,
title: 'Search',
action_name: 'Show',
action_href: url_for(host: 'localhost', controller: :actions, action: :show),
action_data: {}.to_json,
- }, session_for(:active)
+ }, session: session_for(:active), xhr: true
assert_response :success
end
test 'Get search results for all projects' do
- xhr :get, :choose, {
+ get :choose, params: {
format: :json,
partial: true,
- }, session_for(:active)
+ }, session: session_for(:active), xhr: true
assert_response :success
assert_not_empty(json_response['content'],
'search results for all projects should not be empty')
end
test 'Get search results for empty project' do
- xhr :get, :choose, {
+ get :choose, params: {
format: :json,
partial: true,
project_uuid: api_fixture('groups')['empty_project']['uuid'],
- }, session_for(:active)
+ }, session: session_for(:active), xhr: true
assert_response :success
assert_empty(json_response['content'],
'search results for empty project should be empty')
end
test 'search results for aproject and verify recursive contents' do
- xhr :get, :choose, {
+ get :choose, params: {
format: :json,
partial: true,
project_uuid: api_fixture('groups')['aproject']['uuid'],
- }, session_for(:active)
+ }, session: session_for(:active), xhr: true
assert_response :success
assert_not_empty(json_response['content'],
'search results for aproject should not be empty')
end
def user_can_manage(user_sym, fixture)
- get(:show, {id: fixture["uuid"]}, session_for(user_sym))
+ get(:show, params: {id: fixture["uuid"]}, session: session_for(user_sym))
is_manager = assigns(:user_is_manager)
assert_not_nil(is_manager, "user_is_manager flag not set")
if not is_manager