#200 ✓out-of-date
James B. Byrne

webrat 0.4.3 and rails 2.3.2

Reported by James B. Byrne | March 16th, 2009 @ 03:54 PM

I have a webrat test called from a cucumber step definition that passes in R2.2.2 and fails in R2.3.2, but the browser behaviour remains the same in both instances. The error from the test is raised in ActionView::Paths find_template.

The test is this:

visit root_url

The failure is this:

...

  Page load was not successful (Code: 500):
  ...
  <title>Action Controller: Exception caught</title>
  ...
  <Missing template ../../public/hll_terms_and_conditions.html
     in view path app/views</code></pre>


  Extracted source (around line [#18](/projects/10503/tickets/18 "Ticket #18"):
  15:               :id =>; 'link_new_user_session'
  16:   -%>
  17:   <br/>
  18:   <%= render :file =>

'../../public/hll_terms_and_conditions.html' ->

  19:
  20: <% else ->
  21:
  ...

I suspect this is a webrat problem because webrat is logging it in tmp. I also suspect that it has something to do with giving a relative path from the project root to a static resource.

Comments and changes to this ticket

  • James B. Byrne

    James B. Byrne March 17th, 2009 @ 09:37 AM

    I tried a few more things, none of which worked, but I did see this.

    If I change the render code to this:

    
     puts "#{`pwd`.gsub!(/\n/,'')}"
    render :file => "#{`pwd`.gsub!(/\n/,'')}\/public\/hll_terms_and_conditions.html" 
    

    then the results are this:

    
    /home/byrnejb/Software/Development/Projects/proforma.git
    ...
          Page load was not successful (Code: 500):
    ...    
          <h1>
            ActionView::MissingTemplate in
            Welcome#index
          </h1>
          
          <p>
            Showing <i>app/views/welcome/index.html.erb</i> where line <b>#40</b> raised:
            <pre><code>Missing template ../../public/hll_authorisation_notice.html in view path app/views</code></pre>
          </p>
          
          <p>Extracted source (around line <b>#40</b>):
          <pre><code>37:   
          38: &lt;% end -%&gt;
          39: 
          40: &lt;%= render :file =&gt; '../../public/hll_authorisation_notice.html' -%&gt;
    ...
    

    There seems to be some munging of the render path going on behind the scenes somewhere. As I pointed out in my initial report, this error does not occur in the browser. The application runs without error in both 2.2 and 2.3. It is just in this test that the problem happens.

  • James B. Byrne

    James B. Byrne March 17th, 2009 @ 09:51 AM

    I discover that I misread the second error message and overlooked that the error had migrated to a different render statement. I have rewritten all the renders to use an absolute path and now these tests pass in both R2.2.2 and R2.3.2.

    However, it strikes me as problematic that one must specify a system specific absolute path in application code only to have a test pass.

  • James B. Byrne

    James B. Byrne March 17th, 2009 @ 10:20 AM

    • Title changed from “webrat 0.4.2 and rails 2.3.2” to “webrat 0.4.3 and rails 2.3.2”

    Problem remains in 0.4.3

  • James B. Byrne

    James B. Byrne March 17th, 2009 @ 10:43 AM

    I handled this in production by using "#{RAILS_ROOT}" as a prefix to all of the static paths. I read that providing an absolute path to files is the recommended procedure in any case. However, the fact remains that code which runs in production fails in webrat.

  • Bryan Helmkamp

    Bryan Helmkamp March 17th, 2009 @ 10:57 AM

    James -- Can you please try hitting the URL with Rails' #get_via_redirect method instead of Webrat's #visit and let me know what you see?

    Thanks,

    -Bryan

  • gaffo

    gaffo May 7th, 2009 @ 05:18 PM

    • Tag changed from bug, verify, visit to bug, stale, verify, visit
    • State changed from “new” to “open”

    I'm also noticing that you have several odd close tags for erb like => and ->

  • gaffo

    gaffo June 3rd, 2009 @ 10:37 AM

    • State changed from “open” to “out-of-date”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket

Attachments

Pages