<div dir="ltr">Ian White has just submitted a patch for this.&nbsp; Thanks Ian.&nbsp; <a href="http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/516">http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/516</a><br><br>
Tim.<br><br><div class="gmail_quote">On Wed, Sep 3, 2008 at 10:41 AM, Tim Haines <span dir="ltr">&lt;<a href="mailto:tmhaines@gmail.com">tmhaines@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr">Hi guys,<br><br>After updating to edge rails I&#39;ve just struck this problem too.&nbsp; I&#39;ve just grabbed fresh updates of rspec, rspec-rails, and rails and I&#39;m receiving a few controller spec failures related to view rendering when views shouldn&#39;t be rendered&nbsp; (failures relate to mock objects not having expected attributes and methods).<br>

<br>I&#39;ve logged this in lighthouse -&gt; <a href="http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/516" target="_blank">http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/516</a><br><br>Here&#39;s a copy of the full backtrace of one of the fails:<br>

<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:376:in `raise_named_route_error&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:340:in `generate&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:208:in `rewrite_path&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:187:in `rewrite_url&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:165:in `rewrite&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/base.rb:630:in `url_for&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:85:in `send&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:85:in `url_for&#39;<br>&nbsp;&nbsp;&nbsp; (eval):15:in `user_path&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/polymorphic_routes.rb:111:in `__send__&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/polymorphic_routes.rb:111:in `polymorphic_url&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/polymorphic_routes.rb:118:in `polymorphic_path&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:91:in `url_for&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb:228:in `link_to&#39;<br>&nbsp;&nbsp;&nbsp; app/views/home/index.html.erb:5<br>&nbsp;&nbsp;&nbsp; app/views/home/index.html.erb:4:in `each&#39;<br>&nbsp;&nbsp;&nbsp; app/views/home/index.html.erb:4<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_view/renderable.rb:35:in `send&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_view/renderable.rb:35:in `render&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_view/template.rb:68:in `render_template&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_view/base.rb:266:in `orig_render&#39;<br>&nbsp;&nbsp;&nbsp; vendor/plugins/rspec-rails/lib/spec/rails/extensions/action_view/base.rb:26:in `render&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_view/base.rb:369:in `_render_with_layout&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_view/base.rb:260:in `orig_render&#39;<br>&nbsp;&nbsp;&nbsp; vendor/plugins/rspec-rails/lib/spec/rails/extensions/action_view/base.rb:26:in `render&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/base.rb:1118:in `render_for_file&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/base.rb:881:in `render_without_benchmark&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:8:in `realtime&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render&#39;<br>&nbsp;&nbsp;&nbsp; vendor/plugins/rspec-rails/lib/spec/rails/example/controller_example_group.rb:213:in `render&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/base.rb:853:in `render_without_benchmark&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:8:in `realtime&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/plugins/rspec-rails/lib/spec/rails/example/controller_example_group.rb:213:in `render&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/base.rb:1170:in `default_render&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/base.rb:1176:in `perform_action_without_filters&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue&#39;<br>

&nbsp;&nbsp;&nbsp; /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/rescue.rb:202:in `perform_action_without_caching&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:48:in `cache&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/base.rb:535:in `send&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/base.rb:535:in `process_without_filters&#39;<br>&nbsp;&nbsp;&nbsp; /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/base.rb:535:in `process_without_filters&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process_without_session_management_support&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `process_without_test&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/test_process.rb:18:in `process&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/test_process.rb:400:in `process&#39;<br>&nbsp;&nbsp;&nbsp; vendor/rails/actionpack/lib/action_controller/test_process.rb:371:in `get&#39;<br>

&nbsp;&nbsp;&nbsp; controllers/home_controller_spec.rb:12<br>&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec/example/example_methods.rb:83:in `instance_eval&#39;<br>&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec/example/example_methods.rb:83:in `eval_block&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec/example/example_methods.rb:21:in `execute&#39;<br>&nbsp;&nbsp;&nbsp; /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:48:in `timeout&#39;<br>&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec/example/example_methods.rb:18:in `execute&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:305:in `execute_examples&#39;<br>&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:304:in `each&#39;<br>&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:304:in `execute_examples&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:132:in `run&#39;<br>&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:22:in `run&#39;<br>&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:21:in `each&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:21:in `run&#39;<br>&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec/runner/options.rb:115:in `run_examples&#39;<br>&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec.rb:21:in `run&#39;<br>

