Sha256: 0c49345751f4e0d07add66efa5025d3ecbc6604fedd7c3bb18f48c46b65c913f

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

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

class BackgroundedTest < Test::Unit::TestCase

  class User
    def do_stuff
    end
    def self.do_something_else
    end
  end

  context '#backgrounded' do
    should 'be defined for class' do
      assert User.respond_to?(:backgrounded)
    end
    should 'be defined for instance' do
      assert User.new.respond_to?(:backgrounded)
    end
    context 'invoking on class' do
      setup do
        @result = User.backgrounded
      end
      should 'return instance of Backgrounded::Proxy' do
        assert @result.is_a?(Backgrounded::Proxy)
      end
    end
    context 'invoking on an instance' do
      setup do
        @user = User.new
        @result = @user.backgrounded
      end
      should 'return instance of Backgrounded::Proxy' do
        assert @result.is_a?(Backgrounded::Proxy)
      end
    end
    context 'invoking with options' do
      setup do
        Backgrounded.handler.expects(:options=).with(:priority => :high)
        @result = User.backgrounded(:priority => :high)
      end
      should 'pass options onto Backgrounded.handler' do end # see expectations
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
backgrounded-2.0.0 test/backgrounded_test.rb
backgrounded-2.0.0.rc2 test/backgrounded_test.rb
backgrounded-2.0.0.rc1 test/backgrounded_test.rb