You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by lu...@redhat.com on 2013/03/07 23:57:42 UTC

[PATCH 4/6] RHEVM unit tests: allow triggering of rerecording with env var VCR_RECORD

From: David Lutterkort <lu...@redhat.com>

Setting VCR_RECORD=all will rerecord the fixtures
---
 server/tests/drivers/rhevm/common.rb | 9 ++++-----
 server/tests/test_helper.rb          | 8 ++++++++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/server/tests/drivers/rhevm/common.rb b/server/tests/drivers/rhevm/common.rb
index 88d7d36..0ddd6ea 100644
--- a/server/tests/drivers/rhevm/common.rb
+++ b/server/tests/drivers/rhevm/common.rb
@@ -26,9 +26,8 @@ VCR.configure do |c|
     u.password = "secret"
     i.request.uri = u.to_s
   end
-  # Set :record to :all, when re-recording and between re-record attemps
-  # be sure to clear fixtures/*.yml files which can be done with "git checkout".
-  # e.g.:
-  # c.default_cassette_options = { :record => :all }
-  c.default_cassette_options = { :record => :none, :match_requests_on => [ :method, :path, :query ] }
+  c.default_cassette_options = {
+    :record => vcr_record_mode,
+    :match_requests_on => [ :method, :path, :query ]
+  }
 end
diff --git a/server/tests/test_helper.rb b/server/tests/test_helper.rb
index 55d2ff5..9d37ccf 100644
--- a/server/tests/test_helper.rb
+++ b/server/tests/test_helper.rb
@@ -45,6 +45,14 @@ def record_retries(name='', opts = {})
   opts
 end
 
+def vcr_record_mode
+  (ENV['VCR_RECORD'] || :none).to_sym
+end
+
+def vcr_recording?
+  vcr_record_mode != :none
+end
+
 include Rack::Test::Methods
 
 def run_frontend(frontend=:deltacloud)
-- 
1.8.1.4