Class: Test::Unit::TestCase

Inherits:
Object
  • Object
show all
Defined in:
vendor/plugins/awesome_nested_set/test/test_helper.rb,
vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb,
vendor/plugins/engines/test/lib/engines_test_helper.rb,
vendor/plugins/acts_as_versioned/test/abstract_unit.rb

Overview

:nodoc:

Direct Known Subclasses

ActionMailerWithinApplicationTest, ActionMailerWithinPluginsTest, ActiveRecordTestCase, ArbitraryCodeMixingTest, AssetsTest, AwesomeNestedSetTest, BackwardsCompatibilityTest, CollectiveIdea::Acts::NestedSet::AwesomeNestedSetTest, ListSubTest, ListTest, LoadPathTest, MemCacheStoreTest, MigrationTest, MigrationsTest, ModelAndLibTest, NormalizeTest, OpenIdAuthenticationTest, PaginationHelperTest, PluginsTest, StatusTest, TestBer, TestFilter, TestLdapClient, TestLdif, TestPassword, TestingTest, TreeTest, TreeTestWithEagerLoading, TreeTestWithoutOrder, VersionedTest

Instance Method Summary

Instance Method Details

- (Object) assert_no_queries(&block)



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

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

- (Object) assert_queries(num = 1)



10
11
12
13
14
15
# File 'vendor/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

- (Object) assert_response_body(expected)



35
36
37
# File 'vendor/plugins/engines/test/lib/engines_test_helper.rb', line 35

def assert_response_body(expected)
  assert_equal expected, @response.body
end

- (Object) get_action_on_controller(*args)

Add more helper methods to be used by all tests here…



23
24
25
26
27
# File 'vendor/plugins/engines/test/lib/engines_test_helper.rb', line 23

def get_action_on_controller(*args)
  action = args.shift
  with_controller *args
  get action
end

- (Object) with_controller(controller, namespace = nil)



29
30
31
32
33
# File 'vendor/plugins/engines/test/lib/engines_test_helper.rb', line 29

def with_controller(controller, namespace = nil)
  classname = controller.to_s.classify + 'Controller'
  classname = namespace.to_s.classify + '::' + classname unless namespace.nil?
  @controller = classname.constantize.new
end