require 'spec_helper'

describe Hearst::Subscriber do

  it 'auto-registers itself with Hearst'
  it 'validates required parameters'
  it 'stores event and exchange configuration on class'
  it 'raises error if .process is not implemented'

end

require 'spec_helper'

describe Hearst::Subscriber do

  class TestSubscriber
    include Hearst::Subscriber
    subscribes event: 'foo/bar', exchange: 'foo-exchange'
  end

  it 'auto-registers itself with Hearst' do
    expect(Hearst.subscribers).to include(TestSubscriber)
  end

  it 'stores event and exchange configuration on class' do
    expect(TestSubscriber.event).to eq('foo/bar')
    expect(TestSubscriber.exchange).to eq('foo-exchange')
  end

  it 'raises error if .process is not implemented' do
    expect {
      TestSubscriber.process(pay: 'load')
    }.to raise_error(NotImplementedError)
  end

end

Test subscriber hooks for registering and processing
Test subscriber hooks for registering and processing
