Create Object#instance_variable_defined? in versions of Ruby where it doesnt already exist. This fixes spec tests on ancient versions of Ruby 1.8.5
Signed-off-by: R.I.Pienaar <r...@devco.net> --- Local-branch: ticket/master/7177 spec/monkey_patches/instance_variable_defined.rb | 7 +++++++ spec/spec_helper.rb | 2 ++ 2 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 spec/monkey_patches/instance_variable_defined.rb diff --git a/spec/monkey_patches/instance_variable_defined.rb b/spec/monkey_patches/instance_variable_defined.rb new file mode 100644 index 0000000..a656c9f --- /dev/null +++ b/spec/monkey_patches/instance_variable_defined.rb @@ -0,0 +1,7 @@ +unless Object.respond_to?("instance_variable_defined?") + class Object + def instance_variable_defined?(meth) + instance_variables.include?(meth) + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 26be863..df96b25 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,6 +13,8 @@ require 'mocha' require 'ostruct' require 'tmpdir' +require 'monkey_patches/instance_variable_defined' + RSpec.configure do |config| config.mock_with :mocha -- 1.7.1 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.