# Bet way to debug a plug-in?

**URL:** <https://www.ruby-forum.com/t/bet-way-to-debug-a-plug-in/157098>\
**Category:** Rails\
**Created:** [January 7, 2009, 11:00am UTC](https://www.ruby-forum.com/t/bet-way-to-debug-a-plug-in/157098 "2009-01-07T11:00:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gamafranco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a9adbd/32.png) [@gamafranco](https://www.ruby-forum.com/u/gamafranco)\
**Post date:** [January 7, 2009, 11:00am UTC](https://www.ruby-forum.com/t/bet-way-to-debug-a-plug-in/157098/1 "2009-01-07T11:00:51Z")

</div>

Hi,

Yesterday I had to walk through the code of a plug-in and perform a  
minor fix. I confess that I  
didn’t like the experience. Because the plug-in is in the vendor  
directory, I  
had to restart the web server whenever the code changed.

How can I debug a plug-in without having to restart the web server  
whenever the code changes?

Thanks,  
Tiago F.

---

<div class="post-metadata">

**Author:** ![gamafranco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a9adbd/32.png) [@gamafranco](https://www.ruby-forum.com/u/gamafranco)\
**Post date:** [January 7, 2009, 11:24am UTC](https://www.ruby-forum.com/t/bet-way-to-debug-a-plug-in/157098/2 "2009-01-07T11:24:53Z")

</div>

one way to bypass the server problem is to run tests. Normally  
there’s a test (or rspec) suite included. If not, you can create it

- create a test directory (or spec)
- include a test\_helper.rb or spec\_helper.rb (take one from another  
plugin)
- make unit tests that require the test or spec helper and inherit  
from a unit test case.
- run rake (or rake spec) in your plugin directory

Elise

And then you add tests that correspond to your fix, and run until it’s  
working as required.
