<br><br><div><span class="gmail_quote">On 7/16/07, <b class="gmail_sendername">David Chelimsky</b> &lt;<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 7/15/07, Daniel N &lt;<a href="mailto:has.sox@gmail.com">has.sox@gmail.com</a>&gt; wrote:<br>&gt;<br>&gt;<br>&gt;<br>&gt; On 7/16/07, Daniel N &lt;<a href="mailto:has.sox@gmail.com">has.sox@gmail.com</a>&gt; wrote:<br>
&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; On 7/15/07, David Chelimsky &lt; <a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>&gt; wrote:<br>&gt; &gt; &gt; On 7/14/07, Daniel N &lt;<a href="mailto:has.sox@gmail.com">
has.sox@gmail.com</a>&gt; wrote:<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; On 7/15/07, David Chelimsky &lt; <a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>&gt; wrote:<br>&gt; &gt; &gt; &gt; &gt; On 7/14/07, Daniel N &lt;
<a href="mailto:has.sox@gmail.com">has.sox@gmail.com</a>&gt; wrote:<br>&gt; &gt; &gt; &gt; &gt; &gt; Hi,<br>&gt; &gt; &gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; &gt; &gt; I&#39;ve just started to try and spec my application.html.erb
 layout<br>&gt; as one<br>&gt; &gt; &gt; &gt; of<br>&gt; &gt; &gt; &gt; &gt; &gt; the view specs but it totally barfs.<br>&gt; &gt; &gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; &gt; &gt; I&#39;m guessing that it&#39;s due to the yield statements in the layout.
