mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix mocking test to mock kwargs
This commit is contained in:
parent
dea19d4ead
commit
855de1a700
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue