jeudi 18 février 2016

Capybara testing issue

I have models Post and Image. Post has_many images

I have this field

<%= f.file_field :image, required: false %>

How to test adding image that is adding by cocoon gem methods with Capybara attach_file method?

attach_file( "file_field", "#{Rails.root}/spec/assets/example.jpg" )

What should I write instead of file_field? What is the name of this field should be? "image" or :image don`t work.

According to Capybara docs: "The file field can be found via its name, id or label text." But none of the above is working.

Aucun commentaire:

Enregistrer un commentaire