&nbsp;&nbsp;&nbsp; vendor/plugins/rspec/lib/spec/runner.rb:192:in `register_at_exit_hook&#39;<br>&nbsp;&nbsp;&nbsp; controllers/home_controller_spec <br><div><div></div><div class="Wj3C7c"><br><div class="gmail_quote">On Sun, Aug 24, 2008 at 8:57 AM, Sven Fuchs <span dir="ltr">&lt;<a href="mailto:svenfuchs@artweb-design.de" target="_blank">svenfuchs@artweb-design.de</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Ok, done.<br>
<br>
<a href="http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/508-recent-changes-in-actionpack-break-controller-specs" target="_blank">http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/508-recent-changes-in-actionpack-break-controller-specs</a><br>


<br>
Thanks!<div><div></div><div><br>
<br>
On 23.08.2008, at 16:28, David Chelimsky wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
There are a number of changes to action pack recently that are<br>
incompatible with rspec. Please report these to lighthouse.<br>
<br>
Thanks,<br>
David<br>
<br>
On Sat, Aug 23, 2008 at 6:12 AM, Sven Fuchs &lt;<a href="mailto:svenfuchs@artweb-design.de" target="_blank">svenfuchs@artweb-design.de</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Trying to port an existing app to current Rails edge I&#39;ve seen similar<br>
things yesterday. I&#39;ve also updated RSpec/Rails to recent edge.<br>
<br>
Here are two workarounds I&#39;ve come up with for two of the problems. I&#39;m not<br>
sure if they cause other problems themselves, but maybe they&#39;re still useful<br>
as a hint.<br>
<br>
<a href="http://pastie.org/private/5ueehxiqhdgok0d8udksa" target="_blank">http://pastie.org/private/5ueehxiqhdgok0d8udksa</a><br>
<br>
I don&#39;t feel familiar enough with RSpec&#39;s guts to provide a patch.<br>
<br>
#render_partial on ActionView::Base seems to break because the method<br>
signature has changed.<br>
#render on ControllerExampleGroup seems to break because #render_file<br>
apparently has been removed.<br>
<br>
<br>
<br>
On 23.08.2008, at 00:30, John Reilly wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<br>
I think I may have found a bug between rspec and edge rails... But I&#39;m<br>
new to this so I&#39;m hoping someone else can confirm before I go filing<br>
bug reports.<br>
<br>
Basically, I&#39;m seeing what &quot;appears&quot; to be my controller specs<br>
deciding to load the views, even though I haven&#39;t called<br>
integrate_views. &nbsp;When I generate a default rspec_scaffold, the specs<br>
fail with an ActionView::TemplateError:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
% script/generate rspec_scaffold Bike name:string sku:string<br>
...<br>
rake spec<br>
...<br>
Mock &#39;Bike_1017&#39; received unexpected message :name with (no args)<br>
On line #11 of app/views/index.html.erb<br>
</blockquote>
<br>
If I modify the generated index spec like this, the spec passes:<br>
<br>
...snip...<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
it &quot;should expose all bikes as @bikes&quot; do<br>
Bike.should_receive(:find).with(:all).and_return([mock_bike])<br>
<br>
# adding these lines cause the spec to pass...<br>
mock_bike.should_receive(:name)<br>
mock_bike.should_receive(:sku)<br>
<br>
get :index<br>
assigns[:bikes].should == [mock_bike]<br>
end<br>
</blockquote>
<br>
...snip...<br>
<br>
While this &quot;fixes&quot; the failures, it&#39;s no longer an isolated test of<br>
the controller.<br>
<br>
After spending some time with git-bisect, it looks like this problem<br>
was introduced in a commit to edge rails:<br>
<br>
<a href="http://github.com/rails/rails/commit/1129a24caff9f1804c2bff6569c0cbd8598dfa86" target="_blank">http://github.com/rails/rails/commit/1129a24caff9f1804c2bff6569c0cbd8598dfa86</a><br>
<br>
The default rspec_scaffold tests pass before this commit, and fail<br>
after this commit.<br>
<br>
More details here:<br>
<a href="http://johnreilly.tumblr.com/post/47016047/rspec-is-mocking-me" target="_blank">http://johnreilly.tumblr.com/post/47016047/rspec-is-mocking-me</a><br>
<br>
Am I insane? Or does this happen for anyone else? :-)<br>
<br>
Thanks,<br>
-- John Reilly<br>
<br>
_______________________________________________<br>
rspec-users mailing list<br>
<a href="mailto:rspec-users@rubyforge.org" target="_blank">rspec-users@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
</blockquote>
<br>
--<br>
sven fuchs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="mailto:svenfuchs@artweb-design.de" target="_blank">svenfuchs@artweb-design.de</a><br>
artweb design &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.artweb-design.de" target="_blank">http://www.artweb-design.de</a><br>
grünberger 65 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + 49 (0) 30 - 47 98 69 96 (phone)<br>
d-10245 berlin &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ 49 (0) 171 - 35 20 38 4 (mobile)<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
rspec-users mailing list<br>
<a href="mailto:rspec-users@rubyforge.org" target="_blank">rspec-users@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
<br>
</blockquote>
_______________________________________________<br>
rspec-users mailing list<br>
<a href="mailto:rspec-users@rubyforge.org" target="_blank">rspec-users@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
</blockquote>
<br>
--<br>
sven fuchs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="mailto:svenfuchs@artweb-design.de" target="_blank">svenfuchs@artweb-design.de</a><br>
artweb design &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.artweb-design.de" target="_blank">http://www.artweb-design.de</a><br>
grünberger 65 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + 49 (0) 30 - 47 98 69 96 (phone)<br>
d-10245 berlin &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ 49 (0) 171 - 35 20 38 4 (mobile)<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
rspec-users mailing list<br>
<a href="mailto:rspec-users@rubyforge.org" target="_blank">rspec-users@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div>