#1255 ✓resolved

Trivial bug in setup_adapters on ruby 1.9.1.

Reported by Postmodern | April 21st, 2010 @ 02:49 AM | in 1.0.0

I just tried running specs for my new DataMapper plugin (http://github.com/postmodern/dm-is-read_only) using the spec/spec_helper.rb from dm-migrations. Under Ruby 1.9.1 I get a trivial NoMethodError:

/home/hal/.bundle/ruby/1.9.1/bundler/gems/dm-core-37b4bd22b9e3842977cf83d32baba459607e900a-master/lib/dm-core/spec/lib/adapter_helpers.rb:71:in `setup_adapters': undefined method `only' for #<Hash:0x00000001d9eff0> (NoMethodError)
    from /vault/1/code/dm-is-read_only/spec/spec_helper.rb:29:in `<top (required)>'
    from /vault/1/code/dm-is-read_only/spec/integration/read_only_spec.rb:1:in `require'
    from /vault/1/code/dm-is-read_only/spec/integration/read_only_spec.rb:1:in `<top (required)>'
    from /usr/lib/ruby19/gems/1.9.1/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:15:in `load'
    from /usr/lib/ruby19/gems/1.9.1/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:15:in `block in load_files'
    from /usr/lib/ruby19/gems/1.9.1/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in `each'
    from /usr/lib/ruby19/gems/1.9.1/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in `load_files'
    from /usr/lib/ruby19/gems/1.9.1/gems/rspec-1.3.0/lib/spec/runner/options.rb:133:in `run_examples'
    from /usr/lib/ruby19/gems/1.9.1/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run'
    from /usr/lib/ruby19/gems/1.9.1/gems/rspec-1.3.0/bin/spec:5:in `<main>'
rake aborted!
Command /usr/bin/ruby19 -I"lib:lib:spec"  "/usr/lib/ruby19/gems/1.9.1/gems/rspec-1.3.0/bin/spec" "spec/integration/read_only_spec.rb" --options .specopts failed


source 'http://rubygems.org'
datamapper = 'git://github.com/datamapper'

group :runtime do
  if ENV['EXTLIB']
    gem 'extlib', '~> 0.9.15', :git => "#{datamapper}/extlib.git"
    gem 'activesupport', '~> 3.0.0.beta3', :git => 'git://github.com/rails/rails.git', :require => nil

  gem 'dm-core',    '~> 0.10.3', :git => "#{datamapper}/dm-core.git"

group :development do
  gem 'rake',       '~> 0.8.7'
  gem 'jeweler',    '~> 1.4.0', :git => 'git://github.com/technicalpickles/jeweler.git'
  gem 'yard',       '~> 0.5.3'

group :test do
  gem 'data_objects',   '~> 0.10.2', :git => "#{datamapper}/do.git"
  gem 'do_sqlite3', '~> 0.10.2', :git => "#{datamapper}/do.git"

    adapters = ENV['ADAPTERS'].split(/\s+/).map { |name|

    adapters.each do |name|
      gem "dm-adapter-#{name}",   '~> 0.10.3', :git => "#{datamapper}/dm-adapter-#{name}.git"

gem 'rspec',    '~> 1.3.0', :group => [:development, :test]

Comments and changes to this ticket

  • Martin Gamsjaeger (snusnu)

    Martin Gamsjaeger (snusnu) April 21st, 2010 @ 08:38 AM

    • Milestone set to 1.0.0
    • State changed from “new” to “unconfirmed”

    I'm in the process of refactoring the adapter wiring / setup code for dm-core, all the dm-xxx-adapters and dm-migrations. Basically, the plan is to have a dm-xxx-adapter/spec/setup.rb file in each of the adapters, that can either be used by dm-core to setup the adapter (if it was requested using the ADAPTER env var), or by the dm-xxx-adapter itself to set itself up before running its own specs. The #setup_adapters method as it is now will go away during this refactoring.

    The weird thing is though, the Hash#only is defined in


    and actually gets required very early when you just require 'dm-core'. Now I'm still not too familiar with 1.9, but I'm not sure if this is a 1.9 bug only (although I gotta admit that I've never experienced it on 1.8). Have you tried requiring dm-core explicitly early on? It just looks like this require is missing.

  • Postmodern

    Postmodern April 21st, 2010 @ 05:18 PM

    That makes sense. After I required 'dm-core' in the spec_helper.rb the problem went away.

  • Martin Gamsjaeger (snusnu)

    Martin Gamsjaeger (snusnu) April 30th, 2010 @ 08:05 AM

    • State changed from “unconfirmed” to “resolved”

    The adapter extraction should be complete now. The various dm-*-adapters, dm-migrations and dm-core now use a simplified mechanism to setup a spec adapter. The offending line in your original stacktrace is not present anymore in the new code. I think this is resolved. Feel free to reopen if anything went wrong of course.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket