Dragonflyで画像ファイルを管理しているのですが、test方法のメモです。 テスト環境は Rspec + FactoryGirl ですが、Unit testとFixtureでも同じだと思います。 Dragonflyはtest時以下ディレクトリからファイルを探します public\system\dragonfly\test\YYYY\MM 登録しようとする画像ファイル名が"IMG_0001.jpg"だとすると、Dragonflyの生成するuidはYYYY/MM/DD_HH_MM_SS_MLS_IMG_0001.jpgになるので、上記ディレクトリに "DD_HH_MM_SS_MLS_IMG_0001.jpg"という名前で画像ファイルを置けばよいです。 photo_spec.rbはこんな感じです。 # -*- coding: utf-8 -*- require 'spec_helper'