diff options
| author | hukl <hukl@eight.local> | 2009-01-29 20:41:18 +0100 |
|---|---|---|
| committer | hukl <hukl@eight.local> | 2009-01-29 20:41:18 +0100 |
| commit | b298d3e8eeb10903bd4640dab7c11d0dc1be9d38 (patch) | |
| tree | d8d0a8449972a46e551be3b94e7dd02b6107b119 /test | |
initial import with edge rails included as a submodule
Diffstat (limited to 'test')
| -rw-r--r-- | test/performance/browsing_test.rb | 9 | ||||
| -rw-r--r-- | test/test_helper.rb | 38 |
2 files changed, 47 insertions, 0 deletions
diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb new file mode 100644 index 0000000..4b60558 --- /dev/null +++ b/test/performance/browsing_test.rb | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | require 'test_helper' | ||
| 2 | require 'performance_test_help' | ||
| 3 | |||
| 4 | # Profiling results for each test method are written to tmp/performance. | ||
| 5 | class BrowsingTest < ActionController::PerformanceTest | ||
| 6 | def test_homepage | ||
| 7 | get '/' | ||
| 8 | end | ||
| 9 | end | ||
diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..b9fe251 --- /dev/null +++ b/test/test_helper.rb | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | ENV["RAILS_ENV"] = "test" | ||
| 2 | require File.expand_path(File.dirname(__FILE__) + "/../config/environment") | ||
| 3 | require 'test_help' | ||
| 4 | |||
| 5 | class ActiveSupport::TestCase | ||
| 6 | # Transactional fixtures accelerate your tests by wrapping each test method | ||
| 7 | # in a transaction that's rolled back on completion. This ensures that the | ||
| 8 | # test database remains unchanged so your fixtures don't have to be reloaded | ||
| 9 | # between every test method. Fewer database queries means faster tests. | ||
| 10 | # | ||
| 11 | # Read Mike Clark's excellent walkthrough at | ||
| 12 | # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting | ||
| 13 | # | ||
| 14 | # Every Active Record database supports transactions except MyISAM tables | ||
| 15 | # in MySQL. Turn off transactional fixtures in this case; however, if you | ||
| 16 | # don't care one way or the other, switching from MyISAM to InnoDB tables | ||
| 17 | # is recommended. | ||
| 18 | # | ||
| 19 | # The only drawback to using transactional fixtures is when you actually | ||
| 20 | # need to test transactions. Since your test is bracketed by a transaction, | ||
| 21 | # any transactions started in your code will be automatically rolled back. | ||
| 22 | self.use_transactional_fixtures = true | ||
| 23 | |||
| 24 | # Instantiated fixtures are slow, but give you @david where otherwise you | ||
| 25 | # would need people(:david). If you don't want to migrate your existing | ||
| 26 | # test cases which use the @david style and don't mind the speed hit (each | ||
| 27 | # instantiated fixtures translates to a database query per test method), | ||
| 28 | # then set this back to true. | ||
| 29 | self.use_instantiated_fixtures = false | ||
| 30 | |||
| 31 | # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. | ||
| 32 | # | ||
| 33 | # Note: You'll currently still have to declare fixtures explicitly in integration tests | ||
| 34 | # -- they do not yet inherit this setting | ||
| 35 | fixtures :all | ||
| 36 | |||
| 37 | # Add more helper methods to be used by all tests here... | ||
| 38 | end | ||
