| | 146 | class IntegrationTestTest < Test::Unit::TestCase |
|---|
| | 147 | |
|---|
| | 148 | def setup |
|---|
| | 149 | @test = ::ActionController::IntegrationTest.new(:default_test) |
|---|
| | 150 | @test.class.stubs(:fixture_table_names).returns([]) |
|---|
| | 151 | @session = @test.open_session |
|---|
| | 152 | end |
|---|
| | 153 | |
|---|
| | 154 | def test_opens_new_session |
|---|
| | 155 | @test.class.expects(:fixture_table_names).times(2).returns(['foo']) |
|---|
| | 156 | |
|---|
| | 157 | session1 = @test.open_session { |sess| } |
|---|
| | 158 | session2 = @test.open_session # implicit session |
|---|
| | 159 | |
|---|
| | 160 | assert_equal ::ActionController::Integration::Session, session1.class |
|---|
| | 161 | assert_equal ::ActionController::Integration::Session, session2.class |
|---|
| | 162 | assert_not_equal session1, session2 |
|---|
| | 163 | end |
|---|
| | 164 | |
|---|
| | 165 | end |
|---|
| | 166 | |
|---|
| | 167 | # Tests that integration tests don't call Controller test methods for processing. |
|---|
| | 168 | # Integration tests have their own setup and teardown. |
|---|
| | 169 | class IntegrationTestUsesCorrectClass < ActionController::IntegrationTest |
|---|
| | 170 | |
|---|
| | 171 | def self.fixture_table_names |
|---|
| | 172 | [] |
|---|
| | 173 | end |
|---|
| | 174 | |
|---|
| | 175 | def test_integration_methods_called |
|---|
| | 176 | %w( get post head put delete ).each do |verb| |
|---|
| | 177 | assert_nothing_raised("'#{verb}' should use integration test methods") { send(verb, '/') } |
|---|
| | 178 | end |
|---|
| | 179 | end |
|---|
| | 180 | |
|---|
| | 181 | end |
|---|
| | 182 | |
|---|