0

DragonFly gemを使用して添付ファイルを処理するフォーム ページの仕様を書いています。これが私の仕様です (関連部分)。

fill_in "Subject", :with => 'My message'
fill_in "Title", :with => 'My image title'
fill_in "Content", :with => 'Message content'
attach_file 'Title image', Rails.root.join('spec', 'factories', 'test-image.png')
click_button "Create Message"
page.should have_content("Message was successfully created.")

ただしclick_button、次のエラーでステップで失敗します

Failure/Error: click_button "Create Message"
     ArgumentError:
       Dragonfly::TempObject must be initialized with a String, a Pathname, a File, a Tempfile, another TempObject, something that responds to .tempfile, or something that responds to .path

このエラーを追跡したところ、この行で発生していることがわかりました。その行の前にいくつかのデバッグ命令を置いたところ、画像のバイナリ データを含むことobjがわかりました。Arrayp obj.inspect

"[\"\\x89PNG\\r\\n\", \"\\u001A\\n\", \"\\u0000\\u0000\\u0000\\rIHDR\\u0000\\u0000\\u0003s\

私が間違っていることは何ですか?それは私のせいですか、それともカピバラとトンボとの非互換性がありますか?

PS実際のブラウザを使用してアプリケーションにアクセスすると、魅力的に機能します。

4

1 に答える 1

0

古いバージョンのカピバラを使用していましたが、バージョン 1.1.2 に更新したところbundle update capybara、問題はなくなりました。

于 2011-11-21T18:38:27.830 に答える