Sha256: 60b8886022f456616b6395432d7b2fcd4059a5682f896df26eaf55ecc6938721

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

ENV['RACK_ENV'] = 'test'
require_relative "../lib/raygun.rb"
require "minitest/autorun"
require "minitest/pride"
require "timecop"
require "mocha/minitest"
require 'stringio'
require 'webmock/minitest'

class FakeLogger
  def initialize
    @logger = StringIO.new
  end

  def info(message)
    @logger.write(message)
  end

  def reset
    @logger.string = ""
  end

  def get
    @logger.string
  end
end

class NoApiKey < StandardError; end

class Raygun::IntegrationTest < Minitest::Unit::TestCase

  def setup
    Raygun.setup do |config|
      config.api_key = File.open(File.expand_path("~/.raygun4ruby-test-key"), "rb").read
      config.version = Raygun::VERSION
    end

  rescue Errno::ENOENT
    raise NoApiKey.new("Place a valid Raygun API key into ~/.raygun4ruby-test-key to run integration tests") unless api_key
  end

  def teardown
  end

end

class Raygun::UnitTest < MiniTest::Unit::TestCase

  def setup
    Raygun.configuration.api_key = "test api key"
  end

  def teardown
    reset_configuration
  end

  def fake_successful_entry
    stub_request(:post, 'https://api.raygun.io/entries').to_return(status: 202)
  end

  def reset_configuration
    Raygun.configuration = Raygun::Configuration.new
  end

  def setup_logging
    logger = FakeLogger.new
    Raygun.configuration.debug = true
    Raygun.configuration.logger = logger

    logger
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
raygun4ruby-3.2.3 test/test_helper.rb
raygun4ruby-3.2.3.pre test/test_helper.rb