Ruby 1.9.2 and Rails 3 not working #24

Closed
docwhat opened this Issue Feb 17, 2011 · 10 comments

6 participants

@docwhat

I followed the instructions and added this to the top of my rails 3 Rakefile:

require 'rubygems'
#require 'ci/reporter/rake/rspec'     # use this if you're using RSpec
#require 'ci/reporter/rake/cucumber'  # use this if you're using Cucumber
require 'ci/reporter/rake/test_unit' # use this if you're using Test::Unit

And then run:

$ rake ci:setup:testunit test:units CI_REPORTS=results
(in /home/docwhat/work/rails-app)
rm -rf results
Loaded suite /home/docwhat/.rvm/gems/ruby-1.9.2-p0@rails-app/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
...

Finished in 0.203221351 seconds.

3 tests, 3 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed

14.76 tests/s, 14.76 assertions/s

It says it removes results, but nothing different happens. No directory is created, etc.

@nicksieger
ci-reporter member

I think this is probably due to the fact that we don't support Miniunit, which is the default for 1.9.2 when you require 'test/unit'. Unfortunately, if you look at the list of issues, we also don't support Test Unit 2.0 yet, which would be an alternative. Can anyone help with either of these?

@docwhat

Test Unit 2.2.0 has the ability to add listeners to the TestResults class. I'm not sure how it works yet, but at least that makes it seems sane.

Minitest doesn't have any such mechanism, so it'll have to be monkey patched. :-/

Can you put together a few test cases to show how you want it to work for both? Then I can see about making them work for you....

@gaffo

In a normal rails 3 app on 1.9.2 on ubuntu, I'm getting this:

hudson@ugcbuild1:~/jobs/ugc-admin/workspace$ rake ci:setup:testunit CI_REPORT=reports
(in /var/lib/hudson/jobs/ugc-admin/workspace)
rm -rf test/reports
hudson@ugcbuild1:~/jobs/ugc-admin/workspace$ rake ci:setup:testunit CI_REPORT=reports test
(in /var/lib/hudson/jobs/ugc-admin/workspace)
rm -rf test/reports
Rails Error: Unable to access log file. Please ensure that /var/lib/hudson/jobs/ugc-admin/workspace/log/test.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the
problem is fixed.
/var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require': no such file to load -- test/unit/ui/console/testrunner (LoadError)
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `block in require'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:227:in `load_dependency'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/ci_reporter-1.6.4/lib/ci/reporter/test_unit.rb:7:in `<top (required)>'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `block in require'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:227:in `load_dependency'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/ci_reporter-1.6.4/lib/ci/reporter/rake/test_unit_loader.rb:6:in `<top (required)>'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:235:in `load'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:235:in `block in load'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:227:in `load_dependency'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:235:in `load'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `block in <main>'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `<main>'
/var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/ci_reporter-1.6.4/lib/ci/reporter/test_unit.rb:7:in `require': no such file to load -- test/unit/ui/console/testrunner (LoadError)
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/ci_reporter-1.6.4/lib/ci/reporter/test_unit.rb:7:in `<top (required)>'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/ci_reporter-1.6.4/lib/ci/reporter/rake/test_unit_loader.rb:6:in `require'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/ci_reporter-1.6.4/lib/ci/reporter/rake/test_unit_loader.rb:6:in `<top (required)>'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `block in <main>'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `<main>'
/var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/ci_reporter-1.6.4/lib/ci/reporter/test_unit.rb:7:in `require': no such file to load -- test/unit/ui/console/testrunner (LoadError)
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/ci_reporter-1.6.4/lib/ci/reporter/test_unit.rb:7:in `<top (required)>'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/ci_reporter-1.6.4/lib/ci/reporter/rake/test_unit_loader.rb:6:in `require'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/ci_reporter-1.6.4/lib/ci/reporter/rake/test_unit_loader.rb:6:in `<top (required)>'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `block in <main>'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
from /var/lib/hudson/jobs/ugc-admin/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `<main>'
Errors running test:units, test:functionals, test:integration!

@yairgo

I'm using test-unit 2.0.0 and ci_reporter 1.6.3 and everything is working perfectly fine for me.
Inside of Gemfile:

group :development, :test, :cucumber do
  gem 'ci_reporter', '1.6.3'
  gem 'test-unit', '~> 2.0.0'
end

Then inside of lib/tasks/test_tasks.rake I have the following:

require 'ci/reporter/rake/test_unit' if Rails.env != 'production'
namespace :test do
  desc 'run the tests with junit xml output'
  task :ci do
    RAILS_ENV='test'
    Rake::Task['db:setup'].invoke
    sh 'rake ci:setup:testunit test CI_REPORTS=results RAILS_ENV=test'
  end
end
Rake::TaskManager.class_eval do
  def remove_task(task_name)
    @tasks.delete(task_name.to_s)
  end
end

def remove_task(task_name)
  Rake.application.remove_task(task_name)
end

remove_task(:test)
@billywatson

Any updates on this issue? Still having major problems and I've tried @yairgo's code to no avail...

@nicksieger
ci-reporter member

Try 1.7.0?

@ari

Running ci_reporter 1.7.0, minitest 2.12.1 with Ruby 1.9.2 I get this:

/Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in require': no such file to load -- test/unit/ui/console/testrunner (LoadError)
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in
block in require'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:223:in block in load_dependency'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:640:in
new_constants_in'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:223:in load_dependency'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in
require'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/ci_reporter-1.7.0/lib/ci/reporter/test_unit.rb:7:in <top (required)>'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in
require'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in block in require'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:223:in
block in load_dependency'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:640:in new_constants_in'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:223:in
load_dependency'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in require'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/ci_reporter-1.7.0/lib/ci/reporter/rake/test_unit_loader.rb:6:in
'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in require'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in
block in require'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:223:in block in load_dependency'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:640:in
new_constants_in'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:223:in load_dependency'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@jobsworth/gems/activesupport-3.1.4/lib/active_support/dependencies.rb:240:in
require'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:15:in block in <main>'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in
select'
from /Users/build/.rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `

'

@nicksieger
ci-reporter member

@ari Are you integrating ci_reporter via ci:setup:minitest?

@ari

Thanks for that. It seemed to fix the problem. But I found your README.rdoc confusing since it doesn't mention the different rake targets under the Usage section, only under Advanced Usage which I didn't think applied to us.

@nicksieger
ci-reporter member

Closing this as of 1.7.0 which has minitest support.

@nicksieger nicksieger closed this Apr 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment