|
| 1 | +require 'rubygems' |
| 2 | +require 'spec' |
| 3 | +require 'database_cleaner' |
| 4 | +# require 'spork' |
| 5 | +# |
| 6 | +# Spork.prefork do |
| 7 | +# # Loading more in this block will cause your tests to run faster. However, |
| 8 | +# # if you change any configuration or code from libraries loaded here, you'll |
| 9 | +# # need to restart spork for it take effect. |
| 10 | +# |
| 11 | +# end |
| 12 | +# |
| 13 | +# Spork.each_run do |
| 14 | +# # This code will be run each time you run your specs. |
| 15 | +# |
| 16 | +# end |
| 17 | + |
| 18 | +# --- Instructions --- |
| 19 | +# - Sort through your spec_helper file. Place as much environment loading |
| 20 | +# code that you don't normally modify during development in the |
| 21 | +# Spork.prefork block. |
| 22 | +# - Place the rest under Spork.each_run block |
| 23 | +# - Any code that is left outside of the blocks will be ran during preforking |
| 24 | +# and during each_run! |
| 25 | +# - These instructions should self-destruct in 10 seconds. If they don't, |
| 26 | +# feel free to delete them. |
| 27 | +# |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | +Spec::Runner.configure do |config| |
| 33 | + # == Mock Framework |
| 34 | + # |
| 35 | + # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: |
| 36 | + # |
| 37 | + # config.mock_with :mocha |
| 38 | + # config.mock_with :flexmock |
| 39 | + # config.mock_with :rr |
| 40 | + config.mock_with :rspec |
| 41 | + |
| 42 | + # If you'd prefer not to run each of your examples within a transaction, |
| 43 | + # uncomment the following line. |
| 44 | + # config.use_transactional_examples = false |
| 45 | + |
| 46 | + config.before(:suite) do |
| 47 | + DatabaseCleaner.strategy = :truncation |
| 48 | + DatabaseCleaner.clean_with(:truncation) |
| 49 | + end |
| 50 | + |
| 51 | + config.before(:each) do |
| 52 | + DatabaseCleaner.start |
| 53 | + end |
| 54 | + |
| 55 | + config.after(:each) do |
| 56 | + DatabaseCleaner.clean |
| 57 | + end |
| 58 | +end |
| 59 | + |
0 commit comments