everypolitician / scraper_test

Data-driven scraper tests for Scraped
0 stars 0 forks source link

WIP: Extract test class #26

Open ondenman opened 7 years ago

ondenman commented 7 years ago

Closes: #13

This PR introduces the ScraperTest::Test.

It runs a test to the specifications of the instructions object passed to it. ScraperTest::Test#run compares the test data specified in the instructions object with data return by the class, also specified in the instructions object.

It is able to test against a subset of data when the instructions object specifies it.

WIP: I'm not sure I've done the right thing yielding the before and after values to a block in #compare. If I'm exposing them in the block, I might as well just expose #actual and #expected instead. But then again, I'm note sure that's the way to go either. Also, the behaviour of #actual when using an invalid paths differs from when it's used with a path with an unknown key/value pair.