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

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

Instance Method Summary collapse

Instance Method Details

#to_yaml(*a) ⇒ Object



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

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