fix more junk

This commit is contained in:
John Bintz 2012-02-06 11:16:06 -05:00
parent 24f2bf7965
commit 2efd5eb0fb
3 changed files with 10 additions and 5 deletions

View File

@ -9,7 +9,7 @@ module VegetableGlue
CLEAN = '__clean__' CLEAN = '__clean__'
class << self class << self
attr_accessor :url, :path, :env attr_accessor :url, :path, :env, :cleaning_style
def shutdown def shutdown
Runner.new(options).shutdown Runner.new(options).shutdown

View File

@ -5,6 +5,8 @@ Before do |scenario|
ENV.delete('REGLUE') ENV.delete('REGLUE')
end end
VegetableGlue.clean(scenario.to_sexp[3]) @scenario = scenario
VegetableGlue.clean(@scenario.to_sexp[3])
end end

View File

@ -10,10 +10,13 @@ class ActionDispatch::Routing::Mapper
get VegetableGlue::CLEAN => lambda { |env| get VegetableGlue::CLEAN => lambda { |env|
require 'database_cleaner' require 'database_cleaner'
DatabaseCleaner.clean_with :truncation params = Hash[URI.decode_www_form(env['QUERY_STRING'])]
if scenario_name = URI.decode_www_form(env['QUERY_STRING']).first DatabaseCleaner.clean_with :truncation
Rails.logger.info "Cleaning database for #{scenario_name.last}" DatabaseCleaner.clean_with :deletion
if params[:scenario]
Rails.logger.info "Cleaning database for #{params[:scenario]}"
end end
[ 200, {}, [ VegetableGlue::CLEAN ] ] [ 200, {}, [ VegetableGlue::CLEAN ] ]