test/backgrounded_test.rb in backgrounded-2.0.0 vs test/backgrounded_test.rb in backgrounded-2.1.0
- old
+ new
@@ -1,43 +1,44 @@
require File.join(File.dirname(__FILE__), 'test_helper')
class BackgroundedTest < Test::Unit::TestCase
- class User
+ class Dog
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)
+ assert Dog.respond_to?(:backgrounded)
end
should 'be defined for instance' do
- assert User.new.respond_to?(:backgrounded)
+ assert Dog.new.respond_to?(:backgrounded)
end
context 'invoking on class' do
setup do
- @result = User.backgrounded
+ @result = Dog.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
+ @dog = Dog.new
+ @result = @dog.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)
+ @dog = Dog.new
+ Backgrounded.handler.expects(:request).with(@dog, :do_stuff, [], {:priority => :high})
+ @dog.backgrounded(:priority => :high).do_stuff
end
should 'pass options onto Backgrounded.handler' do end # see expectations
end
end
end