# Test/unit-ing an extension

**URL:** <https://www.ruby-forum.com/t/test-unit-ing-an-extension/198813>\
**Category:** Radiant CMS\
**Created:** [November 8, 2010, 1:18pm UTC](https://www.ruby-forum.com/t/test-unit-ing-an-extension/198813 "2010-11-08T13:18:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [November 8, 2010, 1:18pm UTC](https://www.ruby-forum.com/t/test-unit-ing-an-extension/198813/1 "2010-11-08T13:18:28Z")

</div>

Hi,

I’m using radiant 0.8.1 and trying to write some tests for an extension  
of mine within a big project.  
I’m just writing with test/unit and have some very simple stuff in  
place.

When it comes to running the tests though I can’t figure out how. I’ve  
tried the following commands:  
rake test  
rake test:integration  
rake test:extensions EXT=nzxt

None of them work, and they all give a similar set of errors. Running  
‘rake test:extensions EXT= nzxt --trace’ gives the following output:

\*\* Invoke test:extensions (first\_time)  
\*\* Invoke db:test:prepare (first\_time)  
\*\* Invoke db:abort\_if\_pending\_migrations (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
\*\* Execute db:abort\_if\_pending\_migrations  
\*\* Execute db:test:prepare  
\*\* Invoke db:test:load (first\_time)  
\*\* Invoke db:test:purge (first\_time)  
\*\* Invoke environment  
\*\* Execute db:test:purge  
\*\* Execute db:test:load  
\*\* Invoke db:schema:load (first\_time)  
\*\* Invoke environment  
\*\* Execute db:schema:load  
\*\* Invoke db:schema:load  
\*\* Invoke db:test:load  
\*\* Execute test:extensions  
cd /Users/Arthur/Work/live/133/sitemaker/current/vendor/extensions/nzxt  
(in /Users/Arthur/Work/live/133/sitemaker/current)  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby  
-I"lib:test"  
“/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake\_test\_loader.rb”  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby  
-I"lib:/Users/Arthur/Work/live/133/sitemaker/current/vendor/radiant/test"  
“/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake\_test\_loader.rb”  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby  
-I"lib:test"  
“/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake\_test\_loader.rb”  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby  
-I"lib:/Users/Arthur/Work/live/133/sitemaker/current/vendor/radiant/test"  
“/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake\_test\_loader.rb”  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby  
-I"lib:test"  
“/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake\_test\_loader.rb”  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby  
-I"lib:/Users/Arthur/Work/live/133/sitemaker/current/vendor/radiant/test"  
“/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake\_test\_loader.rb”  
cd -

I’ve tried re-freezing the radiant gem and some other things to ensure  
the install of radiant 0.8.1 is clean.  
Starting with a blank 0.8.1 app, running ‘rake test:integration’, gives  
this output:

(in /Users/Arthur/radiant\_play)  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby  
-I"lib:test"  
“/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake\_test\_loader.rb”  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby  
-I"lib:/Users/Arthur/radiant\_play/vendor/radiant/test"  
“/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake\_test\_loader.rb”

I do seem to be able to get rspecs running. Is it possible to use  
test/unit though?

-Arthur

---

<div class="post-metadata">

**Author:** ![worldintime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e36b37/32.png) [@worldintime](https://www.ruby-forum.com/u/worldintime)\
**Post date:** [November 10, 2010, 2:09pm UTC](https://www.ruby-forum.com/t/test-unit-ing-an-extension/198813/2 "2010-11-10T14:09:37Z")

</div>

On Mon, Nov 8, 2010 at 7:17 AM, Arthur G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> None of them work, and they all give a similar set of errors. Running ‘rake  
> test:extensions EXT= nzxt --trace’ gives the following output:  
> \*\* Invoke environment  
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test"  
> “/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake\_test\_loader.rb”  
> (in /Users/Arthur/radiant\_play)  
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test"  
> “/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake\_test\_loader.rb”  
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby  
> -I"lib:/Users/Arthur/radiant\_play/vendor/radiant/test"  
> “/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake\_test\_loader.rb”
> 
> I do seem to be able to get rspecs running. Is it possible to use test/unit  
> though?
> 
> -Arthur

It should be possible, but I personally haven’t worked with a  
test/unit extension in a long time so we might be missing something.  
As far as I’ve seen many other authors use rspec. If you can  
contribute a fix for this it would be wonderful to have it.  
I’m sorry I don’t have an answer for you off the top of my head.
