Sha256: b865b127de4405de763b99043d3afa14a1ad55a59bb2eacb2d68d96d8e1a3f4d

Contents?: true

Size: 1001 Bytes

Versions: 7

Compression:

Stored size: 1001 Bytes

Contents

# -*- coding: utf-8 -*-
require 'bundler'
require 'vcr'
# require 'webmock/rspec'

Bundler.require


VCR.configure do |c|
  c.cassette_library_dir = 'spec/cassettes'
  c.hook_into :webmock
  c.configure_rspec_metadata!
  c.allow_http_connections_when_no_cassette = true
  #c.default_cassette_options = { :record => :none }

  c.before_record do |i|
    i.request.body.sub!(/(&?client_id=)[^&]+/, '\1(CLIENT_ID)')
    i.request.body.sub!(/(&?client_secret=)[^&]+/, '\1(CLIENT_SECRET)')
    i.request.body.sub!(/(&?refresh_token=)[^&]+/, '\1(REFRESH_TOKEN)')
    i.request.uri.sub!(/((\?|&)?access_token=)[^&]+/, '\1(ACCESS_TOKEN)')

    begin
      response = JSON.parse i.response.body
      if response.key?('access_token')
        response['access_token'] = '(ACCESS_TOKEN)'
        response['refresh_token'] = '(REFRESH_TOKEN)'
        i.response.body = response.to_json
      end
    rescue
    end
  end
end


RSpec.configure do |c|
  c.treat_symbols_as_metadata_keys_with_true_values = true
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
typetalk-0.1.1 spec/spec_helper.rb
typetalk-0.1.0 spec/spec_helper.rb
typetalk-0.0.6 spec/spec_helper.rb
typetalk-0.0.5 spec/spec_helper.rb
typetalk-0.0.4 spec/spec_helper.rb
typetalk-0.0.3 spec/spec_helper.rb
typetalk-0.0.2 spec/spec_helper.rb