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 :slight_smile:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs