ci-reporter / ci_reporter

CI::Reporter is an add-on to popular test frameworks that allows you to generate XML reports
MIT License
343 stars 110 forks source link

undefined method `metadata' for #<RSpec::Core::Metadata:0x000000182d6d98> #80

Closed lidaobing closed 11 years ago

lidaobing commented 11 years ago
 4) PingMailer #material_sample
     Failure/Error: Unable to find matching line from backtrace
     NoMethodError:
       undefined method `metadata' for #<RSpec::Core::Metadata:0x000000182d6d98>
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/formatters/base_formatter.rb:125:in `format_backtrace'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/rspec.rb:85:in `location'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:163:in `block (3 levels) in to_xml'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `call'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `_nested_structures'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:63:in `tag!'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:161:in `block (2 levels) in to_xml'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:155:in `each'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:155:in `block in to_xml'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `call'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `_nested_structures'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:63:in `tag!'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:184:in `block (2 levels) in cache_method_call'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:151:in `to_xml'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:101:in `block (2 levels) in to_xml'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:100:in `each'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:100:in `block in to_xml'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `call'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `_nested_structures'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:63:in `tag!'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:88:in `method_missing'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:99:in `to_xml'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/report_manager.rb:18:in `block in write_report'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/report_manager.rb:17:in `open'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/report_manager.rb:17:in `write_report'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/rspec.rb:194:in `write_report'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/rspec.rb:199:in `new_suite'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/rspec.rb:119:in `example_group_started'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/reporter.rb:98:in `block in notify'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/reporter.rb:97:in `each'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/reporter.rb:97:in `notify'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/reporter.rb:50:in `example_group_started'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/example_group.rb:365:in `run'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/example_group.rb:370:in `block in run'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/example_group.rb:370:in `map'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/example_group.rb:370:in `run'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/command_line.rb:28:in `map'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/command_line.rb:28:in `block in run'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/reporter.rb:34:in `report'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/command_line.rb:25:in `run'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/runner.rb:77:in `rescue in run'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/runner.rb:73:in `run'
     # /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/runner.rb:17:in `block in autorun'
RobotGetsBored commented 11 years ago

With this fix, I get errors because rspec/version can't be found. I don't actually install gem 'rspec', but rather, 'rspec-rails'. The version can still be accessed by requiring 'rspec/rails/version' instead. Perhaps this can be caught and set? Something like the following will work:

begin
  require 'rspec/version'
  version_string = ::RSpec::Version::STRING
rescue LoadError => e
  require 'rspec/rails/version'
  version_string = ::RSpec::Rails::Version::STRING
end

And then when figuring out the RSpec_2_12_0_bug, use version_string.

RobotGetsBored commented 11 years ago

I've just noticed that an issue (with a better solution) has been opened for this: https://github.com/nicksieger/ci_reporter/pull/83