test/backgrounded_test.rb in backgrounded-0.6.2 vs test/backgrounded_test.rb in backgrounded-0.7.0
- old
+ new
@@ -47,19 +47,35 @@
end
def notify_users
end
end
+ class Blog
+ class << self
+ backgrounded :update_info
+ def update_info
+ end
+ end
+ end
context 'an object with a single backgrounded method' do
setup do
@user = User.new
end
- should "execute method in background" do
- @user.expects(:do_stuff)
- @user.do_stuff_backgrounded
+ should 'define backgrounded method' do
+ assert @user.respond_to?('do_stuff_backgrounded')
end
+ should 'save backgrounded options for method' do
+ assert_not_nil User.backgrounded_options[:do_stuff]
+ end
+ context 'executing backgrounded method' do
+ setup do
+ @user.expects(:do_stuff)
+ @user.do_stuff_backgrounded
+ end
+ should "execute method in background" do end #see expectations
+ end
end
context 'an object with a backgrounded method that accepts parameters' do
setup do
@person = Person.new
@@ -108,6 +124,22 @@
end
should 'save method options for future use' do
assert_equal :low, @dog.backgrounded_options[:bark][:priority]
end
end
+
+ context 'a class with backgrounded method' do
+ should 'define backgrounded method' do
+ assert Blog.respond_to?('update_info_backgrounded')
+ end
+ should 'save backgrounded options for method' do
+ assert_not_nil Blog.backgrounded_options[:update_info]
+ end
+ context 'invoking backgrounded method' do
+ setup do
+ Blog.expects(:update_info)
+ Blog.update_info_backgrounded
+ end
+ should 'invoke class method' do end #see expectations
+ end
+ end
end