Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

stop depending on callbacks

  • Loading branch information...
commit 02acd95d5700ea868c34f5d260882fda3cc836d3 1 parent c79c698
@tenderlove tenderlove authored
Showing with 12 additions and 6 deletions.
  1. +12 −6 activerecord/lib/active_record/fixtures.rb
View
18 activerecord/lib/active_record/fixtures.rb
@@ -708,11 +708,18 @@ module ActiveRecord
module TestFixtures
extend ActiveSupport::Concern
- included do
- setup :setup_fixtures
- teardown :teardown_fixtures
+ def before_setup
+ setup_fixtures
+ super
+ end
+
+ def after_teardown
+ super
+ teardown_fixtures
+ end
- class_attribute :fixture_path
+ included do
+ class_attribute :fixture_path, :instance_writer => false
class_attribute :fixture_table_names
class_attribute :fixture_class_names
class_attribute :use_transactional_fixtures
@@ -765,8 +772,7 @@ def fixtures(*fixture_set_names)
def try_to_load_dependency(file_name)
require_dependency file_name
rescue LoadError => e
- # Let's hope the developer has included it himself
-
+ # Let's hope the developer has included it
# Let's warn in case this is a subdependency, otherwise
# subdependency error messages are totally cryptic
if ActiveRecord::Base.logger

4 comments on commit 02acd95

@alindeman

Hey @tenderlove!

What's the rationale for this change? Is Rails moving away from setup and teardown?

This has implications for rspec-rails, if so :) And I'm just curious.

@marcoow

Finally found the reason why my specs don't clean up the db anymore ;) @alindeman: is there branch of rspec-rails already that handles this?

@alindeman

Yes, can you try the rspec-rails' 2-13-maintenance branch? There are a few other changes there related to Rails 4: I'd appreciate you letting me know if it works well for you.

@marcoow

yep, that works great - thanks!

Please sign in to comment.
Something went wrong with that request. Please try again.