require "bugsnag/api" require "webmock/rspec" require "faker" require "vcr" require "uri" # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # Require this file using `require "spec_helper"` to ensure that it is only # loaded once. # # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| config.expect_with :rspec do |c| c.syntax = :expect end end # VCR VCR.configure do |c| c.cassette_library_dir = "spec/cassettes" c.hook_into :webmock c.configure_rspec_metadata! c.default_cassette_options = { :record => ENV['TRAVIS'] ? :none : :once, :match_requests_on => [:method, :path] } c.filter_sensitive_data("https://api.bugsnag.com") { Bugsnag::Api.configuration.endpoint } c.filter_sensitive_data("api.bugsnag.com") { URI.parse(Bugsnag::Api.configuration.endpoint).host } c.filter_sensitive_data("") { test_bugsnag_auth_token } c.filter_sensitive_data("") { CGI::escape(test_bugsnag_email) } c.filter_sensitive_data("") { test_bugsnag_email } c.filter_sensitive_data("") { test_bugsnag_password } c.filter_sensitive_data("") { test_bugsnag_account } c.filter_sensitive_data("") { test_bugsnag_comment } c.filter_sensitive_data("") { test_bugsnag_error } c.filter_sensitive_data("") { test_bugsnag_event } c.filter_sensitive_data("") { test_bugsnag_project } c.filter_sensitive_data("") { test_bugsnag_user } end def auth_token_client Bugsnag::Api.configure do |config| config.endpoint = test_bugsnag_endpoint end Bugsnag::Api::Client.new do |config| config.endpoint = test_bugsnag_endpoint config.auth_token = test_bugsnag_auth_token end end def basic_auth_client Bugsnag::Api.configure do |config| config.endpoint = test_bugsnag_endpoint end Bugsnag::Api::Client.new do |config| config.endpoint = test_bugsnag_endpoint config.email = test_bugsnag_email config.password = test_bugsnag_password end end def bugsnag_url(path) URI.join(Bugsnag::Api.configuration.endpoint, path).to_s end def basic_bugsnag_url(path, options = {}) url = File.join(Bugsnag::Api.configuration.endpoint, path) uri = Addressable::URI.parse(url) uri.user = options.fetch(:login, test_bugsnag_email) uri.password = options.fetch(:password, test_bugsnag_password) uri.to_s end def stub_get(url) stub_request(:get, bugsnag_url(url)) end def test_bugsnag_endpoint ENV["BUGSNAG_TEST_ENDPOINT"] || Bugsnag::Api::Configuration::DEFAULT_ENDPOINT end def test_bugsnag_auth_token ENV["BUGSNAG_TEST_AUTH_TOKEN"] || "x" * 32 end def test_bugsnag_email ENV["BUGSNAG_TEST_EMAIL"] || "example@bugsnag.com" end def test_bugsnag_password ENV["BUGSNAG_TEST_PASSWORD"] || "password" end def test_bugsnag_account ENV["BUGSNAG_TEST_ACCOUNT"] || "5404dc9064657377ae000002" end def test_bugsnag_comment ENV["BUGSNAG_TEST_COMMENT"] || "5404e0ea64657377ae00000b" end def test_bugsnag_error ENV["BUGSNAG_TEST_ERROR"] || "5404e0c435ec9cb116b13603" end def test_bugsnag_event ENV["BUGSNAG_TEST_EVENT"] || "5404e0c4fd9c7c077b000001" end def test_bugsnag_project ENV["BUGSNAG_TEST_PROJECT"] || "5404dc9c64657377ae000007" end def test_bugsnag_user ENV["BUGSNAG_TEST_USER"] || "5404dc9064657377ae000001" end