Sha256: e5a5a594c6e140be4676525d1277204376234fcda1e7a5957400a699528ec6c8

Contents?: true

Size: 1.45 KB

Versions: 7

Compression:

Stored size: 1.45 KB

Contents

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

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
    FakeWeb.allow_net_connect = false
    Raygun.configuration.api_key = "test api key"
  end

  def fake_successful_entry
    FakeWeb.register_uri(:post, "https://api.raygun.io/entries", body: "", status: 202)
  end

  def teardown
    FakeWeb.clean_registry
    FakeWeb.allow_net_connect = true
    reset_configuration
  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

7 entries across 7 versions & 1 rubygems

Version Path
raygun4ruby-2.6.0 test/test_helper.rb
raygun4ruby-2.5.0 test/test_helper.rb
raygun4ruby-2.4.1 test/test_helper.rb
raygun4ruby-2.4.0 test/test_helper.rb
raygun4ruby-2.3.0 test/test_helper.rb
raygun4ruby-2.2.0 test/test_helper.rb
raygun4ruby-2.1.0 test/test_helper.rb