Class: Test::Unit::TestCase

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

Instance Method Summary collapse

Instance Method Details

#assert_no_queries(&block) ⇒ Object



19
20
21
# File 'lib/plugins/acts_as_tree/test/acts_as_tree_test.rb', line 19

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

#assert_queries(num = 1) ⇒ Object



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

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