Rails 3 test fixtures with carrierwave?

前端 未结 6 1118
轻奢々
轻奢々 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:42

    config/initializers/carrier_wave.rb

    In Rails 4

    # class NullStorage is defined here before the following block
    
    if Rails.env.test?
      CarrierWave.configure do |config|
        config.storage NullStorage
      end
    end
    

    & in fixtures:

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

提交回复
热议问题