| | 198 | class IntegrationTestTest < Test::Unit::TestCase |
|---|
| | 199 | |
|---|
| | 200 | def setup |
|---|
| | 201 | @test = ::ActionController::IntegrationTest.new(:default_test) |
|---|
| | 202 | @test.class.stubs(:fixture_table_names).returns([]) |
|---|
| | 203 | @session = @test.open_session |
|---|
| | 204 | end |
|---|
| | 205 | |
|---|
| | 206 | def test_opens_new_session |
|---|
| | 207 | @test.class.expects(:fixture_table_names).times(2).returns(['foo']) |
|---|
| | 208 | |
|---|
| | 209 | session1 = @test.open_session { |sess| } |
|---|
| | 210 | session2 = @test.open_session # implicit session |
|---|
| | 211 | |
|---|
| | 212 | assert_equal ::ActionController::Integration::Session, session1.class |
|---|
| | 213 | assert_equal ::ActionController::Integration::Session, session2.class |
|---|
| | 214 | assert_not_equal session1, session2 |
|---|
| | 215 | end |
|---|
| | 216 | |
|---|
| | 217 | end |
|---|
| | 218 | |
|---|
| | 219 | # Tests that integration tests don't call Controller test methods for processing. |
|---|
| | 220 | # Integration tests have their own setup and teardown. |
|---|
| | 221 | class IntegrationTestUsesCorrectClass < ActionController::IntegrationTest |
|---|
| | 222 | |
|---|
| | 223 | def self.fixture_table_names |
|---|
| | 224 | [] |
|---|
| | 225 | end |
|---|
| | 226 | |
|---|
| | 227 | def test_integration_methods_called |
|---|
| | 228 | %w( get post head put delete ).each do |verb| |
|---|
| | 229 | assert_nothing_raised("'#{verb}' should use integration test methods") { send(verb, '/') } |
|---|
| | 230 | end |
|---|
| | 231 | end |
|---|
| | 232 | |
|---|
| | 233 | end |
|---|
| | 234 | |
|---|