lib/cutest.rb in cutest-cj-1.3.2 vs lib/cutest.rb in cutest-cj-1.3.3

- old
+ new

@@ -3,11 +3,11 @@ class Cutest autoload :Database, 'database' unless defined?(VERSION) - VERSION = "1.3.2" + VERSION = "1.3.3" FILTER = %r[/(ruby|jruby|rbx)[-/]([0-9\.])+] CACHE = Hash.new { |h, k| h[k] = File.readlines(k) } end class AssertionFailed < StandardError; end @@ -153,10 +153,12 @@ end # Create a class where the block will be evaluated. Recommended to improve # isolation between tests. def scope(name = nil, &block) + cutest[:current_scope] = name + if !cutest[:scope] || cutest[:scope] == name puts "\033[93mScope: \033[0m#{cutest[:scope]}" puts "" Cutest::Scope.new(&block).call end @@ -199,9 +201,11 @@ # though the assertions can live anywhere (it's not mandatory to put them # inside test blocks), it is necessary to wrap them in test blocks in order # to execute preparation and setup blocks. def test(name = nil, &block) cutest[:test] = name + + return if cutest[:current_scope] != cutest[:scope] if !cutest[:only] || cutest[:only] == name print ' ' time_taken = Benchmark.measure do prepare.each { |blk| blk.call }