THRIFT-2961: Service inheritance does not work with namespaced Ruby code
Client: rb
Patch: Jan Brauer

This closes #364

commit 111c4e77a78c1a82f526923f13534bb0027ef33f
Author: Jan Brauer <jan@jimdo.com>
Date: 2015-01-29T22:01:26Z
Make 'extends' work with 'rb:namespaced'.
commit 34cab3d7c77bd5e8325ac4f30f1091429c35905e
Author: Jan Brauer <jan@jimdo.com>
Date: 2015-01-29T22:25:03Z
Add test for namespaced service extension
diff --git a/lib/rb/Rakefile b/lib/rb/Rakefile
index 8f1c4fe..9dc8324 100644
--- a/lib/rb/Rakefile
+++ b/lib/rb/Rakefile
@@ -48,6 +48,8 @@
   task :'namespaced_spec' do
     dir = File.dirname(__FILE__) + '/spec'
     sh THRIFT, '--gen', 'rb:namespaced', '-recurse', '-o', dir, "#{dir}/ThriftNamespacedSpec.thrift"
+    sh THRIFT, '--gen', 'rb:namespaced', '-recurse', '-o', dir, "#{dir}/BaseService.thrift"
+    sh THRIFT, '--gen', 'rb:namespaced', '-recurse', '-o', dir, "#{dir}/ExtendedService.thrift"
   end
 
   task :'flat_spec' do
diff --git a/lib/rb/spec/BaseService.thrift b/lib/rb/spec/BaseService.thrift
new file mode 100644
index 0000000..5c7d32a
--- /dev/null
+++ b/lib/rb/spec/BaseService.thrift
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+namespace rb Base
+
+struct Hello {
+  1: string greeting = "hello world"
+}
+
+service BaseService {
+  Hello greeting(1:bool english)
+}
diff --git a/lib/rb/spec/ExtendedService.thrift b/lib/rb/spec/ExtendedService.thrift
new file mode 100644
index 0000000..1a6b705
--- /dev/null
+++ b/lib/rb/spec/ExtendedService.thrift
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+namespace rb Extended
+
+include "BaseService.thrift"
+
+service ExtendedService extends BaseService.BaseService {
+  void ping()
+}
diff --git a/lib/rb/spec/namespaced_spec.rb b/lib/rb/spec/namespaced_spec.rb
index 8d4f88b..31379d9 100644
--- a/lib/rb/spec/namespaced_spec.rb
+++ b/lib/rb/spec/namespaced_spec.rb
@@ -59,4 +59,9 @@
   it "required an included file" do
     defined?(OtherNamespace::SomeEnum).should be_true
   end
+
+  it "extended a service" do
+    require "extended/extended_service"
+  end
+
 end