Cucumber and Routing

Hi folks,

I’ve made a simple rails app that reads the PDFs contained in /public/
files/, and creates links to those files. I’m doing this for the
purpose of using cucumber to perform automated tests on PDFs as
outlined here:

When I access the list, everything works great. When I ask Cucumber to
click on the link, it complains about there being no route.

When I follow the PDF link “TestPDF” # features/step_definitions/
No route matches “/files/TestPDF.pdf” with {:method=>:get}
(evl):2:in click_link' ./features/step_definitions/webrt_steps.rb:118:in /^I follow
the PDF link “([^"]*)”$/’
features/PDF.feature:8:in `When I follow the PDF link “TestPDF”’

I just have a lists Controller with an empty index action, and the
following view:

Listing PDFs

    <% @files = Dir.glob("public/files/*.pdf") %> <% for file in @files %> <% file.sub!("public", "")%> <% filename = file.sub("/files/", "")%>
  • <%= link_to filename.chomp(".pdf"), file%>
  • <% end %>

My step definition for cucumber looks like this, mostly commented out
When /^I follow the PDF link “([^"]*)”$/ do |link|
#temp_pdf =‘pdf’)
#temp_pdf << response.body
#temp_txt =‘txt’)
#‘pdftotext -q #{temp_pdf.path} #{temp_txt.path}’
#response.body = temp_txt.path