Sha256: 5e8c0f6534975819dfa03c1a65719287fa884c721c8b98b9521445ffb75886d9

Contents?: true

Size: 742 Bytes

Versions: 1

Compression:

Stored size: 742 Bytes

Contents

require 'spec_helper'

class ExceptionSubclassTest < Exception
  def custom_method
    42
  end
end

describe "Exception" do
  it "subclasses can have methods defined on them" do
    ExceptionSubclassTest.new.custom_method.should == 42
  end
end

describe "Native exception" do
  it "handles messages for native exceptions" do
    exception = `new Error("native message")`
    exception.message.should == "native message"
  end
end

# TODO: Delete when this code is added to the ruby spec
describe "Exception#to_s" do
  it "calls #to_s on the message" do
    message = mock("message")
    message.should_receive(:to_s).and_return("message").any_number_of_times
    ExceptionSpecs::Exceptional.new(message).to_s.should == "message"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-0.11.0.rc1 spec/opal/core/exception_spec.rb