Still having problems testing extensions

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:inconst_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:inincluded’
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:inrequire’
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:inrequire’
… 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 -

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.

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 :frowning:

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
into a new file in that part of the tree, the error appeared to be
fixed.

Does everyone else have this file?

-Andrew

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs