beefproject/beef — Issue #292: Unit tests don't use the proper ruby version on Ubuntu
Author: passbe
Created: 2011-12-10 22:33:08+00:00
State: open

What steps will reproduce the problem?
1. Update to r1358
2. Run rake
3.

What is the expected output? What do you see instead?

- Expected result:

Unit tests run without errors

- Actual result:

Unit test don't run because of dependency problems

+++
$ cat /etc/issue
Ubuntu 11.04 \n \l

$ rake
(in /home/b/projects/beef/beef-git/beef)
cd test/unit/;ruby ts_beef.rb
Loaded suite BeEF TestSuite
Started
............FFF....
Finished in 0.442824 seconds.

1) Failure:
test_loader(TC_Loader) [./core/tc_loader.rb:30]:
Exception raised:
Class: <LoadError>
Message: <"no such file to load -- dm-core">
---Backtrace---
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
../../core/loader.rb:20
./core/tc_loader.rb:31:in `require'
./core/tc_loader.rb:31:in `test_loader'
./core/tc_loader.rb:30:in `test_loader'
---------------

2) Failure:
test_core(TC_Core) [./core/tc_core.rb:30]:
Exception raised:
Class: <NameError>
Message: <"uninitialized constant BeEF::Core::Models::User::DataMapper">
---Backtrace---
../../core/main/models/user.rb:26
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
../../core/core.rb:23
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
./core/tc_core.rb:31:in `test_core'
./core/tc_core.rb:30:in `test_core'
---------------

3) Failure:
test_api(TC_Api) [./core/tc_api.rb:30]:
Exception raised:
Class: <NameError>
Message: <"uninitialized constant BeEF::API::Registrar::Singleton">
---Backtrace---
../../core/api.rb:23
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
./core/tc_api.rb:31:in `test_api'
./core/tc_api.rb:30:in `test_api'
---------------

19 tests, 2363 assertions, 3 failures, 0 errors

+++

It seems like that the problem is the hardcoded "ruby" string in the Rakefile. Ubuntu uses Ruby 1.8 by default and the alternatives are not set automatically on OS level, so setrubyenv.sh won't work in this case either. It would be nice if one could set which Ruby version she would use for the unit tests.
Google Code Issue: http://code.google.com/p/beef/issues/detail?id=537