Sha256: f8354eb60fc879c3ea20807f1eb3f6b7d89e5746432fed3eb410aa7448bb5516
Contents?: true
Size: 955 Bytes
Versions: 47
Compression:
Stored size: 955 Bytes
Contents
require File.expand_path('../helper', __FILE__) class AppModuleTest < Test::Unit::TestCase module MyModule include Sinatra::AppModule module MyHelpers def apple(); "Apple"; end end helpers MyHelpers helpers do def banana(); "Banana"; end end get('/') { "Hello" } get('/apple') { apple } get('/banana') { banana } configure do set :skittles, "rainbow" end set :saturn, 'big' end class App < Sinatra::Base include MyModule end include Rack::Test::Methods def app() App; end test "hello" do get '/' assert last_response.body == "Hello" end test "helpers in a module" do get '/apple' assert last_response.body == 'Apple' end test "helpers" do get '/banana' assert last_response.body == 'Banana' end test "configure block" do assert App.skittles == 'rainbow' end test "set" do assert App.saturn == 'big' end end
Version data entries
47 entries across 47 versions & 2 rubygems