Sha256: 3efbc511e67573da52a34926f517c5e095773dfe9d401da2f1ad5f533018682b

Contents?: true

Size: 1.7 KB

Versions: 1

Compression:

Stored size: 1.7 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

class ProxyTest < Test::Unit::TestCase
  class Person
    def self.do_something_else
    end
    def do_stuff(name, place, location)
    end
    def do_stuff_without_arguments
    end
  end

  context 'invoking delegate method' do
    context 'with arguments and options' do
      setup do
        @delegate = Person.new
        Backgrounded.handler.expects(:request).with(@delegate, :do_stuff, ['foo', 1, 'bar'], {:option_one => 'alpha'})
        @proxy = Backgrounded::Proxy.new @delegate, :option_one => 'alpha'
        @result = @proxy.do_stuff 'foo', 1, 'bar'
      end
      should "invokes Backgrounded.handler with delegate, method and args" do end #see expectations
      should 'return nil' do
        assert_nil @result
      end
    end
    context 'with arguments' do
      setup do
        @delegate = Person.new
        Backgrounded.handler.expects(:request).with(@delegate, :do_stuff, ['foo', 1, 'bar'], {})
        @proxy = Backgrounded::Proxy.new @delegate
        @result = @proxy.do_stuff 'foo', 1, 'bar'
      end
      should "invokes Backgrounded.handler with delegate, method and args" do end #see expectations
      should 'return nil' do
        assert_nil @result
      end
    end
    context 'with no arguments' do
      setup do
        @delegate = Person.new
        Backgrounded.handler.expects(:request).with(@delegate, :do_stuff_without_arguments, [], {})
        @proxy = Backgrounded::Proxy.new @delegate
        @result = @proxy.do_stuff_without_arguments
      end
      should "invokes Backgrounded.handler with delegate, method and args" do end #see expectations
      should 'return nil' do
        assert_nil @result
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
backgrounded-2.1.0 test/proxy_test.rb