I have a class that uses the command pattern to do a bunch of simple transformation steps in order. Data comes in as a data feed (in XML) and then is transformed through multiple steps using single-purpose step classes. So it might look like this (actual class names are different):
raw_data = Downloader.new(feed)
parsed_data = Parser.new(raw_data)
translated_data = Translator.new(parsed_data)
sifted_data = Sifter.new(translated_data)
collate_data = Collator.new(sifted_data)
etc.
I have unit tests for each class, and I have integration tests to verify the full flow, including that each class is called.
But I don't have any way to test the order they are called
I'd like some test so I can know: the Downloader is called first, then the Parser, then the Translator, etc.
This is in Ruby with Rspec 3.
I did find this: http://ift.tt/1JDmZsB but this is from 2008 and it's also really ugly. Is there a better way to test method execution order?
Thanks!
Aucun commentaire:
Enregistrer un commentaire