[ANN] assert_latest now takes "polygamous" arguments

P

Phlip

Rubies:

Those of you who dig ActiveRecord need this:

http://www.oreillynet.com/ruby/blog/2008/09/polygamous_assert_latest.html

It shows how to write tests like this:

t, fz = assert_latest T2, Foo do
T2.create
2.times{ Foo.create }
end

assert do
t.id > 0 and
fz[0].id > 0 and
fz[1].id > fz[0].id
end

The inner lines - T2.create etc. - represent your production code in action. You
put the assert_latest around that code, and it will detect any new records of
the given type. You can then assert the records have the fields you expect.

This is useful for any kind of testing, but super-useful for integration tests,
to detect large batches of new records.

Get assert_latest with the assert_efficient_sql gem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,201
Messages
2,571,049
Members
47,654
Latest member
LannySinge

Latest Threads

Top