scraper_test should test New Zealand's CurrentMemberPage against:
:class: CurrentMemberPage
:url: https://www.parliament.nz/en/mps-and-electorates/members-of-parliament/document/51MP1811/tolley-anne
:to_h:
:id: 51MP1811
:name: Anne Tolley
:sort_name: Tolley, Anne
:photo: https://www.parliament.nz/media/1400/tolley-anne.C24btw.jpg
:email: anne.tolley@parliament.govt.nz
:facebook: https://www.facebook.com/honannetolley
:twitter: https://twitter.com/AnneTolleyMP
:source: https://www.parliament.nz/en/mps-and-electorates/members-of-parliament/document/51MP1811/tolley-anne
:honorific_prefix:
:memberships:
- :area: East Coast
:party: National Party
:start_date: '2005-09-17'
:end_date:
- :area: List
:party: National Party
:start_date: '1999-11-27'
:end_date: '2002-07-27'
Solution
scraper_test should be aware that the subject hash contains Scraped::Document objects. Any Scraped::Document objects should be replaced by their to_h values.
Problem
At the moment
scraper_test
cannot test any object that returns otherScraped::Document
objects in itsto_h
data.Example
For example, the member page class
memberships:
field of the New Zealand scraper returns an array ofMembershipRow
objects. (https://github.com/everypolitician-scrapers/new-zealand-parliament/blob/master/lib/current_member_page.rb)scraper_test
should test New Zealand'sCurrentMemberPage
against:Solution
scraper_test
should be aware that the subject hash containsScraped::Document
objects. AnyScraped::Document
objects should be replaced by theirto_h
values.