Part of my question is directed to Aitor, author of the back_door
extension. More generally I'd like to know more about writing proper
tests for a Radiant extension. More details are below.
I'm starting some new projects with radiant 0.6.9 and want to get off on
the right foot with building/using tests. I installed only the back_door
extension.
All the tests for the distribution extensions pass. (rake test)
The back_door tests generate a stack trace:
/usr/bin/ruby -Ilib:lib
"/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb"
"test/unit/back_door_tags_test.rb" "test/functional/back_door_extension_test.rb"
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.9/vendor/rails/railties/lib/test_help.rb:1:
undefined method `require_dependency' for main:Object (NoMethodError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from /usr/lib/ruby/gems/1.8/gems/radiant-0.6.9/test/test_helper.rb:15
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from ./test/unit/../test_helper.rb:8
from ./test/unit/back_door_tags_test.rb:1
from
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb:5
from
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb:5
I tried fixing up the require_dependency problem by copying some code
from the textile extension's test_helper.rb into that of back_door. This
does get me past this particular problem. However the unit tests all
fail with what is probably the same error. For example:
/usr/bin/ruby -Ilib:lib
"/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader.rb"
"test/unit/back_door_tags_test.rb" "test/functional/back_door_extension_test.rb"
Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader
Started
.EEEEEE
Finished in 0.07769 seconds.
1) Error:
test_attribute_expansion(BackDoorTagsTest):
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.request=
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.9/test/helpers/render_test_helper.rb:54:in
`setup_page'
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.9/test/helpers/render_test_helper.rb:49:in
`get_render_output'
/usr/lib/ruby/gems/1.8/gems/radiant-0.6.9/test/helpers/render_test_helper.rb:11:in
`assert_render_match'
./test/unit/back_door_tags_test.rb:120:in `test_attribute_expansion'
I'll be happy to help by writing/fixing tests for the back_door
extension. Is there a good example I can follow? (Looks like quite a few
tests exist in the archive extension.)
I appreciate any help or suggestions any of you have.
Thanks, Bill
--
Bill Barnard
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant