# Pointers/Help for testing action\_view based plugins?

**URL:** <https://www.ruby-forum.com/t/pointers-help-for-testing-action-view-based-plugins/116490>\
**Category:** Rails\
**Created:** [October 6, 2007, 1:56am UTC](https://www.ruby-forum.com/t/pointers-help-for-testing-action-view-based-plugins/116490 "2007-10-06T01:56:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phallstrom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@phallstrom](https://www.ruby-forum.com/u/phallstrom)\
**Post date:** [October 6, 2007, 1:56am UTC](https://www.ruby-forum.com/t/pointers-help-for-testing-action-view-based-plugins/116490/1 "2007-10-06T01:56:47Z")

</div>

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
