[MacRuby-devel] Rspec Stopped Running Under Macruby

Shannon Love techzen at me.com
Thu May 19 09:58:00 PDT 2011

I had previously had Rspec running under Macruby before I tried to use RVM to manage my ruby installs. Something went awry with RVM and I had to uninstall. After that Rspec stopped working under Macruby. I

I found that my RVM had installed Macruby 0.11 dev in or over my 0.10 install and that remained even after I had removed RVM so I used pkgutil to uninstall all Macruby, then I reinstalled the system ruby package and then reinstall Macruby 0.10

The system ruby 1.8.7 runs rspec installed with its gem command just fine. However, if I uninstall the system rspec and install with macgem, I get the following error trying to either execute a file with rspec calls or running rspec from the command line with or without any options or files.

/Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/rspec-core-2.6.0/lib/rspec/core/world.rb:14:in `empty_without_conditional_filters?': undefined method `empty?' for #<Enumerator:0x2002a76c0> (NoMethodError)
	from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/rspec-core-2.6.0/lib/rspec/core/world.rb:131:in `announce_exclusion_filter:'
	from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/rspec-core-2.6.0/lib/rspec/core/world.rb:103:in `announce_filters'
	from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/rspec-core-2.6.0/lib/rspec/core/command_line.rb:19:in `run:'
	from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/rspec-core-2.6.0/lib/rspec/core/runner.rb:80:in `run_in_process:'
	from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/rspec-core-2.6.0/lib/rspec/core/runner.rb:69:in `run:'
	from /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/rspec-core-2.6.0/lib/rspec/core/runner.rb:11:in `block'
localhost:SetUpRspec developer$ which rspec

The the actual error line is here and it appears to be part of the way that Rspec processes command line arguments:

module RSpec
  module Core
    class World

      module Describable
        PROC_HEX_NUMBER = /0x[0-9a-f]+@/
        PROJECT_DIR = File.expand_path('.')

        def description
           reject { |k, v| RSpec::Core::Configuration::CONDITIONAL_FILTERS[k] == v }.inspect.gsub(PROC_HEX_NUMBER, '').gsub(PROJECT_DIR, '.').gsub(' (lambda)','')

        def empty_without_conditional_filters?
14 =>     reject { |k, v| RSpec::Core::Configuration::CONDITIONAL_FILTERS[k] == v }.empty?

        def reject
          super rescue {}

        def empty?
          super rescue false

I'm a ruby noob but I think it's trying to process a block returned by `super rescue` and it expects a collection but receives an enumerator instead. Why that is, I don't know.

Repeated macgem installs of the rspec gem do nothing to alter the issue.  I can't find any other references to similar problems. I assume that in my naivety with RVM and ruby in general, I wrecked something somewhere in the system that breaks rspec or macruby but I don't know how to fix it. 


More information about the MacRuby-devel mailing list