Redmine のプラグインのユニットテストのために、fixture を追加した。
$REDMINE/plugins/my_plugin/test/fixtures/my_models.yml
という形でテストデータを追加し、bundle exec rake redmine:plugins:test RAILS_ENV=test
を実行したらエラーになった。
Errno::ENOENT: No such file or directory - /Users/pinzolo/projects/my_plugin/redmine-2.3.1/test/fixtures/my_models.yml
つまり、プラグインのtest/fixtures
ディレクトリを見ていないということみたいだ。
プラグインの test/fixtures
を見るように設定するなら、$REDMINE/plugins/my_plugin/test/test_helper.rb
に下記を追加すればいいんだけど、こうすると $REDMINE/test/fixtures
を見てくれなくなる。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActiveSupport::TestCase | |
self.fixture_path = File.dirname(__FILE__) + '/fixtures' | |
end |
fixture_path
が配列でもよしなにやってくれるようにパッチを当てたいところだが、fixture_path
が結構ダイレクトに使われているので大変そうなのと、プラグイン側がやることでもなかろうということで、仕方なく $REDMINE/test/fixtures
にコピーする。
fixture を作ったり更新したりする度にコピーするのはめんどいな。