Sha256: 7eff9f9420a8611006575584c6a6cd36b113936df363520c436c3121543a5a21
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
require File.expand_path('../spec_helper', __FILE__) describe "WLang's version of BasicObject" do class A # Methods that we keep KEPT_METHODS = ["__send__", "__id__", "instance_eval", "initialize", "object_id", "nil?", "singleton_method_added", "__clean_scope__", "singleton_method_undefined"] def self.__clean_scope__ # Removes all methods that are not needed to the class (instance_methods + private_instance_methods).each do |m| undef_method(m.to_s.to_sym) unless KEPT_METHODS.include?(m.to_s) end end __clean_scope__ end it "should not have kernel methods except certain" do [:puts, :to_s, :hash].each do |sym| begin A.new.instance_eval{ __send__(sym, []) } "Not pass here".should == "" rescue NoMethodError true.should == true end end end it "should not gain methods when requiring gems" do Kernel.load(File.join(File.dirname(__FILE__),"global_extensions.rb")) begin A.new.__clean_scope__.instance_eval{ hello_world } "Not pass here".should == "" rescue NoMethodError true.should == true end end end
Version data entries
3 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wlang-0.10.2 | spec/basic_object.spec |
wlang-0.10.1 | ./spec/basic_object.spec |
wlang-0.10.1 | spec/basic_object.spec |