lib/padrino-gen/generators/components/tests/testspec.rb in padrino-gen-0.11.1 vs lib/padrino-gen/generators/components/tests/testspec.rb in padrino-gen-0.11.2

- old
+ new

@@ -3,14 +3,21 @@ require File.expand_path(File.dirname(__FILE__) + "/../config/boot") class Test::Unit::TestCase include Rack::Test::Methods - def app - ## - # You can handle all padrino applications using instead: - # Padrino.application - CLASS_NAME.tap { |app| } + # You can use this method to custom specify a Rack app + # you want rack-test to invoke: + # + # app CLASS_NAME + # app CLASS_NAME.tap { |a| } + # app(CLASS_NAME) do + # set :foo, :bar + # end + # + def app(app = nil &blk) + @app ||= block_given? ? app.instance_eval(&blk) : app + @app ||= Padrino.application end end TEST TESTSPEC_CONTROLLER_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(TESTSPEC_CONTROLLER_TEST)