Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Backwards compatibility fixes for 1.8.7

  • Loading branch information...
commit bf71968c7a7e93475ae371712b03fc70e3f8fe6c 1 parent 27c1806
@txus authored
View
10 lib/hijacker/spy.rb
@@ -17,9 +17,9 @@ def spy(object, options = {})
only = options[:only]
uri = options[:uri]
custom_rejection = options[:reject] if options[:reject].is_a?(Regexp)
-
- inst_methods = guess_instance_methods_from(object).reject{|m| (m =~ rejection)}.reject{|m| m =~ custom_rejection}
- sing_methods = guess_singleton_methods_from(object).reject{|m| m =~ rejection}.reject{|m| m =~ custom_rejection}
+
+ inst_methods = guess_instance_methods_from(object).reject{|m| m.to_s =~ rejection}.reject{|m| m.to_s =~ custom_rejection}
+ sing_methods = guess_singleton_methods_from(object).reject{|m| m.to_s =~ rejection}.reject{|m| m.to_s =~ custom_rejection}
receiver = if object.is_a?(Class)
object
@@ -39,14 +39,14 @@ def restore(object)
else
(class << object; self; end)
end
- guess_instance_methods_from(object).select{|m| m =~ /__original_/}.each do |met|
+ guess_instance_methods_from(object).select{|m| m.to_s =~ /__original_/}.each do |met|
met = met.to_s.gsub!("__original_", "")
receiver.send(:undef_method, :"#{met}")
receiver.send(:alias_method, :"#{met}", :"__original_#{met}")
end
receiver = (class << object; self; end)
- guess_singleton_methods_from(object).select{|m| m =~ /__original_/}.each do |met|
+ guess_singleton_methods_from(object).select{|m| m.to_s =~ /__original_/}.each do |met|
met = met.to_s.gsub!("__original_", "")
receiver.send(:undef_method, :"#{met}")
receiver.send(:alias_method, :"#{met}", :"__original_#{met}")
View
6 spec/hijacker/config_spec.rb
@@ -13,20 +13,20 @@
describe "#uri" do
it 'assigns the DRb uri as a class variable' do
Hijacker.uri 'druby://localhost:8787'
- Hijacker.class_variable_get(:@@drb_uri).should == 'druby://localhost:8787'
+ Hijacker.send(:class_variable_get, :@@drb_uri).should == 'druby://localhost:8787'
end
end
describe "#drb_uri" do
context "when the class variable is set" do
it 'is an accessor to it' do
- Hijacker.class_variable_set(:@@drb_uri, 'druby://localhost:8787')
+ Hijacker.send(:class_variable_set, :@@drb_uri, 'druby://localhost:8787')
Hijacker.drb_uri.should == 'druby://localhost:8787'
end
end
context "otherwise" do
it 'raises an error' do
- Hijacker.remove_class_variable(:@@drb_uri)
+ Hijacker.send(:remove_class_variable, :@@drb_uri)
expect {
Hijacker.drb_uri
}.to raise_error(Hijacker::UndefinedUriError)
View
2  spec/hijacker/handler_spec.rb
@@ -55,7 +55,7 @@ module Hijacker
it 'is an accessor to the class variable' do
handlers = [double('handler'),
double('another handler')]
- Handler.class_variable_set(:@@handlers, handlers)
+ Handler.send(:class_variable_set, :@@handlers, handlers)
Handler.handlers.should == handlers
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.