From 2d8971293aa6d10bdd882ad19dea6fefeb7855b5 Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Wed, 15 Jun 2011 23:30:46 +0200 Subject: [PATCH] add (failing) tests for Module#public, related to #301 --- test/settings_test.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/settings_test.rb b/test/settings_test.rb index 6fc85eaa..1bb2e1f5 100644 --- a/test/settings_test.rb +++ b/test/settings_test.rb @@ -386,6 +386,25 @@ class SettingsTest < Test::Unit::TestCase @application.set :root, File.dirname(__FILE__) assert @application.static? end + + it 'is possible to use Module#public' do + @base.send(:define_method, :foo) { } + @base.send(:private, :foo) + assert !@base.method_defined?(:foo) + @base.send(:public, :foo) + assert @base.method_defined?(:foo) + end + + it 'is possible to use the keyword public in a sinatra app' do + app = Sinatra.new do + private + def priv; end + public + def pub; end + end + assert !app.method_defined?(:priv) + assert app.method_defined?(:pub) + end end describe 'bind' do