Issue #9226 has been updated by tmm1 (Aman Gupta).


I was able to reproduce this on trunk with the following patch to rspec:

--- a/lib/rspec/core/command_line.rb
+++ b/lib/rspec/core/command_line.rb
@@ -20,6 +20,7 @@ module RSpec
         @configuration.output_stream = out if @configuration.output_stream == $stdout
         @options.configure(@configuration)
         @configuration.load_spec_files
+        GC.stress=true
         @world.announce_filters

         @configuration.reporter.report(@world.example_count) do |reporter|

With the patch, you can see different results during `script/rspec_with_simplecov spec -b --format progress` boot due to object re-use:

  exclude {:ruby=>#<Proc:./spec/spec_helper.rb:149>}
  exclude {:ruby=>RSpec::ExampleGroups::RSpecCoreConfiguration::SeedUsed}
  exclude {:ruby=>#<RubyVM::Env:0x007ff5ec199198>}

I noticed that RSpec::Core::FilterManager was using Hash#merge, and after some debugging I confirmed that the following patch fixes this issue on trunk:

--- a/hash.c
+++ b/hash.c
@@ -1429,6 +1429,7 @@ rb_hash_replace(VALUE hash, VALUE hash2)
        st_table *old_table = RHASH(hash)->ntbl;
        if (old_table) st_free_table(old_table);
        RHASH(hash)->ntbl = st_copy(table2);
+       OBJ_WB_UNPROTECT(hash);
     }

     return hash;
----------------------------------------
Bug #9226: Getting method `inspect' called on unexpected T_NODE object (0x000000025ddea8 flags=0x109089c klass=0x0) (NotImplementedError) from Hash#inspect
https://bugs.ruby-lang.org/issues/9226#change-43498

Author: myronmarston (Myron Marston)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: current: 2.1.0
ruby -v: 2.1.0.preview2
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


We're trying to get a green RSpec build against ruby 2.1.0.preview2, and we're getting this very odd failure on travis:

https://travis-ci.org/rspec/rspec-core/jobs/15066502#L122

The line where it's failing is here:

https://github.com/rspec/rspec-core/blob/2e77a83d92eb1e661398f00359fc784da019401a/lib/rspec/core/filter_manager.rb#L75

It's calling `inspect` on a Hash and blowing up with that confusing error.  The hash that's causing this failure (if that helps) is here:

https://github.com/rspec/rspec-core/blob/2e77a83d92eb1e661398f00359fc784da019401a/spec/spec_helper.rb#L149-L158

It's the `{ :ruby => lambda { } }` hash being passed to `filter_run_excluding`.


-- 
http://bugs.ruby-lang.org/