# Error when testing extensions

**URL:** <https://www.ruby-forum.com/t/error-when-testing-extensions/103429>\
**Category:** Radiant CMS\
**Created:** [May 5, 2007, 9:30pm UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429 "2007-05-05T21:30:24Z")\
**Posts on this page:** 14\
**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 5, 2007, 9:30pm UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/1 "2007-05-05T21:30:24Z")

</div>

Hi everyone,

I’m trying to develop some extensions and whenever I try to run a test I  
get:

uninitialized constant  
ActionController::Assertions::ResponseAssertions (NameError)

I’m running radiant 0.6 (frozen from the gem). This happens for  
everything: unit tests, functional tests, tests run through rake,  
tests run directly – you name it.

Any ideas?

Thanks,  
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 6, 2007, 12:03am UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/2 "2007-05-06T00:03:37Z")

</div>

Are these new extensions or ones that you started before the official  
release?

Sean

---

<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 6, 2007, 12:50am UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/3 "2007-05-06T00:50:42Z")

</div>

Hi Sean and Andrew,

I have the same problem. I have created an extension on mental and pre  
0.6 release. I try to fix it but can not find the problem. This is only  
happen for me when I run the test on instance mode. I have not try to  
run this on svn installation. I thought my gem installation might be  
the problem, I tried to uninstall and re-install but I get the same  
error.

Leon Yeh  
New Avenue Systems Inc.

---

<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 6, 2007, 1:20am UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/4 "2007-05-06T01:20:44Z")

</div>

On 5/5/07, Andrew O’Brien [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> uninitialized constant  
> ActionController::Assertions::ResponseAssertions (NameError)

Radiant - by having its own initializer - somehow messes with  
Dependencies  
and its ability to do autoloading ninja magic. I discovered this when I  
realized attachment\_fu cannot be used in Radiant without some manual  
requires, but I haven’t discovered what exactly breaks in Dependencies  
code.

---

<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 6, 2007, 10:55am UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/5 "2007-05-06T10:55:18Z")

</div>

Indeed, I am not sure its a bug or a feature, but extensions can only be  
tested in application mode.

Regards,  
Erik.

Andrew O’Brien wrote:

> Any ideas?
> 
> Thanks,  
> Andrew
> 
> * * *
> 
> Radiant mailing list  
> Post: removed\_email\_address@domain.invalid  
> Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)

–  
Erik van Oosten

> **[Day to day stuff](http://day-to-day-stuff.blogspot.com/)**
>
> Experiences from a hard core JVM programmer. Likes to keep things simple.

---

<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 6, 2007, 9:01am UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/6 "2007-05-06T09:01:07Z")

</div>

Hello,

I tried to add a new routes into routes.rb. After reading the file, I  
found it to load routes.rb from radiant root. Is there any easy way to  
append or combine my routes to the radiant routes. Something similar to  
the extension routes handler.

Thanks in advance,  
Leon Yeh

---

<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 6, 2007, 7:21pm UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/7 "2007-05-06T19:21:58Z")

</div>

Erik van Oosten wrote:

> Indeed, I am not sure its a bug or a feature, but extensions can only be  
> tested in application mode.

Um, no. That was true for most of the mental branch’s life, but it is  
not true for the 0.6 series. You can run tests for extensions in  
instance or application mode.

If the extension was created before 0.6 was released you may be forced  
to run the tests in application mode.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<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 6, 2007, 6:39pm UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/8 "2007-05-06T18:39:54Z")

</div>

If you’re creating an extension, it’s easy to do in the  
‘define\_routes’ block of the generated extensions class. All of the  
routes from extensions are loaded before the Radiant core routes.

Sean

---

<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 6, 2007, 8:10pm UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/9 "2007-05-06T20:10:04Z")

</div>

I did have 0.6RC2 installed, but have upgraded the the stable version.  
The  
extensions (and the radiant instance) were all created after the  
upgrade.

This may be an obvious question but what’s “instance mode” and  
“application  
mode”? By “application mode” do you mean that radiant is unpacked in  
the  
vendor directory?

-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 6, 2007, 8:23pm UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/10 "2007-05-06T20:23:06Z")

</div>

Andrew O’Brien wrote:

> I did have 0.6RC2 installed, but have upgraded the the stable version. The  
> extensions (and the radiant instance) were all created after the upgrade.

Tests run for extensions on 0.6 not RC2.

> This may be an obvious question but what’s “instance mode” and “application  
> mode”? By “application mode” do you mean that radiant is unpacked in the  
> vendor directory?

Application mode is when you are running Radiant like a normal Rails app  
(you checked it out via SVN or extracted the Zip or Tar), instance mode  
is what you get by default when you create a Radiant “project” with the  
“radiant” command.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<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 6, 2007, 10:41pm UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/11 "2007-05-06T22:41:20Z")

</div>

Hi Sean,

The new routes is not specific to an extension, it is more specific to  
the instance of my radiant app.  
For example: I need to route: /specialoffer url to /offers/free\_bike  
page.

In regular rails app, you can just add this into config/routes.rb.  
However for radiant, it basically load it from either  
vendor/radiant/config/routes.rb or from gem folder, depends on  
RADIANT\_ROOT.

Is there any way to do this on config/routes.rb ? since it is only  
applied to only this radiant app and not to the extension ? I guess I  
can just write an extension that can redirect to specific pages, but it  
would be overkill for my app.

Thanks!

Leon Yeh

---

<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 6, 2007, 8:23pm UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/12 "2007-05-06T20:23:08Z")

</div>

Ah, that’s good news. I’d better upgrade to the 0.6 release then (I am  
still on RC2).

I guess I can recreate my extension, and then copy in all the code.

Regards,  
Erik.

John W. Long wrote:

> If the extension was created before 0.6 was released you may be forced  
> to run the tests in application mode.

–  
Erik van Oosten

> **[Day to day stuff](http://day-to-day-stuff.blogspot.com/)**
>
> Experiences from a hard core JVM programmer. Likes to keep things simple.

---

<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 7, 2007, 3:28pm UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/13 "2007-05-07T15:28:10Z")

</div>

Actually, it sounds like you need URL rewriting, not routing. Routing  
is used to map URLs to controllers and actions. In the .htaccess or  
Apache config file, I would do something like this:

RewriteRule ^/specialoffer(.\*)$ /offers/free\_bike$1

Sean

---

<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 7, 2007, 6:14pm UTC](https://www.ruby-forum.com/t/error-when-testing-extensions/103429/14 "2007-05-07T18:14:33Z")

</div>

Thanks Sean! I did not think to do this using the htaccess or handle  
this in apache.
