Philip Hallstrom
2007-Oct-06 02:13 UTC
Pointers/Help for testing action_view based plugins?
Hi all - Writing my first plugin that overwrites stylesheet_link_tag. In trying to be good I even borrowed the tests for the original method and put them into my plugin''s testing code. But to make it all work I ended up having to do this at the top: ------------------------------------------------------------------------ $:.unshift(File.dirname(__FILE__) + "/../../../rails/actionpack/lib") $:.unshift(File.dirname(__FILE__) + "/../../../rails/actionpack/lib/action_view") require ''action_controller'' require ''action_controller/assertions'' require ''action_view'' require File.dirname(__FILE__) + "/../lib/stylesheets_for_all.rb" require ''test/unit'' class StylesheetsForAllTest < Test::Unit::TestCase include ActionView::Helpers::TagHelper include ActionView::Helpers::UrlHelper include ActionView::Helpers::AssetTagHelper .... ------------------------------------------------------------------------ Which is just nasty. And assumes you have rails frozen into vendor which obviously might not be the case. I tried following the includes for the original tests, but it''s all wrapped up in itself to automate a lot of it and on a Friday afternoon it made my heat hurt :) There must be some tips and docs on how to do this properly? Any links, blogs, tutorials any of you might have would be greatly appreciated. I''d like to make this available, but can''t as it stands now... Thanks all! -philip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---