我正试着通过神殿来测试上传。我有Minio,并遵循了本教程https://shrinerb.com/docs/testing#test-data
然而,FactoryBot.lint从链接中提供的TestModule代码返回以下错误:
profilepic - undefined method `set_derivatives' for #<Shrine::Attacher:0x000055ee893dfe00 @file=#<Shrine::UploadedFile storage=:store id="8aa14e79342fde0077fd48f1035f56c3" metadata={"size"=>576152, "mime_type"=>"image/jpeg", "filename"=>"profile_pic.jpg"}>, @cache=:cache, @store=:store, @context={}, @previous=nil, @column_serializer=Shrine::Plugins::Column::JsonSerializer, @model_cache=true, @model=nil, @destroy_block=nil, @promote_block=nil, @errors=[]> (NoMethodError)
# /home/maxence/.rvm/gems/ruby-3.0.3/gems/factory_bot-6.2.1/lib/factory_bot/linter.rb:13:in `lint!'
# /home/maxence/.rvm/gems/ruby-3.0.3/gems/factory_bot-6.2.1/lib/factory_bot.rb:70:in `lint'
# ./spec/support/factory_bot.rb:7:in `block (2 levels) in <top (required)>'你知道怎么回事吗?
发布于 2022-04-10 22:15:50
从错误的角度看,derivatives插件似乎没有加载。https://shrinerb.com/docs/plugins/derivatives
将此添加到测试模块中
Shrine.plugin :derivativeshttps://stackoverflow.com/questions/71819584
复制相似问题