Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7319

Show
Ignore:
Timestamp:
08/15/07 03:57:17 (1 year ago)
Author:
nzkoz
Message:

Integration tests: introduce methods for other HTTP methods. Closes #6353. Merges [6203]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1-2-stable/actionpack/CHANGELOG

    r7185 r7319  
    11*SVN* 
     2 
     3* Integration tests: introduce methods for other HTTP methods.  #6353 [caboose] 
    24 
    35* Improve performance of action caching. Closes #8231 [skaes] 
  • branches/1-2-stable/actionpack/lib/action_controller/integration.rb

    r6797 r7319  
    501501    end 
    502502 
    503     %w(get post cookies assigns xml_http_request).each do |method| 
     503    %w(get post put head delete cookies assigns xml_http_request).each do |method| 
    504504      define_method(method) do |*args| 
    505505        reset! unless @integration_session 
  • branches/1-2-stable/actionpack/test/controller/integration_test.rb

    r6797 r7319  
    1212  module Integration 
    1313    class Session 
    14       def process 
     14      def process(*args) 
    1515      end 
    1616 
     
    196196end 
    197197 
     198class 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 
     217end 
     218 
     219# Tests that integration tests don't call Controller test methods for processing. 
     220# Integration tests have their own setup and teardown. 
     221class 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 
     233end 
     234 
    198235# TODO 
    199236# class MockCGITest < Test::Unit::TestCase