Permalink
Browse files

stop depending on callbacks

  • Loading branch information...
tenderlove committed Apr 4, 2013
1 parent c79c698 commit 02acd95d5700ea868c34f5d260882fda3cc836d3
Showing with 12 additions and 6 deletions.
  1. +12 −6 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

This comment has been minimized.

Show comment Hide comment
@alindeman

alindeman Apr 6, 2013

Contributor

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.

Contributor

alindeman replied Apr 6, 2013

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

This comment has been minimized.

Show comment Hide comment
@marcoow

marcoow Apr 16, 2013

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?

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

This comment has been minimized.

Show comment Hide comment
@alindeman

alindeman Apr 16, 2013

Contributor

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.

Contributor

alindeman replied Apr 16, 2013

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

This comment has been minimized.

Show comment Hide comment
@marcoow

marcoow Apr 16, 2013

yep, that works great - thanks!

yep, that works great - thanks!

Please sign in to comment.