Sha256: 6a5c9a8bc436663f8b17015f7de331d496ee2e75a4b5824a96b3226e14d894ee

Contents?: true

Size: 725 Bytes

Versions: 22

Compression:

Stored size: 725 Bytes

Contents

require 'spec_helper'

describe Fluffle::Handlers::Dispatcher do
  before do
    @handler = Fluffle::Handlers::Dispatcher.new

    @handler.handle('double_it') { |arg| arg * 2 }
  end

  it 'calls the method with the params on the delegated object' do
    result = @handler.call id: 'abc123',
                           method: 'double_it',
                           params: [2],
                           meta: {}

    expect(result).to eq(4)
  end

  it 'raises error if method not configured' do
    expect {
      @handler.call id: 'def456',
                    method: 'doesnt_exist',
                    params: ['whatever'],
                    meta: {}
    }.to raise_error(NoMethodError, /doesnt_exist/)
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
fluffle-1.1.0 spec/handlers/dispatcher_spec.rb
fluffle-1.0.1 spec/handlers/dispatcher_spec.rb
fluffle-1.0.0 spec/handlers/dispatcher_spec.rb
fluffle-0.9.1 spec/handlers/dispatcher_spec.rb
fluffle-0.9.0 spec/handlers/dispatcher_spec.rb
fluffle-0.8.1 spec/handlers/dispatcher_spec.rb
fluffle-0.8.0 spec/handlers/dispatcher_spec.rb
fluffle-0.7.2 spec/handlers/dispatcher_spec.rb
fluffle-0.7.1 spec/handlers/dispatcher_spec.rb
fluffle-0.7.0 spec/handlers/dispatcher_spec.rb
fluffle-0.6.3 spec/handlers/dispatcher_spec.rb
fluffle-0.6.2 spec/handlers/dispatcher_spec.rb
fluffle-0.6.1 spec/handlers/dispatcher_spec.rb
fluffle-0.6.0 spec/handlers/dispatcher_spec.rb
fluffle-0.5.2 spec/handlers/dispatcher_spec.rb
fluffle-0.5.1 spec/handlers/dispatcher_spec.rb
fluffle-0.5.0 spec/handlers/dispatcher_spec.rb
fluffle-0.4.0 spec/handlers/dispatcher_spec.rb
fluffle-0.3.1 spec/handlers/dispatcher_spec.rb
fluffle-0.3.0 spec/handlers/dispatcher_spec.rb