# Still having problems testing extensions

**URL:** <https://www.ruby-forum.com/t/still-having-problems-testing-extensions/104907>\
**Category:** Radiant CMS\
**Created:** [May 23, 2007, 7:23pm UTC](https://www.ruby-forum.com/t/still-having-problems-testing-extensions/104907 "2007-05-23T19:23:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_OSBrien](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@Andrew\_OSBrien](https://www.ruby-forum.com/u/Andrew_OSBrien)\
**Post date:** [May 23, 2007, 7:23pm UTC](https://www.ruby-forum.com/t/still-having-problems-testing-extensions/104907/1 "2007-05-23T19:23:47Z")

</div>

Hi everyone, I started a thread about this a couple of weeks ago and  
just now got back to trying to work on it. I still get a NameError  
anytime I run rake test:extensions, even on a brand new instance with  
no changes to the default radiant or extension code. Now, from what I  
recall from the previous thread, whether or not I’m running Radiant in  
instance mode or application mode shouldn’t matter – that’s true,  
right?

Here’s what I get:

monkeydrome:~/WorkingDirectory aobrien$ radiant -v  
Radiant 0.6.1  
monkeydrome:~/WorkingDirectory aobrien$ radiant foo  
create  
create CHANGELOG  
create CONTRIBUTORS  
create INSTALL  
create LICENSE  
create README  
create config  
create config/environments  
create config/environments/development.rb  
create config/environments/production.rb  
create config/environments/test.rb  
create db  
create log  
create public  
create public/.htaccess  
create public/404.html  
[snipped create files…]  
monkeydrome:~/WorkingDirectory aobrien$ cd foo  
[snipped rake db:bootstrap for all environments]  
monkeydrome:~/WorkingDirectory/foo aobrien$ script/generate extension  
Bar  
create vendor/extensions/bar/app/controllers  
create vendor/extensions/bar/app/helpers  
create vendor/extensions/bar/app/models  
create vendor/extensions/bar/app/views  
create vendor/extensions/bar/db/migrate  
create vendor/extensions/bar/lib/tasks  
create vendor/extensions/bar/test/fixtures  
create vendor/extensions/bar/test/functional  
create vendor/extensions/bar/test/unit  
create vendor/extensions/bar/README  
create vendor/extensions/bar/Rakefile  
create vendor/extensions/bar/bar\_extension.rb  
create vendor/extensions/bar/lib/tasks/bar\_extension\_tasks.rake  
create vendor/extensions/bar/test/test\_helper.rb  
create  
vendor/extensions/bar/test/functional/bar\_extension\_test.rb  
monkeydrome:~/WorkingDirectory/foo aobrien$ rake test:extensions  
(in /Users/aobrien/WorkingDirectory/foo)  
cd /Users/aobrien/WorkingDirectory/foo/config/…/vendor/extensions/bar  
(in /Users/aobrien/WorkingDirectory/foo/vendor/extensions/bar)  
/usr/local/bin/ruby -Ilib:lib  
“/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake/rake\_test\_loader.rb”  
“test/functional/bar\_extension\_test.rb”  
/usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.1/vendor/rails/activerecord/lib/…/…/activesupport/lib/active\_support/dependencies.rb:263:in  
`load_missing_constant': uninitialized constant ActionController::Assertions::ResponseAssertions (NameError) from /usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.1/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:452:in`const\_missing’  
from  
/usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.1/vendor/rails/actionpack/lib/action\_controller/assertions.rb:49:in  
`included' from /usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.1/vendor/rails/actionpack/lib/action_controller/assertions.rb:48:in`included’  
from  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action\_controller/integration.rb:17  
from  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`require' from /usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.1/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:495:in`require’  
from  
/usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.1/vendor/rails/activerecord/lib/…/…/activesupport/lib/active\_support/dependencies.rb:342:in  
`new_constants_in' from /usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.1/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:495:in`require’  
… 7 levels…  
from ./test/functional/…/test\_helper.rb:6  
from ./test/functional/bar\_extension\_test.rb:1  
from  
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake/rake\_test\_loader.rb:5  
from  
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake/rake\_test\_loader.rb:5  
rake aborted!  
Command failed with status (1): [/usr/local/bin/ruby -Ilib:lib  
"/usr/local/…]

(See full trace by running task with --trace)  
cd -

---

<div class="post-metadata">

**Author:** ![Andrew\_OSBrien](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@Andrew\_OSBrien](https://www.ruby-forum.com/u/Andrew_OSBrien)\
**Post date:** [May 24, 2007, 2:22am UTC](https://www.ruby-forum.com/t/still-having-problems-testing-extensions/104907/2 "2007-05-24T02:22:38Z")

</div>

> Hi everyone, I started a thread about this a couple of weeks ago and  
> just now got back to trying to work on it. I still get a NameError  
> anytime I run rake test:extensions, even on a brand new instance with  
> no changes to the default radiant or extension code. Now, from what I  
> recall from the previous thread, whether or not I’m running Radiant in  
> instance mode or application mode shouldn’t matter – that’s true,  
> right?

Works for me (there’s bugs with needing to have your dev db fully  
migrated before your test db will work, but that won’t give the  
errors you’re getting).

The only explanation I can think of is that your gem install is stuffed  
in some way.

Do you have the file:

/usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.1/vendor/rails/actionpack/lib/action\_controller/assertions/response\_assertions.rb

That’s what your error message is complaining about.

Dan.

---

<div class="post-metadata">

**Author:** ![Andrew\_OSBrien](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@Andrew\_OSBrien](https://www.ruby-forum.com/u/Andrew_OSBrien)\
**Post date:** [May 24, 2007, 3:50pm UTC](https://www.ruby-forum.com/t/still-having-problems-testing-extensions/104907/3 "2007-05-24T15:50:44Z")

</div>

Hi Dan,

Yep – it’s there:

monkeydrome:/usr/local/lib/ruby/gems/1.8/gems/radiant-0.6.1/vendor/rails/actionpack/lib/action\_controller/assertions  
aobrien$ ls -l  
total 136  
-rw-r–r-- 1 root 501 11047 May 22 17:39 deprecated\_assertions.rb  
-rw-r–r-- 1 root 501 1051 May 22 17:39 dom\_assertions.rb  
-rw-r–r-- 1 root 501 349 May 22 17:39 model\_assertions.rb  
-rw-r–r-- 1 root 501 6805 May 22 17:39 response\_assertions.rb  
-rw-r–r-- 1 root 501 5229 May 22 17:39 routing\_assertions.rb  
-rw-r–r-- 1 root 501 21836 May 22 17:39 selector\_assertions.rb  
-rw-r–r-- 1 root 501 5846 May 22 17:39 tag\_assertions.rb

The thing is, I got this same error on a different computer (running  
Ubuntu – the box I’m using now is a Mac), and I can’t think of  
anything they have in common that would mess up dependency loading…  
Unless it’s just the fact that I touched them ☹

---

<div class="post-metadata">

**Author:** ![Andrew\_OSBrien](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@Andrew\_OSBrien](https://www.ruby-forum.com/u/Andrew_OSBrien)\
**Post date:** [May 29, 2007, 7:49pm UTC](https://www.ruby-forum.com/t/still-having-problems-testing-extensions/104907/4 "2007-05-29T19:49:14Z")

</div>

Ok, I think I finally figured it out: there’s a missing file in the  
Rails distribution packaged in Radiant. It’s present in the  
repository, but not in the gem or tgz on Rubyforge.

Not sure how it got excluded, but when I copied the code from  
[http://dev.radiantcms.org/radiant/browser/trunk/radiant/vendor/rails/actionpack/lib/action\_controller/vendor/html-scanner/html/document.rb](http://dev.radiantcms.org/radiant/browser/trunk/radiant/vendor/rails/actionpack/lib/action_controller/vendor/html-scanner/html/document.rb)  
into a new file in that part of the tree, the error appeared to be  
fixed.

Does everyone else have this file?

-Andrew

---

<div class="post-metadata">

**Author:** ![Andrew\_OSBrien](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@Andrew\_OSBrien](https://www.ruby-forum.com/u/Andrew_OSBrien)\
**Post date:** [May 29, 2007, 5:36pm UTC](https://www.ruby-forum.com/t/still-having-problems-testing-extensions/104907/5 "2007-05-29T17:36:51Z")

</div>

Ok, so I think I tracked down something a little bit more useful…

After going through the trace, I opened up  
#{RADIANT\_ROOT}/test/test\_helper.rb. After commenting a couple of  
lines I suspected, I found that commenting line #13 ( require  
‘test\_help’ ) allowed my tests to run. (These are the rudimentary  
tests that the extension generator creates, so I don’t know if all of  
the test functionality is there – just that it’s not erroring  
anymore).

I tried finding the actual file this was refering to (one of the  
regretably harder things to do in Rails…) by looping through my $:  
and seeing if the file existed:

irb(main):004:0\> $:.map {|path| puts path if  
File.exists?(File.join(path, ‘test\_help’))}  
=\> [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,  
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,  
nil, nil, nil, nil, nil, nil, nil, nil, nil]  
irb(main):005:0\> load ‘test\_help’  
MissingSourceFile: no such file to load – test\_help

I don’t know why this would mess up something with ResponseAssertions,  
but I do know that Rails’ dependency loading can be a bear, so that’s  
what I’m chalking it up to.

So what is “test\_help” and why do I need it? And how is everyone else  
not having the same problem?

Thanks,  
Andrew
