Error when testing extensions

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

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

Sean

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.

On 5/5/07, Andrew O’Brien [email protected] 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.

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: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant


Erik van Oosten

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

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

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

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

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

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

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

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

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