Я пытаюсь проверить загрузку изображений с помощью carrierwave. Я следую этому уроку.
https://jeffkreeftmeijer.com/carrierwave-rails-test-fixtures/ но получаю ошибки.
Модели / product_test.rb
require './test/test_helper'
class ProductTest < ActiveSupport::TestCase
test "has an avatar" do
product = products(:one)
assert File.exists?(product.pictures.file.path)
end
test "uploads an avatar" do
product = Product.create!(:pictures,
fixture_file_upload('/files/cat_1.jpg', 'image/jpg'))
assert(File.exists?(product.reload.pictures.file.path))
end
end
светильники / product.yml
id: 1
title: shirt
exhibited_at: <%= Time.now %>
description: MyString
pictures: 'cat_1.jpg'
модель / product.rb
mount_uploaders :pictures, PictureUploader
сообщение об ошибке
E
Error:
ProductTest#test_has_an_avatar:
ArgumentError: wrong number of arguments (given 2, expected 0)
/var/lib/gems/2.3.0/gems/carrierwave-
1.2.3/lib/carrierwave/mount.rb:448:in `initialize'
/var/lib/gems/2.3.0/gems/carrierwave-
1.2.3/lib/carrierwave/mount.rb:448:in `new'
/var/lib/gems/2.3.0/gems/carrierwave-
1.2.3/lib/carrierwave/mount.rb:448:in `_mounter'
/var/lib/gems/2.3.0/gems/carrierwave-
1.2.3/lib/carrierwave/mount.rb:296:in `pictures'
/var/lib/gems/2.3.0/gems/carrierwave-
1.2.3/lib/carrierwave/mount.rb:366:in `pictures'
bin/rails test test/models/product_test.rb:19
E
Error:
ProductTest#test_uploads_an_avatar:
NoMethodError: undefined method `fixture_file_upload' for #
<ProductTest:0x00000006ae2468>
Did you mean? fixture_path
bin/rails test test/models/product_test.rb:25