Module: RSpec::Mocks::Serialization::YAML

Defined in:
lib/rspec/mocks/serialization.rb

Instance Method Summary collapse

Instance Method Details

#to_yaml(*a) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rspec/mocks/serialization.rb', line 11

def to_yaml(*a)
  return super(*a) unless instance_variable_defined?(:@mock_proxy)

  mp = @mock_proxy
  remove_instance_variable(:@mock_proxy)

  begin
    super(*a)
  ensure
    @mock_proxy = mp
  end
end