We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Fork of dchelimsky/rspec-rails
Description: RSpec's official Ruby on Rails plugin
Clone URL: git://github.com/jdelStrother/rspec-rails.git
Call Rail's TestCase setup/teardown callbacks

Rails r8664 introducted ActiveSupport::Callbacks into TestCase, used for 
loading fixtures, among other things.
Ensure they're called when rspec runs vanilla TestCase tests.

Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>
Jonathan del Strother (author)
Fri Jul 11 15:48:27 -0700 2008
commit  d365303526f44d961349db22d3b94b0d092bf4e9
tree    ac7bebda48038992b554971d86d6f95d3d03e85c
parent  a43cd46b36c3b1cea722712e5fd05fab2f1eb7c0
...
12
13
14
 
15
...
12
13
14
15
16
0
@@ -12,3 +12,4 @@ require 'spec/rails/matchers'
0
 require 'spec/rails/mocks'
0
 require 'spec/rails/example'
0
 require 'spec/rails/extensions'
0
+require 'spec/rails/interop/testcase'
0
\ No newline at end of file
...
11
12
13
14
15
16
17
18
 
 
 
 
 
 
 
 
 
19
20
21
...
11
12
13
 
 
 
 
 
14
15
16
17
18
19
20
21
22
23
24
25
0
@@ -11,11 +11,15 @@ module Spec
0
       class RailsExampleGroup < Test::Unit::TestCase
0
         
0
         # Rails >= r8570 uses setup/teardown_fixtures explicitly
0
- before(:each) do
0
- setup_fixtures if self.respond_to?(:setup_fixtures)
0
- end
0
- after(:each) do
0
- teardown_fixtures if self.respond_to?(:teardown_fixtures)
0
+ # However, Rails >= r8664 extracted these out to use ActiveSupport::Callbacks.
0
+ # The latter case is handled at the TestCase level, in interop/testcase.rb
0
+ unless ActiveSupport.const_defined?(:Callbacks) and self.include?(ActiveSupport::Callbacks)
0
+ before(:each) do
0
+ setup_fixtures if self.respond_to?(:setup_fixtures)
0
+ end
0
+ after(:each) do
0
+ teardown_fixtures if self.respond_to?(:teardown_fixtures)
0
+ end
0
         end
0
         
0
         include Spec::Rails::Matchers

Comments

    No one has commented yet.