Sha256: f51e7ae91e839a7e9505a0741e9d2f14c452511306eb61a420e7809823d68740

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require "spec_helper"

describe Bugsnag::Api do
  before do
    Bugsnag::Api.reset!
  end

  after do
    Bugsnag::Api.reset!
  end

  describe ".configure" do
    Bugsnag::Api::Configuration::KEYS.each do |key|
      it "sets the #{key.to_s.gsub('_', ' ')}" do
        Bugsnag::Api.configure do |config|
          config.send("#{key}=", key)
        end
        expect(Bugsnag::Api.configuration.instance_variable_get(:"@#{key}")).to eq(key)
      end
    end
  end

  describe ".configuration" do
    it "exposes the client's configuration" do
      expect(Bugsnag::Api.configuration).to eq(Bugsnag::Api.client.configuration)
    end
  end

  describe ".client" do
    it "creates a static Bugsnag::Api::Client" do
      expect(Bugsnag::Api.client).to be_kind_of(Bugsnag::Api::Client)
    end

    it "caches the static client" do
      expect(Bugsnag::Api.client).to be(Bugsnag::Api.client)
    end
  end

  describe ".reset" do
    it "should reset the static client" do
      client = Bugsnag::Api.client
      Bugsnag::Api.reset!
      expect(client).not_to eq(Bugsnag::Api.client)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bugsnag-api-3.0.0 spec/bugsnag/api_spec.rb
bugsnag-api-2.1.1 spec/bugsnag/api_spec.rb
bugsnag-api-2.1.0 spec/bugsnag/api_spec.rb
bugsnag-api-2.0.3 spec/bugsnag/api_spec.rb
bugsnag-api-2.0.2 spec/bugsnag/api_spec.rb