Sha256: bf77833e1f611f1e948edbd302a37352269df2ae61274d6e78fe5d41da8c8223

Contents?: true

Size: 816 Bytes

Versions: 2

Compression:

Stored size: 816 Bytes

Contents

require 'test_helper'

class ModTest < Test::Unit::TestCase
  context "A Mod" do
    setup do
      @svc = BERTRPC::Service.new('localhost', 9941)
    end

    should "be created with a Service and type and module name" do
      assert BERTRPC::Mod.new(@svc, BERTRPC::Call, :mymod).is_a?(BERTRPC::Mod)
    end
  end

  context "A Mod instance" do
    setup do
      @svc = BERTRPC::Service.new('localhost', 9941)
      @mod = BERTRPC::Mod.new(@svc, BERTRPC::Call, :mymod)
    end

    should "call execute on the type" do
      m = mock(:execute => nil)
      BERTRPC::Call.expects(:new).with(@svc, :mymod, :myfun, [1, 2, 3]).returns(m)
      @mod.myfun(1, 2, 3)
      
      m = mock(:execute => nil)
      BERTRPC::Call.expects(:new).with(@svc, :mymod, :myfun, [1]).returns(m)
      @mod.myfun(1)
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
mojombo-bertrpc-0.2.0 test/mod_test.rb
bertrpc-0.2.0 test/mod_test.rb