spec/rspec/substitute_for_spec.rb in surrogate-0.7.0 vs spec/rspec/substitute_for_spec.rb in surrogate-0.8.0

- old
+ new

@@ -197,11 +197,11 @@ klass = Class.new { def instance_meth(a) end } klass.should_not substitute_for surrogate, types: true end it 'disregards when real object has natively implemented methods that cannot be reflected on' do - Array.method(:[]).parameters.should == [[:rest]] # make sure Array signatures aren't changing across versions or something + next unless Array.method(:[]).parameters == [[:rest]] # e.g. rbx names all their params, so we can reflect to some extent Array.instance_method(:insert).parameters.should == [[:rest]] surrogate = Surrogate.endow(Class.new) { define(:[]) { |a,b,c| } }.define(:insert) { |a,b,c| } Array.should substitute_for surrogate, subset: true, types: true end @@ -309,10 +309,10 @@ klass = Class.new { def self.class_meth() end } klass.should substitute_for surrogate, names: true end it 'disregards when real object has natively implemented methods that cannot be reflected on' do - Array.method(:[]).parameters.should == [[:rest]] # make sure Array signatures aren't changing across versions or something + next unless Array.method(:[]).parameters == [[:rest]] # not all implementations do this Array.instance_method(:insert).parameters.should == [[:rest]] surrogate = Surrogate.endow(Class.new) { define(:[]) { |a,b,c| } }.define(:insert) { |a,b,c| } Array.should substitute_for surrogate, subset: true, names: true end