Forum: Radiant CMS Error when testing extensions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Andrew O'Brien (Guest)
on 2007-05-05 23:30
(Received via mailing list)
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
Sean C. (Guest)
on 2007-05-06 02:03
(Received via mailing list)
Are these new extensions or ones that you started before the official
release?

Sean
Leon Yeh (Guest)
on 2007-05-06 02:50
(Received via mailing list)
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.
Mislav M. (Guest)
on 2007-05-06 03:20
(Received via mailing list)
On 5/5/07, Andrew O'Brien <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.
Leon Yeh (Guest)
on 2007-05-06 11:01
(Received via mailing list)
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 (Guest)
on 2007-05-06 12:55
(Received via mailing list)
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/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>

--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/
Sean C. (Guest)
on 2007-05-06 20:39
(Received via mailing list)
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
John W. Long (Guest)
on 2007-05-06 21:21
(Received via mailing list)
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
Andrew O'Brien (Guest)
on 2007-05-06 22:10
(Received via mailing list)
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
John W. Long (Guest)
on 2007-05-06 22:23
(Received via mailing list)
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
Erik van Oosten (Guest)
on 2007-05-06 22:23
(Received via mailing list)
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
http://day-to-day-stuff.blogspot.com/
Leon Yeh (Guest)
on 2007-05-07 00:41
(Received via mailing list)
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
Sean C. (Guest)
on 2007-05-07 17:28
(Received via mailing list)
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
Leon Yeh (Guest)
on 2007-05-07 20:14
(Received via mailing list)
Thanks Sean! I did not think to do this using  the htaccess or handle
this in apache.
This topic is locked and can not be replied to.