##
# Provides before/after hooks for setup and teardown. These are
# meant for library writers, NOT for regular test authors. See
# #before_setup for an example.
module LifecycleHooks
##
# Runs before every test, before setup. This hook is meant for
# libraries to extend minitest. It is not meant to be used by
# test developers.
#
# As a simplistic example:
#
# module MyMinitestPlugin
# def before_setup
# super
# # ... stuff to do before setup is run
# end
#
# def after_setup
# # ... stuff to do after setup is run
# super
# end
#
# def before_teardown
# super
# # ... stuff to do before teardown is run
# end
#
# def after_teardown
# # ... stuff to do after teardown is run
# super
# end
# end
#
# class MiniTest::Test
# include MyMinitestPlugin
# end
搜了一下还真没有
nothing for before_tests though, dammit. I can't believe this still doesn't exist outside of rspec after all these years.
好像有好多监控软件啊 ruby 的有 god
#16 楼 @reyesyang 名字起的好啊
#3 楼 @Saito 就是 heroku 那个家伙呀 他用 commit 历史画了他名字的图.. https://github.com/will
这个用法是 1.9 新加的,和 1.8.7 还不兼容。
[~/work] $ ruby -v -e "p ?a"
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
97
[~/work] $ ruby -v -e "p ?a"
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.3.0]
"a"
# A shortcut to HighLine.ask() a question that only accepts "yes" or "no"
# answers ("y" and "n" are allowed) and returns +true+ or +false+
# (+true+ for "yes"). If provided a +true+ value, _character_ will cause
# HighLine to fetch a single character response. A block can be provided
# to further configure the question as in HighLine.ask()
#
# Raises EOFError if input is exhausted.
#
def agree( yes_or_no_question, character = nil )
ask(yes_or_no_question, lambda { |yn| yn.downcase[0] == ?y}) do |q|
q.validate = /\Ay(?:es)?|no?\Z/i
q.responses[:not_valid] = 'Please enter "yes" or "no".'
q.responses[:ask_on_error] = :question
q.character = character
yield q if block_given?
end
end
哇,他这种写法是可以兼容 1.9 和 1.8 的.... 1.8 的 String#[] 返回 ascii,?也返回 ascii 1.9 的 String#[] 返回字符串,?也返回字符串
#29 楼 @jiyinyiyong 主要是只会写 hello world 啦 匿..
#23 楼 @bhuztez 擦 我记得我刚开始折腾的时候也是 0.1 呢 http://helloworld.group.iteye.com/group/topic/20827
不过后来这东西火的一塌糊涂,就没心情用了..
I think it's a AB problem, however, what's your real problem, LZ?
#20 楼 @jimrokliu 蝙蝠挂了..
#24 楼 @reyesyang 那是我的手机输入法问题啦