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

Changeset 8570

Show
Ignore:
Timestamp:
01/05/08 13:34:15 (11 months ago)
Author:
bitsweat
Message:

* Continue evolution toward ActiveSupport::TestCase and friends. #10679 [Josh Peek]

* TestCase: introduce declared setup and teardown callbacks. Pass a list of methods and an optional block to call before setup or after teardown. Setup callbacks are run in the order declared; teardown callbacks are run in reverse. [Jeremy Kemper]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionmailer/lib/action_mailer/test_case.rb

    r8536 r8570  
    99    end 
    1010  end 
    11   # New Test Super class for forward compatibility. 
    12   # To override 
     11 
    1312  class TestCase < ActiveSupport::TestCase 
    1413    include ActionMailer::Quoting 
     14 
     15    setup :initialize_test_deliveries 
     16    setup :set_expected_mail 
    1517 
    1618    class << self 
     
    3436    end 
    3537 
    36     def setup_with_mailer 
    37       ActionMailer::Base.delivery_method = :test 
    38       ActionMailer::Base.perform_deliveries = true 
    39       ActionMailer::Base.deliveries = [] 
     38    protected 
     39      def initialize_test_deliveries 
     40        ActionMailer::Base.delivery_method = :test 
     41        ActionMailer::Base.perform_deliveries = true 
     42        ActionMailer::Base.deliveries = [] 
     43      end 
    4044 
    41       @expected = TMail::Mail.new 
    42       @expected.set_content_type "text", "plain", { "charset" => charset } 
    43       @expected.mime_version = '1.0' 
    44     end 
    45     alias_method :setup, :setup_with_mailer 
    46  
    47     def self.method_added(method) 
    48       if method.to_s == 'setup' 
    49         unless method_defined?(:setup_without_mailer) 
    50           alias_method :setup_without_mailer, :setup 
    51           define_method(:setup) do 
    52             setup_with_mailer 
    53             setup_without_mailer 
    54           end 
    55         end 
     45      def set_expected_mail 
     46        @expected = TMail::Mail.new 
     47        @expected.set_content_type "text", "plain", { "charset" => charset } 
     48        @expected.mime_version = '1.0' 
    5649      end 
    57     end 
    5850 
    5951    private 
  • trunk/actionmailer/test/test_helper_test.rb

    r8565 r8570  
    1010 
    1111class TestHelperMailerTest < ActionMailer::TestCase 
    12  
    1312  def test_setup_sets_right_action_mailer_options 
    1413    assert_equal :test, ActionMailer::Base.delivery_method 
     
    118117 
    119118class AnotherTestHelperMailerTest < ActionMailer::TestCase 
    120  
    121119  tests TestHelperMailer 
    122120 
    123121  def setup 
    124     # Should not override ActionMailer setup methods 
    125122    @test_var = "a value" 
    126123  end 
    127124 
    128   def test_should_still_setup_mailer 
     125  def test_setup_shouldnt_conflict_with_mailer_setup 
    129126    assert @expected.is_a?(TMail::Mail) 
    130   end 
    131    
    132   def test_should_run_overridden_setup_method 
    133     assert @test_var 
     127    assert_equal 'a value', @test_var 
    134128  end 
    135129end 
  • trunk/actionpack/lib/action_controller/test_case.rb

    r8497 r8570  
    1111 
    1212  class TestCase < ActiveSupport::TestCase 
     13    module RaiseActionExceptions 
     14      def rescue_action(e) 
     15        raise e 
     16      end 
     17    end 
     18 
     19    setup :setup_controller_request_and_response 
     20 
    1321    @@controller_class = nil 
     22 
    1423    class << self 
    1524      def tests(controller_class) 
     
    2635          current_controller_class 
    2736        else 
    28           self.controller_class= determine_default_controller_class(name) 
     37          self.controller_class = determine_default_controller_class(name) 
    2938        end 
    3039      end 
     
    3746 
    3847      def prepare_controller_class(new_class) 
    39         new_class.class_eval do 
    40           def rescue_action(e) 
    41             raise e 
    42           end 
    43         end 
     48        new_class.send :include, RaiseActionExceptions 
    4449      end 
    4550    end 
    4651 
    47     def setup_with_controller 
     52    def setup_controller_request_and_response 
    4853      @controller = self.class.controller_class.new 
    4954      @request    = TestRequest.new 
    5055      @response   = TestResponse.new 
    5156    end 
    52     alias_method :setup, :setup_with_controller 
    53  
    54     def self.method_added(method) 
    55       if method.to_s == 'setup' 
    56         unless method_defined?(:setup_without_controller) 
    57           alias_method :setup_without_controller, :setup 
    58           define_method(:setup) do 
    59             setup_with_controller 
    60             setup_without_controller 
    61           end 
    62         end 
    63       end 
    64     end 
    6557 end 
    6658end 
  • trunk/actionpack/lib/action_controller/test_process.rb

    r8499 r8570  
    11require 'action_controller/assertions' 
     2require 'action_controller/test_case' 
    23 
    34module ActionController #:nodoc: 
  • trunk/actionpack/test/active_record_unit.rb

    r8564 r8570  
    8585end 
    8686 
    87 class ActiveRecordTestCase < Test::Unit::TestCase 
     87class ActiveRecordTestCase < ActiveSupport::TestCase 
    8888  # Set our fixture path 
    8989  if ActiveRecordTestConnector.able_to_connect 
  • trunk/actionpack/test/controller/test_test.rb

    r8564 r8570  
    614614end 
    615615 
    616 class ContentControllerTest < ActionController::TestCase 
    617   def setup 
    618     # Should not override ActionController setup methods 
    619   end 
    620  
    621   def test_should_still_setup_controller 
    622     assert_kind_of(ContentController, @controller) 
    623   end 
    624 end 
    625  
    626616class CrazyNameTest < ActionController::TestCase 
    627617  tests ContentController 
     618 
    628619  def test_controller_class_can_be_set_manually_not_just_inferred 
    629620    assert_equal ContentController, self.class.controller_class 
  • trunk/activerecord/lib/active_record/fixtures.rb

    r8561 r8570  
    22require 'yaml' 
    33require 'csv' 
    4  
    5 module YAML #:nodoc: 
    6   class Omap #:nodoc: 
    7     def keys;   map { |k, v| k } end 
    8     def values; map { |k, v| v } end 
     4require 'active_support/test_case' 
     5 
     6if RUBY_VERSION < '1.9' 
     7  module YAML #:nodoc: 
     8    class Omap #:nodoc: 
     9      def keys;   map { |k, v| k } end 
     10      def values; map { |k, v| v } end 
     11    end 
    912  end 
    1013end 
     
    3033# 
    3134# Unlike single-file fixtures, YAML fixtures are stored in a single file per model, which are placed in the directory appointed 
    32 # by <tt>Test::Unit::TestCase.fixture_path=(path)</tt> (this is automatically configured for Rails, so you can just 
     35# by <tt>ActiveSupport::TestCase.fixture_path=(path)</tt> (this is automatically configured for Rails, so you can just 
    3336# put your files in <your-rails-app>/test/fixtures/). The fixture file ends with the .yml file extension (Rails example: 
    3437# "<your-rails-app>/test/fixtures/web_sites.yml"). The format of a YAML fixture file looks like this: 
     
    9093# This type of fixture was the original format for Active Record that has since been deprecated in favor of the YAML and CSV formats. 
    9194# Fixtures for this format are created by placing text files in a sub-directory (with the name of the model) to the directory 
    92 # appointed by <tt>Test::Unit::TestCase.fixture_path=(path)</tt> (this is automatically configured for Rails, so you can just 
     95# appointed by <tt>ActiveSupport::TestCase.fixture_path=(path)</tt> (this is automatically configured for Rails, so you can just 
    9396# put your files in <your-rails-app>/test/fixtures/<your-model-name>/ -- like <your-rails-app>/test/fixtures/web_sites/ for the WebSite 
    9497# model). 
     
    116119#   require 'web_site' 
    117120# 
    118 #   class WebSiteTest < Test::Unit::TestCase 
     121#   class WebSiteTest < ActiveSupport::TestCase 
    119122#     def test_web_site_count 
    120123#       assert_equal 2, WebSite.count 
     
    126129# 
    127130#   ... 
    128 #   class WebSiteTest < Test::Unit::TestCase 
     131#   class WebSiteTest < ActiveSupport::TestCase 
    129132#     fixtures :web_sites # add more by separating the symbols with commas 
    130133#   ... 
     
    192195# They can also turn off auto-instantiation of fixture data since the feature is costly and often unused. 
    193196# 
    194 #   class FooTest < Test::Unit::TestCase 
     197#   class FooTest < ActiveSupport::TestCase 
    195198#     self.use_transactional_fixtures = true 
    196199#     self.use_instantiated_fixtures = false 
     
    843846  module Unit #:nodoc: 
    844847    class TestCase #:nodoc: 
     848      setup :setup_fixtures 
     849      teardown :teardown_fixtures 
     850 
    845851      superclass_delegating_accessor :fixture_path 
    846852      superclass_delegating_accessor :fixture_table_names 
     
    858864      self.fixture_class_names = {} 
    859865 
    860       def self.set_fixture_class(class_names = {}) 
    861         self.fixture_class_names = self.fixture_class_names.merge(class_names) 
    862       end 
    863  
    864       def self.fixtures(*table_names) 
    865         if table_names.first == :all 
    866           table_names = Dir["#{fixture_path}/*.yml"] + Dir["#{fixture_path}/*.csv"] 
    867           table_names.map! { |f| File.basename(f).split('.')[0..-2].join('.') } 
    868         else 
    869           table_names = table_names.flatten.map { |n| n.to_s } 
    870         end 
    871  
    872         self.fixture_table_names |= table_names 
    873         require_fixture_classes(table_names) 
    874         setup_fixture_accessors(table_names) 
    875       end 
    876  
    877       def self.require_fixture_classes(table_names = nil) 
    878         (table_names || fixture_table_names).each do |table_name| 
    879           file_name = table_name.to_s 
    880           file_name = file_name.singularize if ActiveRecord::Base.pluralize_table_names 
    881           begin 
    882             require_dependency file_name 
    883           rescue LoadError 
    884             # Let's hope the developer has included it himself 
    885           end 
    886         end 
    887       end 
    888  
    889       def self.setup_fixture_accessors(table_names = nil) 
    890         table_names = [table_names] if table_names && !table_names.respond_to?(:each) 
    891         (table_names || fixture_table_names).each do |table_name| 
    892           table_name = table_name.to_s.tr('.', '_') 
    893  
    894           define_method(table_name) do |*fixtures| 
    895             force_reload = fixtures.pop if fixtures.last == true || fixtures.last == :reload 
    896  
    897             @fixture_cache[table_name] ||= {} 
    898  
    899             instances = fixtures.map do |fixture| 
    900               @fixture_cache[table_name].delete(fixture) if force_reload 
    901  
    902               if @loaded_fixtures[table_name][fixture.to_s] 
    903                 @fixture_cache[table_name][fixture] ||= @loaded_fixtures[table_name][fixture.to_s].find 
    904               else 
    905                 raise StandardError, "No fixture with name '#{fixture}' found for table '#{table_name}'" 
     866      class << self 
     867        def set_fixture_class(class_names = {}) 
     868          self.fixture_class_names = self.fixture_class_names.merge(class_names) 
     869        end 
     870 
     871        def fixtures(*table_names) 
     872          if table_names.first == :all 
     873            table_names = Dir["#{fixture_path}/*.yml"] + Dir["#{fixture_path}/*.csv"] 
     874            table_names.map! { |f| File.basename(f).split('.')[0..-2].join('.') } 
     875          else 
     876            table_names = table_names.flatten.map { |n| n.to_s } 
     877          end 
     878 
     879          self.fixture_table_names |= table_names 
     880          require_fixture_classes(table_names) 
     881          setup_fixture_accessors(table_names) 
     882        end 
     883 
     884        def require_fixture_classes(table_names = nil) 
     885          (table_names || fixture_table_names).each do |table_name| 
     886            file_name = table_name.to_s 
     887            file_name = file_name.singularize if ActiveRecord::Base.pluralize_table_names 
     888            begin 
     889              require_dependency file_name 
     890            rescue LoadError 
     891              # Let's hope the developer has included it himself 
     892            end 
     893          end 
     894        end 
     895 
     896        def setup_fixture_accessors(table_names = nil) 
     897          table_names = [table_names] if table_names && !table_names.respond_to?(:each) 
     898          (table_names || fixture_table_names).each do |table_name| 
     899            table_name = table_name.to_s.tr('.', '_') 
     900 
     901            define_method(table_name) do |*fixtures| 
     902              force_reload = fixtures.pop if fixtures.last == true || fixtures.last == :reload 
     903 
     904              @fixture_cache[table_name] ||= {} 
     905 
     906              instances = fixtures.map do |fixture| 
     907                @fixture_cache[table_name].delete(fixture) if force_reload 
     908 
     909                if @loaded_fixtures[table_name][fixture.to_s] 
     910                  @fixture_cache[table_name][fixture] ||= @loaded_fixtures[table_name][fixture.to_s].find 
     911                else 
     912                  raise StandardError, "No fixture with name '#{fixture}' found for table '#{table_name}'" 
     913                end 
    906914              end 
     915 
     916              instances.size == 1 ? instances.first : instances 
    907917            end 
    908  
    909             instances.size == 1 ? instances.first : instances 
    910           end 
    911         end 
    912       end 
    913  
    914       def self.uses_transaction(*methods) 
    915         @uses_transaction = [] unless defined?(@uses_transaction) 
    916         @uses_transaction.concat methods.map(&:to_s) 
    917       end 
    918  
    919       def self.uses_transaction?(method) 
    920         @uses_transaction = [] unless defined?(@uses_transaction) 
    921         @uses_transaction.include?(method.to_s) 
     918          end 
     919        end 
     920 
     921        def uses_transaction(*methods) 
     922          @uses_transaction = [] unless defined?(@uses_transaction) 
     923          @uses_transaction.concat methods.map(&:to_s) 
     924        end 
     925 
     926        def uses_transaction?(method) 
     927          @uses_transaction = [] unless defined?(@uses_transaction) 
     928          @uses_transaction.include?(method.to_s) 
     929        end 
    922930      end 
    923931 
     
    927935      end 
    928936 
    929       def setup_with_fixtures 
    930         return unless defined?(ActiveRecord::Base) && !ActiveRecord::Base.configurations.blank? 
     937      def setup_fixtures 
     938        return unless defined?(ActiveRecord) && !ActiveRecord::Base.configurations.blank? 
    931939 
    932940        if pre_loaded_fixtures && !use_transactional_fixtures 
     
    956964        instantiate_fixtures if use_instantiated_fixtures 
    957965      end 
    958       alias_method :setup, :setup_with_fixtures 
    959  
    960       def teardown_with_fixtures 
    961         return unless defined?(ActiveRecord::Base) && !ActiveRecord::Base.configurations.blank? 
     966 
     967      def teardown_fixtures 
     968        return unless defined?(ActiveRecord) && !ActiveRecord::Base.configurations.blank? 
    962969 
    963970        unless use_transactional_fixtures? 
     
    971978        end 
    972979        ActiveRecord::Base.verify_active_connections! 
    973       end 
    974       alias_method :teardown, :teardown_with_fixtures 
    975  
    976       def self.method_added(method) 
    977         case method.to_s 
    978         when 'setup' 
    979           unless method_defined?(:setup_without_fixtures) 
    980             alias_method :setup_without_fixtures, :setup 
    981             define_method(:setup) do 
    982               setup_with_fixtures 
    983               setup_without_fixtures 
    984             end 
    985           end 
    986         when 'teardown' 
    987           unless method_defined?(:teardown_without_fixtures) 
    988             alias_method :teardown_without_fixtures, :teardown 
    989             define_method(:teardown) do 
    990               teardown_without_fixtures 
    991               teardown_with_fixtures 
    992             end 
    993           end 
    994         end 
    995980      end 
    996981 
  • trunk/activerecord/test/aaa_create_tables_test.rb

    r8365 r8570  
    22require 'abstract_unit' 
    33 
    4 class AAACreateTablesTest < Test::Unit::TestCase 
     4class AAACreateTablesTest < ActiveSupport::TestCase 
    55  self.use_transactional_fixtures = false 
    66 
  • trunk/activerecord/test/abstract_unit.rb

    r8060 r8570  
    1414QUOTED_TYPE = ActiveRecord::Base.connection.quote_column_name('type') unless Object.const_defined?(:QUOTED_TYPE) 
    1515 
    16 class Test::Unit::TestCase #:nodoc: 
     16class ActiveSupport::TestCase #:nodoc: 
    1717  self.fixture_path = File.dirname(__FILE__) + "/fixtures/" 
    1818  self.use_instantiated_fixtures = false 
  • trunk/activerecord/test/active_schema_test_mysql.rb

    r8481 r8570  
    11require 'abstract_unit' 
    22 
    3 class ActiveSchemaTest < Test::Unit::TestCase 
     3class ActiveSchemaTest < ActiveSupport::TestCase 
    44  def setup 
    55    ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do 
  • trunk/activerecord/test/adapter_test_sqlserver.rb

    r6297 r8570  
    44require 'fixtures/task' 
    55 
    6 class SqlServerAdapterTest < Test::Unit::TestCase 
     6class SqlServerAdapterTest < ActiveSupport::TestCase 
    77  class TableWithRealColumn < ActiveRecord::Base; end 
    88 
  • trunk/activerecord/test/adapter_test.rb

    r8481 r8570  
    11require 'abstract_unit' 
    22 
    3 class AdapterTest < Test::Unit::TestCase 
     3class AdapterTest < ActiveSupport::TestCase 
    44  def setup 
    55    @connection = ActiveRecord::Base.connection 
  • trunk/activerecord/test/aggregations_test.rb

    r8510 r8570  
    22require 'fixtures/customer' 
    33 
    4 class AggregationsTest < Test::Unit::TestCase 
     4class AggregationsTest < ActiveSupport::TestCase 
    55  fixtures :customers 
    66 
     
    110110end 
    111111 
    112 class OverridingAggregationsTest < Test::Unit::TestCase 
     112class OverridingAggregationsTest < ActiveSupport::TestCase 
    113113  class Name; end 
    114114  class DifferentName; end 
  • trunk/activerecord/test/ar_schema_test.rb

    r2817 r8570  
    44if ActiveRecord::Base.connection.supports_migrations?  
    55 
    6   class ActiveRecordSchemaTest < Test::Unit::TestCase 
     6  class ActiveRecordSchemaTest < ActiveSupport::TestCase 
    77    self.use_transactional_fixtures = false 
    88 
  • trunk/activerecord/test/association_inheritance_reload.rb

    r511 r8570  
    22require 'fixtures/company' 
    33 
    4 class AssociationInheritanceReloadTest < Test::Unit::TestCase 
     4class AssociationInheritanceReloadTest < ActiveSupport::TestCase 
    55  fixtures :companies 
    66 
  • trunk/activerecord/test/associations_test.rb

    r8504 r8570  
    1818require 'fixtures/reader' 
    1919 
    20 class AssociationsTest < Test::Unit::TestCase 
     20class AssociationsTest < ActiveSupport::TestCase 
    2121  fixtures :accounts, :companies, :developers, :projects, :developers_projects, 
    2222           :computers 
     
    7474end 
    7575  
    76 class AssociationProxyTest < Test::Unit::TestCase 
     76class AssociationProxyTest < ActiveSupport::TestCase 
    7777  fixtures :authors, :posts, :categorizations, :categories, :developers, :projects, :developers_projects 
    7878   
     
    167167end 
    168168 
    169 class HasOneAssociationsTest < Test::Unit::TestCase 
     169class HasOneAssociationsTest < ActiveSupport::TestCase 
    170170  fixtures :accounts, :companies, :developers, :projects, :developers_projects 
    171171 
     
    464464 
    465465 
    466 class HasManyAssociationsTest < Test::Unit::TestCase 
     466class HasManyAssociationsTest < ActiveSupport::TestCase 
    467467  fixtures :accounts, :companies, :developers, :projects, 
    468468           :developers_projects, :topics, :authors, :comments 
     
    11971197end 
    11981198 
    1199 class BelongsToAssociationsTest < Test::Unit::TestCase 
     1199class BelongsToAssociationsTest < ActiveSupport::TestCase 
    12001200  fixtures :accounts, :companies, :developers, :projects, :topics, 
    12011201           :developers_projects, :computers, :authors, :posts, :tags, :taggings 
     
    15731573 
    15741574 
    1575 class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase 
     1575class HasAndBelongsToManyAssociationsTest < ActiveSupport::TestCase 
    15761576  fixtures :accounts, :companies, :categories, :posts, :categories_posts, :developers, :projects, :developers_projects 
    15771577 
     
    21132113 
    21142114 
    2115 class OverridingAssociationsTest < Test::Unit::TestCase 
     2115class OverridingAssociationsTest < ActiveSupport::TestCase 
    21162116  class Person < ActiveRecord::Base; end 
    21172117  class DifferentPerson < ActiveRecord::Base; end 
  • trunk/activerecord/test/associations/callbacks_test.rb

    r8481 r8570  
    77require 'fixtures/developer' 
    88 
    9 class AssociationCallbacksTest < Test::Unit::TestCase 
     9class AssociationCallbacksTest < ActiveSupport::TestCase 
    1010  fixtures :posts, :authors, :projects, :developers 
    1111 
  • trunk/activerecord/test/associations/cascaded_eager_loading_test.rb

    r7460 r8570  
    99require 'fixtures/reply' 
    1010 
    11 class CascadedEagerLoadingTest < Test::Unit::TestCase 
     11class CascadedEagerLoadingTest < ActiveSupport::TestCase 
    1212  fixtures :authors, :mixins, :companies, :posts, :topics 
    1313 
     
    9696require 'fixtures/vertex' 
    9797require 'fixtures/edge' 
    98 class CascadedEagerLoadingTest < Test::Unit::TestCase 
     98class CascadedEagerLoadingTest < ActiveSupport::TestCase 
    9999  fixtures :edges, :vertices 
    100100 
  • trunk/activerecord/test/associations/eager_singularization_test.rb

    r6406 r8570  
    4040 
    4141 
    42 class EagerSingularizationTest < Test::Unit::TestCase 
     42class EagerSingularizationTest < ActiveSupport::TestCase 
    4343 
    4444  def setup 
  • trunk/activerecord/test/associations/eager_test.rb

    r8456 r8570  
    88require 'fixtures/reader' 
    99 
    10 class EagerAssociationTest < Test::Unit::TestCase 
     10class EagerAssociationTest < ActiveSupport::TestCase 
    1111  fixtures :posts, :comments, :authors, :categories, :categories_posts, 
    1212            :companies, :accounts, :tags, :people, :readers 
  • trunk/activerecord/test/associations/extension_test.rb

    r7504 r8570  
    55require 'fixtures/developer' 
    66 
    7 class AssociationsExtensionsTest < Test::Unit::TestCase 
     7class AssociationsExtensionsTest < ActiveSupport::TestCase 
    88  fixtures :projects, :developers, :developers_projects, :comments, :posts 
    99 
  • trunk/activerecord/test/associations/inner_join_association_test.rb

    r8499 r8570  
    66require 'fixtures/categorization' 
    77 
    8 class InnerJoinAssociationTest < Test::Unit::TestCase 
     8class InnerJoinAssociationTest < ActiveSupport::TestCase 
    99  fixtures :authors, :posts, :comments, :categories, :categories_posts, :categorizations 
    1010 
  • trunk/activerecord/test/associations/join_model_test.rb

    r8481 r8570  
    1313require 'fixtures/citation' 
    1414 
    15 class AssociationsJoinModelTest < Test::Unit::TestCase 
     15class AssociationsJoinModelTest < ActiveSupport::TestCase 
    1616  self.use_transactional_fixtures = false 
    1717  fixtures :posts, :authors, :categories, :categorizations, :comments, :tags, :taggings, :author_favorites, :vertices, :items, :books 
  • trunk/activerecord/test/attribute_methods_test.rb

    r7752 r8570  
    22require 'fixtures/topic' 
    33 
    4 class AttributeMethodsTest < Test::Unit::TestCase 
     4class AttributeMethodsTest < ActiveSupport::TestCase 
    55  fixtures :topics 
    66  def setup 
  • trunk/activerecord/test/base_test.rb

    r8554 r8570  
    7171end 
    7272 
    73 class BasicsTest < Test::Unit::TestCase 
     73class BasicsTest < ActiveSupport::TestCase 
    7474  fixtures :topics, :companies, :developers, :projects, :computers, :accounts, :minimalistics 
    7575 
  • trunk/activerecord/test/binary_test.rb

    r8185 r8570  
    1111  require 'fixtures/binary' 
    1212 
    13   class BinaryTest < Test::Unit::TestCase 
     13  class BinaryTest < ActiveSupport::TestCase 
    1414    FIXTURES = %w(flowers.jpg example.log) 
    1515 
  • trunk/activerecord/test/calculations_test.rb

    r7192 r8570  
    99end 
    1010 
    11 class CalculationsTest < Test::Unit::TestCase 
     11class CalculationsTest < ActiveSupport::TestCase 
    1212  fixtures :companies, :accounts, :topics 
    1313 
  • trunk/activerecord/test/callbacks_test.rb

    r6026 r8570  
    127127end 
    128128 
    129 class CallbacksTest < Test::Unit::TestCase 
     129class CallbacksTest < ActiveSupport::TestCase 
    130130  fixtures :developers 
    131131 
  • trunk/activerecord/test/class_inheritable_attributes_test.rb

    r3493 r8570  
    2020 
    2121 
    22 class ClassInheritableAttributesTest < Test::Unit::TestCase 
     22class ClassInheritableAttributesTest < ActiveSupport::TestCase 
    2323  def test_first_level 
    2424    assert_equal [ :one, :two ], B.read_inheritable_attribute("first") 
  • trunk/activerecord/test/column_alias_test.rb

    r3718 r8570  
    22require 'fixtures/topic' 
    33 
    4 class TestColumnAlias < Test::Unit::TestCase 
     4class TestColumnAlias < ActiveSupport::TestCase 
    55  fixtures :topics 
    66 
  • trunk/activerecord/test/connection_test_firebird.rb

    r6838 r8570  
    11require "#{File.dirname(__FILE__)}/abstract_unit" 
    22 
    3 class FirebirdConnectionTest < Test::Unit::TestCase 
     3class FirebirdConnectionTest < ActiveSupport::TestCase 
    44  def test_charset_properly_set 
    55    fb_conn = ActiveRecord::Base.connection.instance_variable_get(:@connection) 
  • trunk/activerecord/test/connection_test_mysql.rb

    r7667 r8570  
    11require "#{File.dirname(__FILE__)}/abstract_unit" 
    22 
    3 class MysqlConnectionTest < Test::Unit::TestCase 
     3class MysqlConnectionTest < ActiveSupport::TestCase 
    44  def setup 
    55    @connection = ActiveRecord::Base.connection 
  • trunk/activerecord/test/copy_table_test_sqlite.rb

    r7484 r8570  
    11require 'abstract_unit' 
    22 
    3 class CopyTableTest < Test::Unit::TestCase 
     3class CopyTableTest < ActiveSupport::TestCase 
    44  fixtures :companies, :comments 
    55   
  • trunk/activerecord/test/datatype_test_postgresql.rb

    r7329 r8570  
    2222end 
    2323 
    24 class PostgresqlDataTypeTest < Test::Unit::TestCase 
     24class PostgresqlDataTypeTest < ActiveSupport::TestCase 
    2525