Sha256: fbe8a4d2d633ff5798caef2d174e005bd5f4e72b100018a9c3383cd9fff2d05d
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 KB
Contents
require "#{File.dirname __FILE__}/../ruby_ext_spec_helper" require "ruby_ext/kernel" describe 'Kernel' do class Respond def test; 2 end end after :all do [:TheNamespace, :AnotherClass].each{|c| Object.send :remove_const, c if Object.const_defined? c} end it "respond_to" do r = Respond.new r.respond_to(:not_exist).should be_nil r.respond_to(:test).should == 2 end it "raise_without_self" do dir = File.dirname __FILE__ require "#{dir}/kernel_spec/TheNamespace/ClassA" require "#{dir}/kernel_spec/the_namespace/class_b" require "#{dir}/kernel_spec/another_class" begin TheNamespace::ClassA.problem_method rescue RuntimeError => e e.message.should =~ /Some problem/ stack = e.backtrace stack.any?{|line| line =~ /ClassA/}.should be_false stack.any?{|line| line =~ /kernel_spec/}.should be_true end begin TheNamespace::ClassB.problem_method rescue RuntimeError => e e.message.should =~ /Some problem/ stack = e.backtrace stack.any?{|line| line =~ /class_b/}.should be_false stack.any?{|line| line =~ /kernel_spec/}.should be_true end begin AnotherClass.exclude_multiple_classes rescue RuntimeError => e e.message.should =~ /Some problem/ stack = e.backtrace stack.any?{|line| line =~ /class_b/}.should be_false stack.any?{|line| line =~ /another_class/}.should be_false stack.any?{|line| line =~ /kernel_spec/}.should be_true end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-ext-0.4.1 | spec/ruby_ext/kernel_spec.rb |
ruby-ext-0.4.0 | spec/ruby_ext/kernel_spec.rb |