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

Changeset 5020

Show
Ignore:
Timestamp:
09/05/06 21:28:22 (2 years ago)
Author:
david
Message:

Better bundling of new assertions and make integration tests work again

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/assertions.rb

    r4935 r5020  
    4545  #  assert_redirected_to page_url(:title => 'foo') 
    4646  module Assertions 
     47    def self.included(klass) 
     48      klass.class_eval do 
     49        include ActionController::Assertions::ResponseAssertions 
     50        include ActionController::Assertions::SelectorAssertions 
     51        include ActionController::Assertions::RoutingAssertions 
     52        include ActionController::Assertions::TagAssertions 
     53        include ActionController::Assertions::DomAssertions 
     54        include ActionController::Assertions::ModelAssertions 
     55        include ActionController::Assertions::DeprecatedAssertions 
     56      end 
     57    end 
     58 
     59    def clean_backtrace(&block) 
     60      yield 
     61    rescue Test::Unit::AssertionFailedError => e          
     62      path = File.expand_path(__FILE__) 
     63      raise Test::Unit::AssertionFailedError, e.message, e.backtrace.reject { |line| File.expand_path(line) =~ /#{path}/ } 
     64    end 
    4765  end 
    4866end 
     
    5977  module Unit #:nodoc: 
    6078    class TestCase #:nodoc: 
    61       include ActionController::Assertions::ResponseAssertions 
    62       include ActionController::Assertions::SelectorAssertions 
    63       include ActionController::Assertions::RoutingAssertions 
    64       include ActionController::Assertions::TagAssertions 
    65       include ActionController::Assertions::DomAssertions 
    66       include ActionController::Assertions::ModelAssertions 
    67       include ActionController::Assertions::DeprecatedAssertions 
    68  
    69       def clean_backtrace(&block) 
    70         yield 
    71       rescue AssertionFailedError => e          
    72         path = File.expand_path(__FILE__) 
    73         raise AssertionFailedError, e.message, e.backtrace.reject { |line| File.expand_path(line) =~ /#{path}/ } 
    74       end 
     79      include ActionController::Assertions 
    7580    end 
    7681  end 
  • trunk/actionpack/lib/action_controller/integration.rb

    r4954 r5020  
    1414    # rather than instantiating Integration::Session directly. 
    1515    class Session 
    16       include Test::Unit::Assertions 
     16      include ActionController::Assertions 
    1717      include ActionController::TestProcess 
    1818