Empact / roxml

ROXML is a module for binding Ruby classes to XML. It supports custom mapping and bidirectional marshalling between Ruby and XML using annotation-style class methods, via Nokogiri or LibXML.
http://roxml.rubyforge.org/
MIT License
223 stars 176 forks source link

unable to run any tests #41

Closed pravi closed 12 years ago

pravi commented 12 years ago

/usr/bin/ruby1.9.1 -I/usr/lib/ruby/vendor_ruby /usr/lib/ruby/vendor_ruby/gem2deb/test_runner.rb Running tests for ruby1.9.1 using debian/ruby-tests.rb... /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': iconv will be deprecated in the future, use String#encode instead. /media/forge/debian/diaspora/ruby-roxml-3.2.1/lib/roxml.rb:4:in<top (required)>': undefined method version' for nil:NilClass (NoMethodError) from /media/forge/debian/diaspora/ruby-roxml-3.2.1/spec/spec_helper.rb:7:inrequire_relative' from /media/forge/debian/diaspora/ruby-roxml-3.2.1/spec/spec_helper.rb:7:in <top (required)>' from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire' from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require' from debian/ruby-tests.rb:7:inblock in

' from debian/ruby-tests.rb:7:in each' from debian/ruby-tests.rb:7:in
'

and debian/ruby-tests.rb is

Dir['{spec,test}/*/.rb'].each { |f| require f }

$ ruby1.9.1 -v ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

I'm creating a debian package of roxml using gem2deb tool.

Empact commented 12 years ago

Hmm... seems this has to do with the way active_support is being loaded in your environment. The code in question, from the top of roxml.rb is here:

require 'active_support'
if Gem.loaded_specs['activesupport'].version >= Gem::Version.new('3')
  require 'active_support/inflector'
  require 'active_support/core_ext/object/duplicable'
  require 'active_support/core_ext/module/delegation'
  require 'active_support/core_ext/array/extract_options'
  require 'active_support/core_ext/hash'
  require 'active_support/core_ext/string/starts_ends_with'
end

It seems that despite having successfully loaded 'active_support', the Gem.loaded_specs['activesupport'] response is nil. I'd rather not simply add a nil check without understanding why that's the case. What version of rubygems are you using? Also, could you post the output of Gem.loaded_specs, at that line in the code?

pravi commented 12 years ago

$ gem -v 1.8.11

Active support is 2.3.14.1

I added these lines using my limited ruby knowledge,

require 'active_support'

checking for loaded_specs

puts ">>>>>>>>>>>>>>>>>>>>>" puts "1" puts Gem.loaded_specs puts "<<<<<<<<<<<<<<<<<<<<<"

puts ">>>>>>>>>>>>>>>>>>>>>" puts "2" puts Gem.loaded_specs['activesupport'] puts "<<<<<<<<<<<<<<<<<<<<<"

puts ">>>>>>>>>>>>>>>>>>>>>" puts "3" puts Gem.loaded_specs['active_support'] puts "<<<<<<<<<<<<<<<<<<<<<"

puts ">>>>>>>>>>>>>>>>>>>>>" puts "4" Gem.loaded_specs.each do|name,value| puts "#{name}: #{value}" end puts "<<<<<<<<<<<<<<<<<<<<<"

and I got this output,

1 {} <<<<<<<<<<<<<<<<<<<<<

2

<<<<<<<<<<<<<<<<<<<<<

3

<<<<<<<<<<<<<<<<<<<<<

4 <<<<<<<<<<<<<<<<<<<<<

If you can give me another method to output this value, I can try that too.

Empact commented 12 years ago

Try 3.2.2 (just released). It includes the nil check.

pravi commented 12 years ago

Thanks, it is working now! One test is failing now, I will open a new issue for that.