[rspec-devel] [ rspec-Bugs-8897 ] Error when mixing controller spec with/without integrated views and using template system other than rhtml

noreply at rubyforge.org noreply at rubyforge.org
Mon Feb 26 15:50:28 EST 2007


Bugs item #8897, was opened at 26/02/2007 21:50
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=8897&group_id=797

Category: rails plugin
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Jonathan Tron (jonathant)
Assigned to: Nobody (None)
Summary: Error when mixing controller spec with/without integrated views and using template system other than rhtml

Initial Comment:
Whooo what a title !!

The problem is RoR does caching of template/template extension in test mode. So when RSpec stub ActionView methods, to run controller specs in isolation mode, it faint Rails about the presence of a template with an rhtml extension. Now, if you mix, for the same controller, specs in isolation mode and spec with integrated views or even for different controllers which shares some templates AND you use a template system using an extension other than rhtml you're in some trouble.

One solution is to disable caching in environment/test.rb :

config.action_view.cache_template_extensions         = false

An other solution would probably be to do it in Spec::Rails::Runner::ControllerContext only when running with integrated views, but it probably means clearing the cache in some way (stubbing ?).

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=8897&group_id=797


More information about the rspec-devel mailing list