Sha256: 71556ba74beadd45f433b3d3b80a15f03f3e77f80e5529afadc084a9a29178e2

Contents?: true

Size: 1.38 KB

Versions: 5

Compression:

Stored size: 1.38 KB

Contents

ENV['RAILS_ENV'] ||= 'test'

require 'coveralls'
Coveralls.wear!('rails')

# https://github.com/colszowka/simplecov
require 'simplecov'
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
SimpleCov.start do
  add_filter 'bin/console'
end

require 'facebook_ads'
require 'minitest/autorun'
require 'vcr'
require 'awesome_print'

VCR.configure do |config|
  config.cassette_library_dir = 'test/vcr_cassettes'
  config.hook_into :webmock
  config.filter_sensitive_data('TEST_ACCESS_TOKEN') do
    begin
      File.read('test_access_token').chop
    rescue Errno::ENOENT
      'TEST_ACCESS_TOKEN'
    end
  end
  config.filter_sensitive_data('TEST_BUSINESS_ID') do
    begin
      File.read('test_business_id').chop
    rescue Errno::ENOENT
      'TEST_BUSINESS_ID'
    end
  end
end

class BaseTest < Minitest::Test
  protected

  def setup
    FacebookAds.access_token = begin
      File.read('test_access_token').chop
    rescue Errno::ENOENT
      'TEST_ACCESS_TOKEN'
    end

    FacebookAds.business_id = begin
      File.read('test_business_id').chop
    rescue Errno::ENOENT
      'TEST_BUSINESS_ID'
    end

    # FacebookAds.logger = Logger.new(STDOUT)
    # FacebookAds.logger.level = Logger::Severity::DEBUG
  end

  def vcr
    calling_method = caller[0][/`.*'/][1..-2]

    VCR.use_cassette("#{self.class.name}-#{calling_method}", match_requests_on: [:host, :path]) do
      yield
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
facebook_ads-0.1.11 test/test_helper.rb
facebook_ads-0.1.10 test/test_helper.rb
facebook_ads-0.1.9 test/test_helper.rb
facebook_ads-0.1.8 test/test_helper.rb
facebook_ads-0.1.7 test/test_helper.rb