spec/spec_helper.rb in hawkular-client-0.2.1 vs spec/spec_helper.rb in hawkular-client-0.2.2
- old
+ new
@@ -32,16 +32,15 @@
)
end
end
module Hawkular::Operations::RSpec
- SLEEP_SECONDS = 0.04
- MAX_ATTEMPTS = 60
+ SLEEP_SECONDS = 0.05
+ MAX_ATTEMPTS = 50
def wait_for(object)
- fast = VCR::WebSocket.cassette && !VCR::WebSocket.cassette.recording?
- sleep_interval = SLEEP_SECONDS * (fast ? 1 : 10)
+ sleep_interval = SLEEP_SECONDS * (ENV['VCR_OFF'] == '1' ? 1 : 10)
attempt = 0
sleep sleep_interval while object[:data].nil? && (attempt += 1) < MAX_ATTEMPTS
if attempt == MAX_ATTEMPTS
puts 'timeout hit'
{}
@@ -53,19 +52,20 @@
RSpec.configure do |config|
config.include Hawkular::Metrics::RSpec
config.include Hawkular::Operations::RSpec
- # skip the tests that have the :skip metadata on them
- config.filter_run_excluding :skip
+ # skip the tests that require websocket communication (cannot be recorded by VCR)
+ if ENV['WEBSOCKET_ON'].nil? || ENV['WEBSOCKET_ON'] != '1'
+ config.filter_run_excluding :websocket
+ end
# Sometimes one wants to check if the real api has
# changed, so turn off VCR and use live connections
# instead of recorded cassettes
if ENV['VCR_OFF'] == '1'
VCR.eject_cassette
VCR.turn_off!(ignore_cassettes: true)
- VCR::WebSocket.turn_off!
WebMock.allow_net_connect!
puts 'VCR is turned off!'
end
end