Hey again everyone =P
Well, after the mind-melting exercise that was creating custom view_paths, I
then had the lovely task of ensuring that our view tests still passed, as
they were no longer passing due to the change in view_paths (which was
foreseeable). The problem I had however, was trying to then set the
view_path for our view tests. I couldn't come up with another way other than
actually monkey-patching the view_paths for view tests ONLY. I am more than
happy to listen to alternative/better ways of doing this, as I wanted to
avoid a monkeypatch at all costs. For those interested, the code is below.
It sits within the spec_helper.rb file that resides within your spec folder:
if File.dirname(__FILE__) =~ /\/views\//i
module ActionController
class Base
def self.view_paths
@view_paths = [File.join(RAILS_ROOT, 'app', 'views', 'default')]
ActionView::TemplateFinder.process_view_paths(@view_paths)
end
end
end
end
This sets the view_paths array to our default "theme", and ensures that all
view_tests load views from that location. I cringe at how I've done this, so
please - anyone who has a better way to do this, let me know! =)
Kirk
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
or Rails Oceania" 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/rails-oceania?hl=en
-~----------~----~----~----~------~----~------~--~---