Class: Test::Unit::TestCase

Inherits:
Object
  • Object
show all
Defined in:
lib/plugins/acts_as_versioned/test/abstract_unit.rb,
lib/plugins/acts_as_tree/test/acts_as_tree_test.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#assert_no_queries(&block) ⇒ Object


17
18
19
# File 'lib/plugins/acts_as_tree/test/acts_as_tree_test.rb', line 17

def assert_no_queries(&block)
  assert_queries(0, &block)
end

#assert_queries(num = 1) ⇒ Object


10
11
12
13
14
15
# File 'lib/plugins/acts_as_tree/test/acts_as_tree_test.rb', line 10

def assert_queries(num = 1)
  $query_count = 0
  yield
ensure
  assert_equal num, $query_count, "#{$query_count} instead of #{num} queries were executed."
end