diff options
author | Matt Robinson <matt@puppetlabs.com> | 2011-03-28 15:48:32 -0700 |
---|---|---|
committer | Matt Robinson <matt@puppetlabs.com> | 2011-03-29 11:00:52 -0700 |
commit | 1ac7f63f00c517c6dff67be8d927b968c7bcb6ea (patch) | |
tree | 8b4327a69f2fbe268526ad828c35019154f7a4f9 /spec/unit/indirector/code_spec.rb | |
parent | 29f3dda2aaa4a6225baaa5819ebad32909b01f93 (diff) | |
download | puppet-1ac7f63f00c517c6dff67be8d927b968c7bcb6ea.tar.gz puppet-1ac7f63f00c517c6dff67be8d927b968c7bcb6ea.tar.xz puppet-1ac7f63f00c517c6dff67be8d927b968c7bcb6ea.zip |
(#6830) Fix tests that depended on special inherited behavior
class Foo
def self.inherited(subclass)
puts "#{subclass.inspect} inherited from #{self}"
end
end
class Bar < Foo
end
a = Class.new(Bar) do
def self.to_s
"some other class"
end
end
In Ruby 1.9 this prints
Bar inherited from Foo
#<Class:0x0000010086c198> inherited from Bar
In Ruby 1.8 the to_s override used to be in effect so printed:
Bar inherited from Foo
some other class inherited from Bar
Reviewed-by: Jesse Wolfe <jesse@puppetlabs.com>
Diffstat (limited to 'spec/unit/indirector/code_spec.rb')
-rwxr-xr-x | spec/unit/indirector/code_spec.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/spec/unit/indirector/code_spec.rb b/spec/unit/indirector/code_spec.rb index 452d009f8..1c9e4d2f1 100755 --- a/spec/unit/indirector/code_spec.rb +++ b/spec/unit/indirector/code_spec.rb @@ -4,16 +4,15 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/code' describe Puppet::Indirector::Code do - before do + before :all do Puppet::Indirector::Terminus.stubs(:register_terminus_class) @model = mock 'model' @indirection = stub 'indirection', :name => :mystuff, :register_terminus_type => nil, :model => @model Puppet::Indirector::Indirection.stubs(:instance).returns(@indirection) - @code_class = Class.new(Puppet::Indirector::Code) do - def self.to_s - "Mystuff::Testing" - end + module Testing; end + @code_class = class Testing::MyCode < Puppet::Indirector::Code + self end @searcher = @code_class.new |