From b17387a17669bfc9afce7435653cd8c29c686999 Mon Sep 17 00:00:00 2001 From: Azul Date: Sat, 12 Jul 2014 09:12:48 +0200 Subject: some cleanup of the messages api and cuke feature --- features/support/hooks.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'features/support/hooks.rb') diff --git a/features/support/hooks.rb b/features/support/hooks.rb index 19928d8..f11e602 100644 --- a/features/support/hooks.rb +++ b/features/support/hooks.rb @@ -5,6 +5,7 @@ After '@tempfile' do end end +# store end of server log for failing scenarios After do |scenario| if scenario.failed? logfile_path = Rails.root + 'tmp' @@ -16,3 +17,16 @@ After do |scenario| end end end + +# clear all records we created +After do + names = self.instance_variables.reject do |v| + v.to_s.starts_with?('@_') + end + names.each do |name| + record = self.instance_variable_get name + if record.is_a?(CouchRest::Model::Base) && record.persisted? + record.reload && record.destroy + end + end +end -- cgit v1.2.3