Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move fixtures settings from AR::TestCase to railties test_help
  • Loading branch information
jeremy committed Nov 12, 2008
1 parent a0e7b99 commit b17eb65
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
12 changes: 1 addition & 11 deletions activerecord/lib/active_record/test_case.rb
@@ -1,18 +1,8 @@
require "active_support/test_case" require "active_support/test_case"
require "active_record/fixtures" require "active_record/fixtures"


module ActiveRecord module ActiveRecord
class TestCase < ActiveSupport::TestCase #:nodoc: class TestCase < ActiveSupport::TestCase #:nodoc:
include TestFixtures

self.fixture_path = FIXTURES_ROOT
self.use_instantiated_fixtures = false
self.use_transactional_fixtures = true

def create_fixtures(*table_names, &block)
Fixtures.create_fixtures(FIXTURES_ROOT, table_names, {}, &block)
end

def assert_date_from_db(expected, actual, message = nil) def assert_date_from_db(expected, actual, message = nil)
# SQL Server doesn't have a separate column type just for dates, # SQL Server doesn't have a separate column type just for dates,
# so the time is in the string and incorrectly formatted # so the time is in the string and incorrectly formatted
Expand Down
22 changes: 14 additions & 8 deletions railties/lib/test_help.rb
Expand Up @@ -7,16 +7,22 @@
require 'action_controller/integration' require 'action_controller/integration'
require 'action_mailer/test_case' if defined?(ActionMailer) require 'action_mailer/test_case' if defined?(ActionMailer)


require 'active_record/fixtures' if defined?(ActiveRecord)
class ActiveSupport::TestCase require 'active_record/test_case'
include ActiveRecord::TestFixtures require 'active_record/fixtures'
end
class ActiveSupport::TestCase
include ActiveRecord::TestFixtures
self.fixture_path = "#{RAILS_ROOT}/test/fixtures/"
self.use_instantiated_fixtures = false
self.use_transactional_fixtures = true
end


ActiveSupport::TestCase.fixture_path = "#{RAILS_ROOT}/test/fixtures/" ActionController::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
ActionController::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path


def create_fixtures(*table_names) def create_fixtures(*table_names, &block)
Fixtures.create_fixtures(ActiveSupport::TestCase.fixture_path, table_names) Fixtures.create_fixtures(ActiveSupport::TestCase.fixture_path, table_names, {}, &block)

This comment has been minimized.

Copy link
@alexeymuranov

alexeymuranov May 12, 2012

Contributor

@jeremy, is it ok to use Fixtures here without full namespace (ActiveRecord::Fixtures)?

I am trying to rename Fixtures to FixtureSet, i could do some other changes too.

Also this code looks very similar to https://github.com/rails/rails/blob/master/activerecord/test/cases/helper.rb#L83, i wonder if it cannot be somehow put in one place...

end
end end


begin begin
Expand Down

0 comments on commit b17eb65

Please sign in to comment.