X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/370366c748b22f5c230bf11e209a190612c088e7..9b6b5f0bd2ad96deeea2070a4eba56795bb28c1a:/services/api/test/unit/log_test.rb diff --git a/services/api/test/unit/log_test.rb b/services/api/test/unit/log_test.rb index 0c85d4c6e4..d6b76fc605 100644 --- a/services/api/test/unit/log_test.rb +++ b/services/api/test/unit/log_test.rb @@ -94,6 +94,20 @@ class LogTest < ActiveSupport::TestCase end end + test "old_attributes preserves values deep inside a hash" do + set_user_from_auth :active + it = specimens(:owned_by_active_user) + it.properties = {'foo' => {'bar' => ['baz', 'qux', {'quux' => 'bleat'}]}} + it.save! + @log_count += 1 + it.properties['foo']['bar'][2]['quux'] = 'blert' + it.save! + assert_logged it, :update do |props| + assert_equal 'bleat', props['old_attributes']['properties']['foo']['bar'][2]['quux'] + assert_equal 'blert', props['new_attributes']['properties']['foo']['bar'][2]['quux'] + end + end + test "destroying an authorization makes a log" do set_user_from_auth :admin_trustedclient auth = api_client_authorizations(:spectator)