Я работаю над расширением Sinatra, которое выполняет некоторые настройки, которые я хотел бы проверить, что произошло
Код расширения выглядит следующим образом
module Sinatra
module Cache
# Create a cache
module Helpers
def cache!
**...implementation...**
end
#check if cached and load from the cache
def cached?
**...implementation...**
end
#set some default values at startup - inject some app settings
def self.registered(app)
app.helpers Sinatra::Cache::Helpers
app.set :cache_dir , "/tmp"
end
end
end
register Cache
end
и тестовая настройка, подобная этой
class TestApp < Sinatra::Base
register Sinatra::Cache
configure do
#set :cache_dir, YAML.load_file(File.expand_path("cache.yml", File.dirname(__FILE__)))
end
get '/' do
end
end
class Helper
include Sinatra::Cache::Helpers
end
class SinatraExtTest < Test::Unit::TestCase
include Rack::Test::Methods
attr_accessor :helper
def app
TestApp.new
end
def setup
Sinatra::Base.set :environment, :test
@helper = Helper.new
end
def test_TestApp_loaded
get '/'
assert last_response, "no response"
end
def test_ext_available
assert @helper.methods.include?(:cache!)
end
def test_cache_dir_available
get '/'
assert app.cache_dir
end
end
Я изо всех сил пытаюсь заполучить настройки приложения, метод def test_cache_dir_available не работает из-за отсутствия такого метода
Кто-нибудь видит, что я делаю не так?