Hi
I've been doing this a while now. If I have a class that responds to :
[], and all I'm interested in stubbing is that method, then instead of
using a mock I just create a hash. (Similarly, you could create an
array when you are testing an Enumerable object.)
Example from code I just worked on, where uses MigrationGraph#[] looks
up graph vertices by name:
@migration_graph = {
# "name" => vertex
"changeset 1 migration 1" => @migration_a,
"changeset 1 migration 2" => @migration_b,
"changeset 2 migration 1" => @migration_c,
"changeset 2 migration 2" => @migration_d
}
What I'm really interested in is what happens to (some of) the four
migrations, not the migration graph itself.
I just wondered if anyone else did this. Generally doing unusual
things is a sign something is amiss.
Ashley
--
http://www.patchspace.co.uk/
http://aviewfromafar.net/
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users