Sha256: ac29fca75354bdcec88d956e2a66e83e410cc54b19e2512cd8ab0f554d35697f

Contents?: true

Size: 1.38 KB

Versions: 9

Compression:

Stored size: 1.38 KB

Contents

require File::expand_path('../../spec_helper', __FILE__)
require 'opbeat'

describe Opbeat::Configuration do
  before do
    # Make sure we reset the env in case something leaks in
    ENV.delete('OPBEAT_ORGANIZATION_ID')
    ENV.delete('OPBEAT_APP_ID')
    ENV.delete('OPBEAT_SECRET_TOKEN')
  end

  shared_examples 'a complete configuration' do
    it 'should have a server' do
      expect(subject[:server]).to eq('http://opbeat.localdomain/opbeat')
    end

    it 'should have an secret token' do
      expect(subject[:secret_token]).to eq('67890')
    end

    it 'should have an organization ID' do
      expect(subject[:organization_id]).to eq('42')
    end

    it 'should have an app ID' do
      expect(subject[:app_id]).to eq('43')
    end
  end

  context 'being initialized with options' do
    before do
      subject.server = 'http://opbeat.localdomain/opbeat'
      subject.secret_token = '67890'
      subject.organization_id = '42'
      subject.app_id = '43'
    end
    it_should_behave_like 'a complete configuration'
  end

  context 'being initialized with an environment variable' do
    subject do
      ENV['OPBEAT_ORGANIZATION_ID'] = '42'
      ENV['OPBEAT_APP_ID'] = '43'
      ENV['OPBEAT_SECRET_TOKEN'] = '67890'
      ENV['OPBEAT_SERVER'] = 'http://opbeat.localdomain/opbeat'
      Opbeat::Configuration.new
    end
    it_should_behave_like 'a complete configuration'
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
kuende-opbeat-2.0.4 spec/opbeat/configuration_spec.rb
kuende-opbeat-2.0.3 spec/opbeat/configuration_spec.rb
kuende-opbeat-2.0.2 spec/opbeat/configuration_spec.rb
kuende-opbeat-2.0.1 spec/opbeat/configuration_spec.rb
opbeat-2.0.0 spec/opbeat/configuration_spec.rb
opbeat-1.1.1 spec/opbeat/configuration_spec.rb
opbeat-1.1.0 spec/opbeat/configuration_spec.rb
opbeat-1.0.0 spec/opbeat/configuration_spec.rb
opbeat-0.9.2 spec/opbeat/configuration_spec.rb