Sha256: 861e503ac70ea4a9969e10ee108a508a05761f9dee001272933efd35fc79ed45

Contents?: true

Size: 786 Bytes

Versions: 3

Compression:

Stored size: 786 Bytes

Contents

require 'spec_helper'

require 'logger'

require 'observed/system'

describe Observed::System do
  subject {
    Observed::System.new(the_config)
  }

  context 'with observers configured' do

    let(:observers) {
      [observer]
    }

    let(:observer) {
      c = stub('observer')
      c.stubs(tag: 'bar')
      c
    }

    let(:context) {
      Observed::Context.new
    }

    let(:the_config) {
      c = stub('config')
      c.stubs(observers: observers)
      c
      { config: c, logger: Logger.new(STDOUT, Logger::DEBUG), context: context }
    }

    context 'when there is no matching observer for a tag' do
      it 'fails to run' do
        expect { subject.run('foo') }.to raise_error(/No configuration found for observation name 'foo'/)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
observed-0.2.0 spec/system_spec.rb
observed-0.2.0.rc2 spec/system_spec.rb
observed-0.2.0.rc1 spec/system_spec.rb