summaryrefslogtreecommitdiff
path: root/features/support
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-07-12 09:12:48 +0200
committerAzul <azul@leap.se>2014-07-17 12:47:47 +0200
commitb17387a17669bfc9afce7435653cd8c29c686999 (patch)
tree70410bf1df84d88a2c400c7e5c2a78e4550d0126 /features/support
parentade74d8a9091ae607586d7b287a0579a2ee7af8e (diff)
some cleanup of the messages api and cuke feature
Diffstat (limited to 'features/support')
-rw-r--r--features/support/hooks.rb14
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