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/

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:
<h1>Listing PDFs</h1>

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

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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to