Sha256: 60477edb382c4d8496859735d527889486432ae48d5d5dd9d14bf8fc968cd456

Contents?: true

Size: 888 Bytes

Versions: 2

Compression:

Stored size: 888 Bytes

Contents

require 'RubyExt/require'
require 'spec'

module RubyExt
	describe 'Kernel' do
		class Respond
			def test; 2 end
		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
			begin
				ForKernel::RaiseWithoutSelf.new.test
			rescue RuntimeError => e
				stack = e.backtrace
				stack.any?{|line| line =~ /RaiseWithoutSelf/}.should be_false
				stack.any?{|line| line =~ /kernel_spec/}.should be_true
			end
		end
		
		it "raise_without_self" do
			begin
				t1 = ForKernel::RaiseWithoutSelf.new
				ForKernel::Raise2.new.test t1
			rescue RuntimeError => e
				stack = e.backtrace
				stack.any?{|line| line =~ /RaiseWithoutSelf/}.should be_false
				stack.any?{|line| line =~ /Raise2/}.should be_false
				stack.any?{|line| line =~ /kernel_spec/}.should be_true
			end
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
RubyExt-0.1.1 spec/kernel_spec.rb
RubyExt-0.1.2 spec/kernel_spec.rb