Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

freerange/test_startup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test Startup

Adds test-case wide startup and shutdown hooks to test/unit (or shoulda). Here's an example:

require "test_startup"

class MyTest < Test::Unit::TestCase

  startup do
    start_some_server
  end
  
  def test_should_access_server_properly
    # whatever
  end
  
  def test_should_do_other_servery_things
    # also, whatever
  end
  
  shutdown do
    stop_the_server
  end
  
end

This avoids the overhead of starting the server for each and every test case.

Caveats

You should probably think long and hard about whether or not you need this. In general, it's a good idea to have each test operate independently of each other, and this technique is only useful when it takes so long to setup the server (for example) that performing that for every test is not practical.

About

Startup and shutdown methods for test/unit or shoulda in Ruby 1.8

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages