I’m digging into BackgrounDRb and having some problems testing a worker
class.
The following line in my test (created from script/generate worker
Test) throws an error:
worker = TestWorker.new(:test_string => “testing…”)
Error:
/activesupport/lib/active_support/dependencies.rb:123:in
const_missing': uninitialized constant BackgrounDRb (NameError) from /Users/itsderek23/Projects/drb_test/config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:131:in
const_missing’
from
/Users/itsderek23/Projects/drb_test/config/…/lib/workers/web_poll_worker.rb:5
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require' from /Users/itsderek23/Projects/drb_test/config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:147:in
require’
from test/unit/test_worker_test.rb:2
Line 5 refers to: class TestWorkerTest < Test::Unit::TestCase
Anyone have any clues on what I’m missing?
–
Derek H.
HighGroove Studios - http://www.highgroove.com
San Mateo, CA | Atlanta, GA
Keeping it Simple.
650.276.0908
I noticed that backgroundrb was placed in script/backgroundrb/lib, but
not in lib…after adding it to /lib, I get the following error:
NameError: uninitialized constant BACKGROUNDRB_LOGGER
/Users/itsderek23/Projects/drb_test/config/…/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:123:in
const_missing' /Users/itsderek23/Projects/drb_test/config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:133:in
const_missing’
/Users/itsderek23/Projects/drb_test/config/…/lib/backgroundrb.rb:27:in
initialize' test/unit/test_worker_test.rb:16:in
test_do_work’
Where line 16 refers to: worker = TestWorker.new(:test_string =>
“testing…”)
On 6/16/06, Derek H. [email protected] wrote:
`const_missing’: uninitialized constant BackgrounDRb (NameError)
Anyone have any clues on what I’m missing?
–
Derek H.
HighGroove Studios - http://www.highgroove.com
San Mateo, CA | Atlanta, GA
Keeping it Simple.
650.276.0908
–
Derek H.
HighGroove Studios - http://www.highgroove.com
San Mateo, CA | Atlanta, GA
Keeping it Simple.
650.276.0908
Hey Derek-
Yeah I need to include some more instructions on testing your worker
classes. THis has come up already. I will have a new release here
before railconf that will address this issue. For now you need to
require script/backgroundrb/lib/backgroundrb.rb in your test case.
You can actually test your workers through the MiddleMan class
without running it as a drb server. Just use it as a standard object.
Have a look at the tests for the plugin itself and you can see how I
test it without running a server.
I will come up with some better docs and a better generated test
class as soon as I get a chance.
-Ezra
Ezra,
Thanks for all your work on this great plugin.
I added the following to my test_helper.rb file:
require File.expand_path(File.dirname(FILE) +
“/…/script/backgroundrb/lib/backgroundrb.rb”)
…but I’m still getting the “uninitialized constant
BACKGROUNDRB_LOGGER” error.
I took a look at the plugin tests. It appears the problem arises when
testing a worker class that is a subclass of BackgrounDRb::Rails. I
can’t find where BACKGROUNDRB_LOGGER is set - am I missing something
there?
Thanks again,
Derek
On 6/16/06, Ezra Z. [email protected] wrote:
I will come up with some better docs and a better generated test
class as soon as I get a chance.
-Ezra
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
–
Derek H.
HighGroove Studios - http://www.highgroove.com
San Mateo, CA | Atlanta, GA
Keeping it Simple.
650.276.0908
Thanks Ezra! Works great!
On 6/16/06, Ezra Z. [email protected] wrote:
Derek
Thanks for the bug reports-
-Ezra
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
–
Derek H.
HighGroove Studios - http://www.highgroove.com
San Mateo, CA | Atlanta, GA
Keeping it Simple.
650.276.0908
On Jun 16, 2006, at 12:06 PM, Derek H. wrote:
I took a look at the plugin tests. It appears the problem arises when
testing a worker class that is a subclass of BackgrounDRb::Rails. I
can’t find where BACKGROUNDRB_LOGGER is set - am I missing something
there?
Thanks again,
Derek
Derek-
Ok I just checked in a new version that should fix these issues. I
moved the logger setup into the same file as the MiddleMan class
setup and added the require to the test generator. So svn up and
reinstall the base system and you should be good to go,.
Thanks for the bug reports-
-Ezra