Forum: Radiant CMS Test/unit-ing an extension

Posted by Arthur Gunn (Guest)
on 2010-11-08 13:18
(Received via mailing list)
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
Posted by Jim Gay (Guest)
on 2010-11-10 14:09
(Received via mailing list)
On Mon, Nov 8, 2010 at 7:17 AM, Arthur Gunn <Arthur@gunn.co.nz> 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.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.