Sha256: 750a59452ba96f4472aa91df17187f50e1cb6ef75d7191beb13642caee903c12

Contents?: true

Size: 1.37 KB

Versions: 8

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe Reactor::Subscription do

  describe '.build_handler_name' do
    let(:event_name) { :kitten_sleeping }

    subject { described_class.build_handler_name(event_name) }

    it 'should camelize event name' do
      expect(subject).to eq('KittenSleepingHandler')
    end

    context 'with wildcard event name' do
      let(:event_name) { '*' }
      it { is_expected.to eq('WildcardHandler') }
    end

    context 'with handler name specified' do
      let(:result) { 'SleepyKittenHandler' }
      subject { described_class.build_handler_name(event_name, handler_name) }

      context 'as snake_cased' do
        let(:handler_name) { :sleepy_kitten_handler }
        it { is_expected.to eq(result) }
      end

      context 'as CamelCased' do
        let(:handler_name) { 'SleepyKittenHandler' }
        it { is_expected.to eq(result) }
      end
    end
  end

  describe 'building a new subscriptiong' do
    class SleepyKittenSubscriber ; end

    let(:source) { SleepyKittenSubscriber }
    let(:event_name) { :kitten_sleeping }
    let(:action) { double('Callable Action') }

    context 'for delayed async worker' do
      let(:delay) { 10.minutes }
    end

    context 'for synchronous runners' do
      let(:async) { false }
    end

    context 'with handler name specified' do
      let(:handler_name) { :sleepy_kitten_streaming_handler }
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
reactor-0.19.0 spec/subscription_spec.rb
reactor-0.18.0 spec/subscription_spec.rb
reactor-0.17.0 spec/subscription_spec.rb
reactor-0.16.1 spec/subscription_spec.rb
reactor-0.16.0 spec/subscription_spec.rb
reactor-0.15.1 spec/subscription_spec.rb
reactor-0.15.0 spec/subscription_spec.rb
reactor-0.14.0 spec/subscription_spec.rb