Sha256: 0b716b69cb60f07c298ca3e1e2d889ea0359201fd98bf769d69593b8c74270e2
Contents?: true
Size: 1.36 KB
Versions: 23
Compression:
Stored size: 1.36 KB
Contents
module RSpec describe Expectations do describe '.method_handle_for(object, method_name)' do class UntamperedClass def foo :bar end end class ClassWithMethodOverridden < UntamperedClass def method :baz end end if RUBY_VERSION.to_f > 1.8 class BasicClass < BasicObject def foo :bar end end class BasicClassWithKernel < BasicClass include ::Kernel end end it 'fetches method definitions for vanilla objects' do object = UntamperedClass.new expect(Expectations.method_handle_for(object, :foo).call).to eq :bar end it 'fetches method definitions for objects with method redefined' do object = ClassWithMethodOverridden.new expect(Expectations.method_handle_for(object, :foo).call).to eq :bar end it 'fetches method definitions for basic objects', :if => RUBY_VERSION.to_i >= 2 do object = BasicClass.new expect(Expectations.method_handle_for(object, :foo).call).to eq :bar end it 'fetches method definitions for basic objects with kernel mixed in', :if => RUBY_VERSION.to_f > 1.8 do object = BasicClassWithKernel.new expect(Expectations.method_handle_for(object, :foo).call).to eq :bar end end end end
Version data entries
23 entries across 23 versions & 6 rubygems