Sha256: a7da24017b08e42397bc35742c33fcefd11afeb387487f7c54421798422d02c4

Contents?: true

Size: 1.3 KB

Versions: 12

Compression:

Stored size: 1.3 KB

Contents

require 'rollbar'
require 'rollbar/notifier'

describe Rollbar::Notifier do
  describe '#scope' do
    let(:new_scope) do
      { 'foo' => 'bar' }
    end
    let(:new_config) do
      { 'environment' => 'foo' }
    end

    it 'creates a new notifier with merged scope and configuration' do
      new_notifier = subject.scope(new_scope, new_config)

      expect(new_notifier).not_to be(subject)
      expect(subject.configuration.environment).to be_eql(nil)
      expect(new_notifier.configuration.environment).to be_eql('foo')
      expect(new_notifier.scope_object['foo']).to be_eql('bar')
      expect(new_notifier.configuration).not_to be(subject.configuration)
      expect(new_notifier.scope_object).not_to be(subject.scope_object)
    end
  end

  describe '#scope!' do
    let(:new_scope) do
      { 'foo' => 'bar' }
    end
    let(:new_config) do
      { 'environment' => 'foo' }
    end

    it 'mutates the notifier with a merged scope and configuration' do
      result = subject.scope!(new_scope, new_config)

      expect(result).to be(subject)
      expect(subject.configuration.environment).to be_eql('foo')
      expect(subject.scope_object['foo']).to be_eql('bar')
      expect(subject.configuration).to be(subject.configuration)
      expect(subject.scope_object).to be(subject.scope_object)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rollbar-2.15.5 spec/rollbar/notifier_spec.rb
rollbar-2.15.4 spec/rollbar/notifier_spec.rb
rollbar-2.15.3 spec/rollbar/notifier_spec.rb
rollbar-2.15.2 spec/rollbar/notifier_spec.rb
rollbar-2.15.1 spec/rollbar/notifier_spec.rb
rollbar-2.15.0 spec/rollbar/notifier_spec.rb
rollbar-2.14.1 spec/rollbar/notifier_spec.rb
rollbar-2.14.0 spec/rollbar/notifier_spec.rb
rollbar-2.13.3 spec/rollbar/notifier_spec.rb
rollbar-2.13.2 spec/rollbar/notifier_spec.rb
rollbar-2.13.1 spec/rollbar/notifier_spec.rb
rollbar-2.13.0 spec/rollbar/notifier_spec.rb