spec/rspec/mocks/serialization_spec.rb in rspec-mocks-2.99.4 vs spec/rspec/mocks/serialization_spec.rb in rspec-mocks-3.0.0.beta1

- old
+ new

@@ -1,35 +1,34 @@ require 'spec_helper' module RSpec module Mocks describe "Serialization of mocked objects" do - include_context 'with isolated configuration' class SerializableObject < Struct.new(:foo, :bar); end def self.with_yaml_loaded(&block) context 'with YAML loaded' do - module_eval(&block) + module_exec(&block) end end def self.without_yaml_loaded(&block) context 'without YAML loaded' do before do # We can't really unload yaml, but we can fake it here... hide_const("YAML") - Struct.class_eval do + Struct.class_exec do alias __old_to_yaml to_yaml undef to_yaml end end - module_eval(&block) + module_exec(&block) after do - Struct.class_eval do + Struct.class_exec do alias to_yaml __old_to_yaml undef __old_to_yaml end end end @@ -81,10 +80,9 @@ expect(serializable_object).not_to respond_to(:to_yaml) end end it 'marshals the same with and without stubbing' do - RSpec::Mocks.configuration.patch_marshal_to_support_partial_doubles = true expect { set_stub }.to_not change { Marshal.dump(serializable_object) } end end end end