diff options
author | azul <azul@leap.se> | 2014-07-18 12:21:49 +0200 |
---|---|---|
committer | azul <azul@leap.se> | 2014-07-18 12:21:49 +0200 |
commit | bbd41c9bfd2cb88a88d7436dd58a8b46a5d10cf1 (patch) | |
tree | 00b39da219151473437c02ce35344117bcd5b2fa /features/support/hooks.rb | |
parent | ade74d8a9091ae607586d7b287a0579a2ee7af8e (diff) | |
parent | 20352249fa5dafe3abb2d4b751b1e5c8c0a59abc (diff) |
Merge pull request #180 from azul/feature/messages-api
Feature/messages api
Diffstat (limited to 'features/support/hooks.rb')
-rw-r--r-- | features/support/hooks.rb | 14 |
1 files changed, 14 insertions, 0 deletions
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 |