test/backgrounded_test.rb in backgrounded-0.7.1 vs test/backgrounded_test.rb in backgrounded-0.7.2
- old
+ new
@@ -62,12 +62,15 @@
@user = User.new
end
should 'define backgrounded method' do
assert @user.respond_to?('do_stuff_backgrounded')
end
+ should 'define backgrounded_options method' do
+ assert @user.respond_to?('do_stuff_backgrounded_options')
+ end
should 'save backgrounded options for method' do
- assert_not_nil User.backgrounded_options[:do_stuff]
+ assert_equal({}, @user.do_stuff_backgrounded_options)
end
context 'executing backgrounded method' do
setup do
@user.expects(:do_stuff).returns(true)
@result = @user.do_stuff_backgrounded
@@ -114,35 +117,38 @@
context 'an object with multiple backgrounded invokations' do
setup do
@post = Entry.new
end
should "setup options for both methods" do
- assert_not_nil Entry.backgrounded_options[:do_stuff]
- assert_not_nil Entry.backgrounded_options[:notify_users]
+ assert_equal({}, @post.do_stuff_backgrounded_options)
+ assert_equal({}, @post.notify_users_backgrounded_options)
end
end
context 'an object with backgrounded method options' do
setup do
@dog = Dog.new
end
should 'save method options for future use' do
- assert_equal :low, @dog.backgrounded_options[:bark][:priority]
+ assert_equal({:priority => :low}, @dog.bark_backgrounded_options)
end
end
context 'a class with backgrounded method' do
should 'define backgrounded method' do
assert Blog.respond_to?('update_info_backgrounded')
end
+ should 'defined backgrounded_options method' do
+ assert Blog.respond_to?('update_info_backgrounded_options')
+ end
should 'save backgrounded options for method' do
- assert_not_nil Blog.backgrounded_options[:update_info]
+ assert_equal({}, Blog.update_info_backgrounded_options)
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
+ setup do
+ Blog.expects(:update_info)
+ Blog.update_info_backgrounded
end
+ should 'invoke class method' do end #see expectations
end
+ end
end