From 2efd5eb0fb09c1fa30c6c171e0c50579a3fbc38f Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 6 Feb 2012 11:16:06 -0500 Subject: [PATCH] fix more junk --- lib/vegetable_glue.rb | 2 +- lib/vegetable_glue/cucumber.rb | 4 +++- lib/vegetable_glue/routes.rb | 9 ++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/vegetable_glue.rb b/lib/vegetable_glue.rb index 9f54929..af5a102 100644 --- a/lib/vegetable_glue.rb +++ b/lib/vegetable_glue.rb @@ -9,7 +9,7 @@ module VegetableGlue CLEAN = '__clean__' class << self - attr_accessor :url, :path, :env + attr_accessor :url, :path, :env, :cleaning_style def shutdown Runner.new(options).shutdown diff --git a/lib/vegetable_glue/cucumber.rb b/lib/vegetable_glue/cucumber.rb index 0f212f9..be03cad 100644 --- a/lib/vegetable_glue/cucumber.rb +++ b/lib/vegetable_glue/cucumber.rb @@ -5,6 +5,8 @@ Before do |scenario| ENV.delete('REGLUE') end - VegetableGlue.clean(scenario.to_sexp[3]) + @scenario = scenario + + VegetableGlue.clean(@scenario.to_sexp[3]) end diff --git a/lib/vegetable_glue/routes.rb b/lib/vegetable_glue/routes.rb index 67a750b..46583b6 100644 --- a/lib/vegetable_glue/routes.rb +++ b/lib/vegetable_glue/routes.rb @@ -10,10 +10,13 @@ class ActionDispatch::Routing::Mapper get VegetableGlue::CLEAN => lambda { |env| 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 - Rails.logger.info "Cleaning database for #{scenario_name.last}" + DatabaseCleaner.clean_with :truncation + DatabaseCleaner.clean_with :deletion + + if params[:scenario] + Rails.logger.info "Cleaning database for #{params[:scenario]}" end [ 200, {}, [ VegetableGlue::CLEAN ] ]