Sha256: a7494bc8a1d205f43d713299f2c64b0e61ffad80a0bc6ff951b8a25eed17d593

Contents?: true

Size: 1.54 KB

Versions: 14

Compression:

Stored size: 1.54 KB

Contents

class Arachni::RPC::Server::Dispatcher
class Handler::Echo < Handler

    private :instances
    public  :instances

    def test_dispatcher
        dispatcher.class == Arachni::RPC::Server::Dispatcher
    end

    def test_opts
        dispatcher.instance_eval{ @opts } == opts
    end

    def test_node
        node.class == Node
    end

    def test_map_instances( &block )
        each = proc do |instance, iterator|
            instance.opts.datastore { |store| iterator.return [instance.url, store[:token]] }
        end
        after = proc { |i| block.call Hash[i] }

        map_instances( each, after )
    end

    def test_each_instance
        i = 0
        each_instance do |instance, iterator|
            i += 1
            instance.opts.set( url: "http://stuff.com/#{i}") { |p| iterator.next }
        end
        true
    end

    def test_iterator_for
        iterator_for( instances ).class == ::EM::Iterator
    end

    def test_connect_to_dispatcher( &block )
        connect_to_dispatcher( opts.datastore[:dispatcher_url] ).alive? { |b| block.call b }
    end

    def test_connect_to_instance( *args, &block )
        connect_to_instance( *args ).framework.busy?{ |b| block.call !!b }
    end

    def test_defer( *args, &block )
        defer do
            block.call args
        end
    end

    def test_defer_two_args( *args, &block )
        defer( proc { args }, proc { |r| block.call r } )
    end

    def test_run_asap( *args, &block )
        run_asap { block.call args }
    end

    def echo( *args )
        args
    end

end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
arachni-0.4.7 spec/support/fixtures/rpcd_handlers/echo.rb
arachni-0.4.6 spec/support/fixtures/rpcd_handlers/echo.rb
arachni-0.4.5.2 spec/support/fixtures/rpcd_handlers/echo.rb
arachni-0.4.5.1 spec/support/fixtures/rpcd_handlers/echo.rb
arachni-0.4.5 spec/support/fixtures/rpcd_handlers/echo.rb
arachni-0.4.4 spec/support/fixtures/rpcd_handlers/echo.rb
arachni-0.4.3.2 spec/support/fixtures/rpcd_handlers/echo.rb
arachni-0.4.3.1 spec/support/fixtures/rpcd_handlers/echo.rb
arachni-0.4.3 spec/support/fixtures/rpcd_handlers/echo.rb
arachni-0.4.2 spec/fixtures/rpcd_handlers/echo.rb
arachni-0.4.1.3 spec/fixtures/rpcd_handlers/echo.rb
arachni-0.4.1.2 spec/fixtures/rpcd_handlers/echo.rb
arachni-0.4.1.1 spec/fixtures/rpcd_handlers/echo.rb
arachni-0.4.1 spec/fixtures/rpcd_handlers/echo.rb