[rspec-users] testing a collection

GregD gditrick at fuse.net
Fri Feb 11 11:28:53 EST 2011


All,

Is there away to test a collection with rspec 1.3?  I've seen Jim
Weirich's rspec-collection, but it requires rspec 2.0.  I'd like to go
to rspec 2.0, but have another dependency that will not work with
rspec 2.0.  I may have to bite the bullet and see if I can update that
dependency to work wit rspec 2 and go to rspec 2.

What I'd like to do is:

describe "blah" do
  subject { a-collection }

  subjects.each do |s|
      subject { s }

      it { should pass a test }
  end
end

BTW:  Using this to test a 3rd party app.  Probably not the right
tool, but I like ruby and its tools.  So, I have access to the app db
and send a message to the app via a service and need to see if things
changed the way I expected.  I'd love to actually test without doing
it that way, but it would require Jruby to be able to mock java
objects and return those mocks in the java.  If that was possible than
I'd test the java directly using jruby and rspec.  I have tested some
java with rspec, but those java classes don't involve db calls or
other communications that I'd like to mock.  If the java class
involves any of those communications, I just have to write an
integration test with fixtures, sending the data and then testing
results.

Any ideas other than find a java testing tool, because I just try to
avoid java but can't since it is how I have to pay the bills.  :(


Thanks,

GregD


More information about the rspec-users mailing list