Aha! I hadn't thought to look on `TestCase`. Thanks! On Sunday, March 8, 2015 at 4:37:15 PM UTC-7, Matt jones wrote: > > > On Mar 6, 2015, at 12:59 AM, Brandon Weiss <bra...@anti-pattern.com > <javascript:>> wrote: > > Here's the method: > > def run_in_transaction? > use_transactional_fixtures && > !self.class.uses_transaction?(method_name) > end > > I'm super confused. What is `method_name`? And where does it come from? > It's not a local variable. I can find two instances of `def method_name` in > the repo and neither seem to be related. If I try to call the method > directly and `use_transactional_fixtures` is false I get `NameError: > undefined local variable or method `method_name'`. How is this working > normally? > > > `ActiveRecord::TestFixtures` is mixed into the test case class itself. > `method_name` is an alias for the `Test::Unit::TestCase#name` method, which > the test harness sets up every time an individual test is started up. > > The data maintained by `uses_transaction?` and friends is used to tell the > fixture system that a particular test uses transactions internally > (after_commit hooks, etc) and therefore *shouldn’t* be wrapped with a > transaction. You’d specify this by saying `uses_transaction > :name_of_test_that_uses_transactions` in your test case. > > —Matt Jones >
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.