everypolitician / scraper_test

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

Handle target instructions field #27

Open ondenman opened 7 years ago

ondenman commented 7 years ago

A future PR (WIP https://github.com/everypolitician/scraper_test/pull/26) will allow the testing of a subset of the response data.

In anticipation of that PR, this commit provides a way to target that subset of data.

Although Instructions does not care about the contents of the :target field, it is intended to work like this:

The response data might contain multiple members within an array:

{ members: [{id: 1, name: 'Jim' }, { id: 2, name: 'Joe' }] }

To target the first member, we can supply a key value pair:

target:
    :id: 1

or

target:
    :name: 'Jim'