Rails 3 test fixtures with carrierwave?

前端 未结 6 1027
轻奢々
轻奢々 2021-02-05 09:02

I\'m working on upgrading from attachment_fu to carrierwave, since attachment_fu is broken in rails 3.

None of the tests are able to run, because we have invalid fixture

6条回答
  •  情深已故
    2021-02-05 09:29

    Try passing a file instead of a String.

    a_image:
        post_id: 1
        attachment_file: File.open(Rails.root.join("test/files/test.png"))
    

    This works for me using FactoryGirl

    Note: Edit thanks to @dkobozev

提交回复
热议问题