Sha256: f74fef7ea7231a31992a8eba23c243c61effdbd17751e25d58a90f76d648a32c

Contents?: true

Size: 1.19 KB

Versions: 17

Compression:

Stored size: 1.19 KB

Contents

require 'unit_spec_helper'

describe Rpush::Daemon::ServiceConfigMethods do
  module ServiceConfigMethodsSpec
    extend Rpush::Daemon::ServiceConfigMethods
    class Delivery; end
  end

  it 'returns the delivery class' do
    ServiceConfigMethodsSpec.delivery_class.should eq ServiceConfigMethodsSpec::Delivery
  end

  it 'instantiates loops' do
    loop_class = Class.new
    app = double
    loop_instance = loop_class.new
    loop_class.should_receive(:new).with(app).and_return(loop_instance)
    ServiceConfigMethodsSpec.loops loop_class
    ServiceConfigMethodsSpec.loop_instances(app).should eq [loop_instance]
  end

  it 'returns a new dispatcher' do
    ServiceConfigMethodsSpec.dispatcher :http, an: :option
    app = double
    dispatcher = double
    Rpush::Daemon::Dispatcher::Http.should_receive(:new).with(app, ServiceConfigMethodsSpec::Delivery, an: :option).and_return(dispatcher)
    ServiceConfigMethodsSpec.new_dispatcher(app).should eq dispatcher
  end

  it 'raises a NotImplementedError for an unknown dispatcher type' do
    expect do
      ServiceConfigMethodsSpec.dispatcher :unknown
      ServiceConfigMethodsSpec.dispatcher_class
    end.to raise_error(NotImplementedError)
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rpush-2.3.1-java spec/unit/daemon/service_config_methods_spec.rb
rpush-2.3.1 spec/unit/daemon/service_config_methods_spec.rb
rpush-2.3.0-java spec/unit/daemon/service_config_methods_spec.rb
rpush-2.3.0 spec/unit/daemon/service_config_methods_spec.rb
rpush-2.3.0.rc1 spec/unit/daemon/service_config_methods_spec.rb
rpush-2.2.0-java spec/unit/daemon/service_config_methods_spec.rb
rpush-2.2.0 spec/unit/daemon/service_config_methods_spec.rb
rpush-2.1.0-java spec/unit/daemon/service_config_methods_spec.rb
rpush-2.1.0 spec/unit/daemon/service_config_methods_spec.rb
rpush-2.0.1-java spec/unit/daemon/service_config_methods_spec.rb
rpush-2.0.1 spec/unit/daemon/service_config_methods_spec.rb
rpush-2.0.0-java spec/unit/daemon/service_config_methods_spec.rb
rpush-2.0.0 spec/unit/daemon/service_config_methods_spec.rb
rpush-2.0.0.rc1-java spec/unit/daemon/service_config_methods_spec.rb
rpush-2.0.0.rc1 spec/unit/daemon/service_config_methods_spec.rb
rpush-2.0.0.beta2 spec/unit/daemon/service_config_methods_spec.rb
rpush-2.0.0.beta1 spec/unit/daemon/service_config_methods_spec.rb