Sha256: 45e5a8c180f0a9122b7d5c70c4d17f79add500ac8713a67a333b7fba6c9a95a7
Contents?: true
Size: 1.4 KB
Versions: 14
Compression:
Stored size: 1.4 KB
Contents
require "core/spec_helper" 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 require "#{spec_dir}/TheNamespace/ClassA" require "#{spec_dir}/the_namespace/class_b" require "#{spec_dir}/another_class" begin TheNamespace::ClassA.problem_method rescue StandardError => 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 StandardError => 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 StandardError => 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
14 entries across 14 versions & 1 rubygems