You tried to assign a String or a Pathname to an uploader, for security reasons, this is not allowed.

Problem
You would like to use Carrierwave for file uploads, but you get the following error if you are trying to use factories for running your cucumber scripts:

You tried to assign a String or a Pathname to an uploader, for security reasons, this is not allowed.

That happens if you try to assign inside your factory template, to your file field the path like f.file “path_to_file”

Solution

You would need to slightly modify your factory template to use the file path as follows:

f.file File.open(File.join(Rails.root,"path_to_file"))