[Backgroundrb-devel] Testing with rspec

hemant gethemant at gmail.com
Tue Aug 19 14:34:35 EDT 2008


Okay, Here is a very very simple example:

For a worker foo_worker, create foo

require File.join(File.dirname(__FILE__),"..","bdrb_test_helper")
require "foo_worker"

context "For Foo worker" do
  setup do
    @foo_worker = FooWorker.new
  end

  specify "should add two numbers" do
    a = @foo_worker.add_number(:num1 => 10,:num2 => 20)
    a.should == 30
  end
end

And run it with:

specrb test/unit/foo_worker_test.rb


On Mon, Aug 18, 2008 at 8:17 AM, kevin olsen <kevin at yardbarker.com> wrote:
> hemant: could you explain?
>
> I too would like to see an example of someone testing a worker, whether it
> is with rspec or test/[unit,spec]
>
> cheers
>
> On Aug 17, 2008, at 10:45 AM, hemant wrote:
>
>> On Sat, Aug 16, 2008 at 3:12 PM, Marcos Piccinini <chadart at gmail.com>
>> wrote:
>>>
>>> Morning gentleman,
>>>
>>> I would like to ask if someone can post a example ( or maybe a rspec
>>> bdrb_test_helper ) for a rspec testing a backgroundrb worker.
>>>
>>> Im kinda confused.. heh
>>>
>>
>> That spec_helper is for test/spec, but the basic idea is to not use
>> actual MetaWorker class while writing test cases for your workers.
>> _______________________________________________
>> Backgroundrb-devel mailing list
>> Backgroundrb-devel at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>



-- 
Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.

http://gnufied.org


More information about the Backgroundrb-devel mailing list