[rspec-users] adding to the callbacks that rspec-rails adds

Ben Fyvie ben.fyvie at champsoftware.com
Tue Feb 16 11:48:55 EST 2010


I have some code that adds to the callbacks that rspec-rails adds by default
to <a
href="http://github.com/dchelimsky/rspec-rails/blob/master/lib/spec/rails/in
terop/testcase.rb">setup and teardown fixtures</a>.

 

My code looks something like:

 

    module Test

      module Unit

 

        class TestCase

          append_before(:each) do

           Test::Unit::AfterFixturesLoaded.custom_stuff1

          end

 

          append_after(:each) do

            Test::Unit::AfterFixturesLoaded.custom_stuff2

          end

        end

 

        class AfterFixturesLoaded

 

          def self.custom_stuff1

            #do some stuff here

          end

 

          def self.custom_stuff2

            #do some other stuff here

          end

        end

 

      end

    end

 

This code works fine if I put it in the config\initializers directory in the
rails app, but then running the app fails because it doesn't load test unit.
So my question is where can I put this code so that it will always be
included when running rspec?

 

Thanks!

Ben Fyvie

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100216/cd95e9eb/attachment.html>


More information about the rspec-users mailing list