# Cucumber and Routing

**URL:** <https://www.ruby-forum.com/t/cucumber-and-routing/175615>\
**Category:** Rails\
**Created:** [September 16, 2009, 3:48pm UTC](https://www.ruby-forum.com/t/cucumber-and-routing/175615 "2009-09-16T15:48:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DVG](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@DVG](https://www.ruby-forum.com/u/DVG)\
**Post date:** [September 16, 2009, 3:48pm UTC](https://www.ruby-forum.com/t/cucumber-and-routing/175615/1 "2009-09-16T15:48:54Z")

</div>

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:  
[http://upstream-berlin.com/2009/02/14/testing-pdfs-with-cucumber-and-rails/](http://upstream-berlin.com/2009/02/14/testing-pdfs-with-cucumber-and-rails/)

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/  
webrat\_steps.rb:117  
No route matches “/files/TestPDF.pdf” with {:method=\>:get}  
(ActionController::RoutingError)  
(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|  
click\_link(link)  
#temp\_pdf = Tempfile.new(‘pdf’)  
#temp\_pdf \<\< response.body  
#temp\_pdf.close  
#temp\_txt = Tempfile.new(‘txt’)  
#temp\_txt.close  
#‘pdftotext -q #{temp\_pdf.path} #{temp\_txt.path}’  
#response.body = File.read temp\_txt.path  
end
