Start speccing exceptions and restore the (message) arg to super in Thrift::ApplicationException


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668939 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/rb/lib/thrift/exceptions.rb b/lib/rb/lib/thrift/exceptions.rb
index f0e1b8a..20be9c3 100644
--- a/lib/rb/lib/thrift/exceptions.rb
+++ b/lib/rb/lib/thrift/exceptions.rb
@@ -21,7 +21,7 @@
     attr_reader :type
 
     def initialize(type=UNKNOWN, message=nil)
-      super
+      super(message)
       @type = type
     end
 
diff --git a/lib/rb/spec/exception_spec.rb b/lib/rb/spec/exception_spec.rb
new file mode 100644
index 0000000..e460a27
--- /dev/null
+++ b/lib/rb/spec/exception_spec.rb
@@ -0,0 +1,23 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe Thrift::Exception do
+  it "should have an accessible message" do
+    e = Thrift::Exception.new("test message")
+    e.message.should == "test message"
+  end
+end
+
+describe Thrift::ApplicationException do
+  it "should inherit from Thrift::Exception" do
+    Thrift::ApplicationException.superclass.should == Thrift::Exception
+  end
+
+  it "should have an accessible type and message" do
+    e = Thrift::ApplicationException.new
+    e.type.should == Thrift::ApplicationException::UNKNOWN
+    e.message.should be_nil
+    e = Thrift::ApplicationException.new(Thrift::ApplicationException::UNKNOWN_METHOD, "test message")
+    e.type.should == Thrift::ApplicationException::UNKNOWN_METHOD
+    e.message.should == "test message"
+  end
+end