i have the following step definition:
When /^I upload it$/ do
end
which relates to a file upload. the visit method in capybara, from what i can tell is a GET only method .. and the only way to do a POST request is by implementation:
visit "/files/new"
within('#upload-form') do
attach_file('File', @files_path+'/file.txt')
click_button('Upload')
end
this doesnt seem a very strong test, as its dependant on the HTML and form tags within the files/new template.
is there a better way to handle this, or is this OK to do? i had in mind something like this:
post files_new_path { file: => 'a_file_on_the_system.txt' }
but then again cucumber tests are integration tests .. so which is the 'official' or best way to write tests at this level?