rspec/rspec-mocks — Issue #111: Cannot load a serialized Mock object
Author: lmars
Created: 2012-02-26 20:22:50+00:00
State: open

Trying to load a YAML serialized `Mock` object fails:

```ruby
> require 'yaml'
> require 'rspec/mocks'
> YAML.load(RSpec::Mocks::Mock.new.to_yaml)
NoMethodError: undefined method `[]' for nil:NilClass
from ./lib/rspec/mocks/error_generator.rb:8:in `initialize'
from ./lib/rspec/mocks/proxy.rb:35:in `new'
from ./lib/rspec/mocks/proxy.rb:35:in `initialize'
from ./lib/rspec/mocks/methods.rb:128:in `new'
from ./lib/rspec/mocks/methods.rb:128:in `__mock_proxy'
from ./lib/rspec/mocks/mock.rb:41:in `respond_to?'
from /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/yaml.rb:133:in `transfer'
from /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/yaml.rb:133:in `node_import'
from /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/yaml.rb:133:in `load'
from /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/yaml.rb:133:in `load'
from (irb):7
```

It looks like the `@options` instance variable is coming out as nil, causing an error in `ErrorGenerator#initialize`