<br>&gt; &gt; &gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; &gt; &gt; Any clues as to how to proceed?<br>&gt; &gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; &gt; Backtrace please? Could be any number of things.<br>&gt; &gt; &gt; &gt; &gt;
<br>&gt; &gt; &gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Sorry,&nbsp;&nbsp;here it is<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; ......rake aborted!<br>&gt; &gt; &gt; &gt; Command ruby<br>&gt; &gt; &gt; &gt;
<br>&gt; -I&quot;/Users/dneighman/Documents/Projects/rails_projects/update_to_clippings/vendor/plugins/rspec/lib&quot;<br>&gt; &gt; &gt; &gt;<br>&gt; &quot;/Users/dneighman/Documents/Projects/rails_projects/update_to_clippings/vendor/plugins/rspec/bin/spec&quot;
<br>&gt; &gt; &gt; &gt; &quot;spec/controllers/books_controller_spec.rb&quot;<br>&gt; &gt; &gt; &gt; &quot;spec/controllers/sessions_controller_spec.rb&quot;<br>&gt; &gt; &gt; &gt; &quot;spec/controllers/users_controller_spec.rb&quot;
<br>&gt; &gt; &gt; &gt; &quot;spec/helpers/books_helper_spec.rb&quot;<br>&gt; &gt; &gt; &gt; &quot;spec/helpers/sessions_helper_spec.rb&quot;<br>&gt; &gt; &gt; &gt; &quot;spec/helpers/users_helper_spec.rb&quot;<br>&gt; &gt; &gt; &gt; &quot;spec/models/book_spec.rb&quot;
<br>&gt; &gt; &gt; &gt; &quot;spec/models/user_notifier_spec.rb&quot;<br>&gt; &gt; &gt; &gt; &quot;spec/models/user_spec.rb&quot;<br>&gt; &gt; &gt; &gt; &quot;spec/views/books/_detail.html.erb_spec.rb&quot;<br>&gt; &gt; &gt; &gt; &quot;spec/views/books/edit.html.erb_spec.rb&quot;
<br>&gt; &gt; &gt; &gt; &quot;spec/views/books/index.html.erb_spec.rb&quot;<br>&gt; &gt; &gt; &gt; &quot;spec/views/books/new.html.erb_spec.rb&quot;<br>&gt; &gt; &gt; &gt; &quot;spec/views/books/new_rjs.html.erb_spec.rb&quot;
<br>&gt; &gt; &gt; &gt; &quot;spec/views/books/rjs_index.html.erb_spec.rb&quot;<br>&gt; &gt; &gt; &gt; &quot;spec/views/books/show.html.erb_spec.rb&quot;<br>&gt; &gt; &gt; &gt; &quot;spec/views/layouts/application.html.erb_spec.rb&quot;
<br>&gt; --options<br>&gt; &gt; &gt; &gt;<br>&gt; &quot;/Users/dneighman/Documents/Projects/rails_projects/update_to_clippings/spec/spec.opts&quot;<br>&gt; &gt; &gt; &gt; failed<br>&gt; &gt; &gt; &gt;<br>&gt; /Users/dneighman/Documents/Projects/rails_projects/update_to_clippings/vendor/plugins/rspec/lib/spec/rake/spectask.rb:166:in
<br>&gt; &gt; &gt; &gt; `define&#39;<br>&gt; &gt; &gt; &gt; /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3<br>&gt; /lib/rake.rb:823:in<br>&gt; &gt; &gt; &gt; `verbose&#39;<br>&gt; &gt; &gt; &gt;<br>&gt; /Users/dneighman/Documents/Projects/rails_projects/update_to_clippings/vendor/plugins/rspec/lib/spec/rake/spectask.rb:138:in
<br>&gt; &gt; &gt; &gt; `define&#39;<br>&gt; &gt; &gt; &gt; /usr/local/lib/ruby/gems/1.8/gems/rake-<br>&gt; 0.7.3/lib/rake.rb:392:in<br>&gt; &gt; &gt; &gt; `call&#39;<br>&gt; &gt; &gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/rake-
0.7.3/lib/rake.rb:392:in<br>&gt; &gt; &gt; &gt; `execute&#39;<br>&gt; &gt; &gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in<br>&gt; &gt; &gt; &gt; `each&#39;<br>&gt; &gt; &gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/rake-
0.7.3/lib/rake.rb:392:in<br>&gt; &gt; &gt; &gt; `execute&#39;<br>&gt; &gt; &gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in<br>&gt; &gt; &gt; &gt; `invoke&#39;<br>&gt; &gt; &gt; &gt; /usr/local/lib/ruby/gems/1.8/gems/rake-
<br>&gt; 0.7.3/lib/rake.rb:355:in<br>&gt; &gt; &gt; &gt; `synchronize&#39;<br>&gt; &gt; &gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in<br>&gt; &gt; &gt; &gt; `invoke&#39;<br>&gt; &gt; &gt; &gt;
<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in<br>&gt; &gt; &gt; &gt; `top_level&#39;<br>&gt; &gt; &gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in<br>&gt; &gt; &gt; &gt; `each&#39;
<br>&gt; &gt; &gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in<br>&gt; &gt; &gt; &gt; `top_level&#39;<br>&gt; &gt; &gt; &gt; /usr/local/lib/ruby/gems/1.8/gems/rake-<br>&gt; 0.7.3/lib/rake.rb:1761:in
<br>&gt; &gt; &gt; &gt; `standard_exception_handling&#39;<br>&gt; &gt; &gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1733:in<br>&gt; &gt; &gt; &gt; `top_level&#39;<br>&gt; &gt; &gt; &gt; /usr/local/lib/ruby/gems/1.8/gems/rake-
<br>&gt; &gt; &gt; &gt; 0.7.3/lib/rake.rb:1711:in `run&#39;<br>&gt; &gt; &gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in<br>&gt; &gt; &gt; &gt; `standard_exception_handling&#39;<br>&gt; &gt; &gt; &gt;
<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1708:in<br>&gt; &gt; &gt; &gt; `run&#39;<br>&gt; &gt; &gt; &gt; /usr/local/lib/ruby/gems/1.8/gems/rake-<br>&gt; 0.7.3/bin/rake:7<br>&gt; &gt; &gt; &gt; /usr/local/bin/rake:16:in `load&#39;
<br>&gt; &gt; &gt; &gt; /usr/local/bin/rake:16<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; And the test is<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; require File.dirname (__FILE__) + &#39;/../../spec_helper&#39;<br>
&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; describe &quot;/layouts/application.html.erb&quot; do<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp; it &quot;should render&quot; do<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; render &quot;/layouts/application.html.erb&quot;
<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp; end<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; end<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Thanks. Unfortunately there&#39;s nothing in that backtrace that talks<br>&gt; &gt; &gt; about 
application.html.erb. Would you please run this command and post<br>&gt; &gt; &gt; the result?<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; script/spec spec/views/layouts/application.html.erb -b<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Thanks,
<br>&gt; &gt; &gt; David<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; Hi David,<br>&gt; &gt;<br>&gt; &gt; Very strange indeed.&nbsp;&nbsp;I had to change the command to<br>&gt; &gt; script/spec<br>&gt; spec/views/layouts/application.html.erb_spec.rb -b
<br>&gt; &gt;<br>&gt; &gt; When I run this I get no errors at all.&nbsp;&nbsp;But I also get no output at all.<br>&gt; &gt;<br>&gt; &gt; When I run the focused example in Textmate it passes but there is no<br>&gt; listing of the example in the output.&nbsp;&nbsp;This is the same as running the
<br>&gt; Behaviour Description<br>&gt; &gt;<br>&gt; &gt; It also does not seem to fail anything.&nbsp;&nbsp;I ran the following<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; &gt;&nbsp;&nbsp; def do_render<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; render &quot;/layouts/application.html.erb&quot;
<br>&gt; &gt; &gt;&nbsp;&nbsp; end<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;&nbsp;&nbsp; it &quot;should render the template&quot; do<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; do_render<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; response.should have_tag(&quot;not_there_tag&quot;)<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; flunk
<br>&gt; &gt; &gt;&nbsp;&nbsp; end<br>&gt; &gt;<br>&gt; &gt; This seems to pass everything.&nbsp;&nbsp;But when I run it with<br>&gt; &gt; rake spec I get the same error as before<br>&gt; &gt;<br>&gt; &gt; In an attempt to see if it is running the template at all I put a dodgy
<br>&gt; method call in the template to try to crash it.&nbsp;&nbsp;It crashes.<br>&gt; &gt;<br>&gt; &gt; Here&#39;s the stack trace<br>&gt; &gt;<br>&gt; &gt; ActionView::TemplateError in &#39;/layouts/application.html.erb should render
<br>&gt; the template&#39;<br>&gt; &gt; undefined local variable or method `bad_method&#39; for<br>&gt; #&lt;#&lt;Class:0x3344718&gt;:0x33446f0&gt;<br>&gt; &gt; On line #14 of app/views/layouts/application.html.erb<br>&gt; &gt;
<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; 11:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;%= javascript_include_tag :defaults, &#39;lowpro&#39; -%&gt;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; 12:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;%= stylesheet_link_tag &#39;common&#39; -%&gt;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; 13:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;%= resource_on_demand %&gt;
<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; 14:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;%= bad_method %&gt;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; 15:<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; 16: &lt;/head&gt;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; 17:<br>&gt; &gt;<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/app/views//layouts/application.html.erb:14:in
<br>&gt; `_run_erb_47app47views47layouts47application46html46erb&#39;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-<br>&gt; 1.13.3.6752/lib/action_view/base.rb:346:in `send&#39;<br>&gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/actionpack-
1.13.3.6752/lib/action_view/base.rb:346:in<br>&gt; `compile_and_render_template&#39;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-<br>&gt; 1.13.3.6752/lib/action_view/base.rb:322:in `render_template_old&#39;
<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/stable/lib/haml/template.rb:96:in<br>&gt; `render_template&#39;<br>&gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3.6752<br>&gt; /lib/action_view/base.rb:282:in `render_file&#39;
<br>&gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3.6752/lib/action_controller/base.rb:854:in<br>&gt; `render_file&#39;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-<br>&gt; 1.13.3.6752
/lib/action_controller/base.rb:789:in<br>&gt; `render_with_no_layout&#39;<br>&gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3.6752/lib/action_controller/layout.rb:258:in<br>&gt; `render_without_benchmark&#39;
<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-<br>&gt; 1.13.3.6752/lib/action_controller/benchmarking.rb:51:in<br>&gt; `render&#39;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure&#39;
<br>&gt; &gt;<br>&gt; /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3.6752/lib/action_controller/benchmarking.rb:51:in<br>&gt; `render&#39;<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/behaviour/view.rb:55:in
<br>&gt; `send&#39;<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/behaviour/view.rb:55:in<br>&gt; `render&#39;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; spec/views/layouts/application.html.erb_spec.rb:6:in<br>
&gt; `do_render&#39;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; spec/views/layouts/application.html.erb_spec.rb:10<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec/lib/spec/dsl/example.rb:81:in<br>&gt; `instance_eval&#39;<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec/lib/spec/dsl/example.rb:81:in
<br>&gt; `run_example&#39;<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec/lib/spec/dsl/example.rb:26:in<br>&gt; `run&#39;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/1.8/timeout.rb:48:in `timeout&#39;<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec/lib/spec/dsl/example.rb:24:in
<br>&gt; `run&#39;<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec/lib/spec/dsl/behaviour.rb:80:in<br>&gt; `run&#39;<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec/lib/spec/dsl/behaviour.rb:74:in<br>&gt; `each&#39;
<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec/lib/spec/dsl/behaviour.rb:74:in<br>&gt; `run&#39;<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:58:in<br>&gt; `run_behaviours&#39;
<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:57:in<br>&gt; `each&#39;<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:57:in<br>&gt; `run_behaviours&#39;
<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:21:in<br>&gt; `run&#39;<br>&gt; &gt;<br>&gt; #{RAILS_ROOT}/vendor/plugins/rspec/lib/spec/runner/command_line.rb:17:in<br>&gt; `run&#39;
<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; script/spec:4<br>&gt; &gt;<br>&gt; &gt; I&#39;ve changed to a haml template, and used the same spec but with a<br>&gt; different file (.haml) to render and it ran fine.&nbsp;&nbsp;Passes everything with<br>&gt; complete listings etc.
<br>&gt; &gt;<br>&gt; &gt; I really don&#39;t know what to make of it.<br>&gt; &gt;<br>&gt; &gt; Cheers<br>&gt; &gt; Daniel<br>&gt;<br>&gt;<br>&gt; David,<br>&gt;<br>&gt; Thankyou for being so patient.&nbsp;&nbsp;I&#39;ve discovered the issue.&nbsp;&nbsp;I&#39;m basically
<br>&gt; re-writing my app as I port it over to specs from a nasty mix of units and<br>&gt; various plugins.<br>&gt;<br>&gt; During the move I&#39;ve started to test the application layout where it tries<br>&gt; to render a parital that I haven&#39;t got yet.
<br>&gt;<br>&gt; Once I take the render :partial call out for the non existing partial,<br>&gt; everything went back to normal.<br>&gt;<br>&gt; I hope I haven&#39;t wasted too much of your time.&nbsp;&nbsp;I&#39;m really sorry.<br>
<br>No worries Daniel - when I don&#39;t have the time I don&#39;t deal w/ this stuff :)<br><br>Cheers,<br>David<br><br>&gt;<br>&gt; Cheers<br>&gt; Daniel<br>&gt;<br>&gt;<br>&gt;</blockquote><div><br><br>David,<br><br>I&#39;ve gone through quite a few templates in haml now with specs and they all seem to work fine.&nbsp; I&#39;m on edge rails.&nbsp; Don&#39;t know if that makes a difference.
<br><br>Cheers<br>Daniel<br></div><br></div><br>