Sha256: d8052d2f18dd310ab9b5cc2cf92987e0ad7b75996ee25364743c7175680ec200
Contents?: true
Size: 1.36 KB
Versions: 3
Compression:
Stored size: 1.36 KB
Contents
require 'spec_helper' describe Deluge::Rpc::Namespace do let(:connection) do double('RpcConnection').tap do |connection| allow(connection).to receive(:call) end end let(:instance) { described_class.new('root', connection) } describe '#register_namespace' do let(:result) { instance.register_namespace('test') } it 'register new namespace' do expect(result).to eq(instance.namespaces[:test]) end it 'returns registered namespace' do expect(result).to be_a(described_class).and have_attributes(name: 'root.test') end it 'returns existing namespace if its already registered' do expect(instance.register_namespace('test')).to eql(result) end it 'creates namespace access instance method' do expect(result).to eq(instance.test) end end describe '#register_method' do before do instance.register_method('test') end it 'register new api method' do expect(instance.api_methods).to include('root.test') end it 'create instance method' do expect(instance).to respond_to(:test) end end describe 'api access instance method' do before do instance.register_method('test') instance.test('hello', 'world') end it 'invoke api call' do expect(connection).to have_received(:call).with('root.test', 'hello', 'world') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
deluge-rpc-0.2.2 | spec/deluge/api/namespace_spec.rb |
deluge-rpc-0.2.0 | spec/deluge/api/namespace_spec.rb |
deluge-rpc-0.1.3 | spec/deluge/api/namespace_spec.rb |