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

Ticket #10679 (closed defect: fixed)

Opened 6 months ago

Last modified 6 months ago

[PATCH] Move all testing setups to setup_with_framework method

Reported by: josh Assigned to: nzkoz
Priority: normal Milestone: 2.1
Component: ActiveSupport Version: edge
Severity: normal Keywords:
Cc:

Description

Refactors testing setup method to setup_with_framework for Rails to over with its setup procedure.

Fixes problem mention here http://dev.rubyonrails.org/ticket/10382#comment:10

Attachments

refactor_to_setup_with_framework.diff (69.8 kB) - added by josh on 01/05/08 09:17:54.

Change History

01/03/08 06:29:05 changed by josh

Some other framework tests are failing, not safe to commit yet.

01/03/08 20:30:49 changed by josh

Latest patch added. Tests are now good for me.

01/04/08 01:21:26 changed by bitsweat

  • milestone changed from 2.x to 2.1.

I still get some AP failures in its AR integration tests as well as a failure in an AR test attempting to alias setup_with_fixtures.

01/05/08 02:29:28 changed by bitsweat

Latest patch doesn't apply cleanly to activerecord/test/adapter_test_sqlserver.rb (maybe just different line endings?) and has some failures in the ActionPack AR integration tests.

01/05/08 09:17:54 changed by josh

  • attachment refactor_to_setup_with_framework.diff added.

01/05/08 09:20:24 changed by josh

Ugh, not going so good. I think framework tests are passing, but it doesn't really play well with a real app. I'm kind of burnt out from this patch. It also requires you to use ActiveSupport::TestCase instead of Test::Unit::TestCase if you want to get AR fixtures.

Need some fresh ideas.

01/05/08 09:48:47 changed by bitsweat

I've been banging my head against it tonight, too ;) Couldn't get it working compatibly.

01/05/08 13:34:43 changed by bitsweat

  • status changed from new to closed.
  • resolution set to fixed.

I added setup and teardown callback chains and got rid of method_added. [8570]

01/05/08 18:31:05 changed by josh

Nice. I like your callback approach. Refactor idea, ActiveSupport::Callbacks ;)

Eventually we'll move that out of TestUnit but I'm glad it works perfect with existing code.

01/07/08 15:44:17 changed by noelrap

  • status changed from closed to reopened.
  • resolution deleted.

This patch appears to break any test using the "shoulda" plugin, which uses the setup and teardown names, but within individual contexts. The shoulda-defined blocks are being called at the wrong time and all sorts of havoc is being wreaked. I'm also infoming the shoulda maintainers. I'm placing this here so that other people who have the same issue can find where the problem is. If you feel this should just be the plugin maintainers problem, then just close the ticket again. Thanks.

01/07/08 16:08:33 changed by bitsweat

  • status changed from reopened to closed.
  • resolution set to fixed.

The testing changes are going to collide with anyone using the same class method names or relying on the old internal setup method naming.

01/17/08 10:16:50 changed by railsjitsu

  • status changed from closed to reopened.
  • resolution deleted.

The changeset for this ticket is killing test database teardown (at least with rspec). See ticket http://dev.rubyonrails.org/ticket/10837

01/17/08 22:52:10 changed by josh

  • status changed from reopened to closed.
  • resolution set to fixed.

1. Thats RSpec's problem 2. Continue to post updates on the linked ticket