From ded77e47a25c403dc07887225b4ddfc749e2ddfd Mon Sep 17 00:00:00 2001 From: Laurent Sansonetti Date: Mon, 14 Apr 2014 23:32:25 +0200 Subject: [PATCH] =?UTF-8?q?add=20support=20for=20nested=20`describe?= =?UTF-8?q?=E2=80=99=20blocks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/test-android/app/main.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/test-android/app/main.rb b/test/test-android/app/main.rb index b1e3a01a..b4a48adb 100644 --- a/test/test-android/app/main.rb +++ b/test/test-android/app/main.rb @@ -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