mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-01 09:31:20 +08:00
add support for nested `describe’ blocks
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
$running = false
|
||||
$specs = []
|
||||
$describe = nil
|
||||
$expectations_total = 0
|
||||
@@ -23,7 +24,14 @@ end
|
||||
|
||||
class Object
|
||||
def describe(msg, &block)
|
||||
$specs << [msg, block]
|
||||
if $running
|
||||
old_describe = $describe
|
||||
$describe = "#{$describe} #{msg}"
|
||||
block.call
|
||||
$describe = old_describe
|
||||
else
|
||||
$specs << [msg, block]
|
||||
end
|
||||
end
|
||||
|
||||
def it(msg)
|
||||
@@ -122,6 +130,7 @@ end
|
||||
class MainActivity < Android::App::Activity
|
||||
def onCreate(savedInstanceState)
|
||||
super
|
||||
$running = true
|
||||
$specs.each do |ary|
|
||||
$describe = ary[0]
|
||||
ary[1].call
|
||||
|
||||
Reference in New Issue
Block a user