Files
RubyMotion/test/test-android/app/rubymotion/java_annotation_spec.rb
2014-04-22 23:55:21 +02:00

17 lines
494 B
Ruby

class Java_Annotation_Test < Java::Lang::Object
__annotation__('@android.webkit.JavascriptInterface')
def foo
42
end
end
describe "Java annotations" do
it "can be attached to Ruby methods using the __annotation__() class method" do
method = Java_Annotation_Test.getMethod('foo', [])
method.should != nil
annotations = method.getDeclaredAnnotations
annotations.size.should == 1
annotations[0].toString.should == '@android.webkit.JavascriptInterface()'
end
end