Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Fixed YAML serialization of a stubbed object."

This reverts commit 793bd34.
  • Loading branch information...
commit 8bb5142642e75be0b40c480294208de9b8c0c2e4 1 parent 793bd34
David Chelimsky dchelimsky authored
Showing with 5 additions and 35 deletions.
  1. +5 −11 lib/rspec/mocks/methods.rb
  2. +0 −24 spec/rspec/mocks/serialization_spec.rb
16 lib/rspec/mocks/methods.rb
View
@@ -72,18 +72,12 @@ def null_object?
private
- @@mock_proxies = Hash.new do |hash, key|
- hash[key] = key.instance_eval do
- if Mock === self
- Proxy.new(self, @name, @options)
- else
- Proxy.new(self)
- end
- end
- end
-
def __mock_proxy
- @@mock_proxies[self]
+ if Mock === self
+ @mock_proxy ||= Proxy.new(self, @name, @options)
+ else
+ @mock_proxy ||= Proxy.new(self)
+ end
end
def format_chain(*chain, &blk)
24 spec/rspec/mocks/serialization_spec.rb
View
@@ -1,24 +0,0 @@
-require 'spec_helper'
-require 'yaml'
-
-module RSpec
- module Mocks
- class SerializableStruct < Struct.new(:foo, :bar); end
-
- describe "Serialization" do
- subject { SerializableStruct.new(7, "something") }
-
- def set_stub
- subject.stub(:bazz => 5)
- end
-
- it 'serializes to yaml the same with and without stubbing, using #to_yaml' do
- expect { set_stub }.to_not change { subject.to_yaml }
- end
-
- it 'serializes to yaml the same with and without stubbing, using YAML.dump' do
- expect { set_stub }.to_not change { YAML.dump(subject) }
- end
- end
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.