From 855de1a7004a6cb87b7f637b2e94edda5f3e4e56 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 6 Sep 2019 18:50:14 +0900 Subject: [PATCH] Fix mocking test to mock kwargs --- activestorage/test/models/attached/one_test.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/activestorage/test/models/attached/one_test.rb b/activestorage/test/models/attached/one_test.rb index a4ab15750d..5a68e65d9b 100644 --- a/activestorage/test/models/attached/one_test.rb +++ b/activestorage/test/models/attached/one_test.rb @@ -42,7 +42,7 @@ class ActiveStorage::OneAttachedTest < ActiveSupport::TestCase test "attaching a new blob from a Hash to an existing record passes record" do hash = { io: StringIO.new("STUFF"), filename: "town.jpg", content_type: "image/jpg" } - blob = ActiveStorage::Blob.build_after_unfurling(hash) + blob = ActiveStorage::Blob.build_after_unfurling(**hash) arguments = [hash.merge(record: @user)] assert_called_with(ActiveStorage::Blob, :build_after_unfurling, arguments, returns: blob) do @user.avatar.attach hash @@ -59,9 +59,9 @@ class ActiveStorage::OneAttachedTest < ActiveSupport::TestCase def upload.open @io ||= StringIO.new("") end - arguments = [io: upload.open, filename: upload.original_filename, content_type: upload.content_type, record: @user] - blob = ActiveStorage::Blob.build_after_unfurling(*arguments) - assert_called_with(ActiveStorage::Blob, :build_after_unfurling, arguments, returns: blob) do + arguments = { io: upload.open, filename: upload.original_filename, content_type: upload.content_type, record: @user } + blob = ActiveStorage::Blob.build_after_unfurling(**arguments) + assert_called_with(ActiveStorage::Blob, :build_after_unfurling, [arguments], returns: blob) do @user.avatar.attach upload end end