usnationalarchives / federal_register

Ruby API Client for FederalRegister.gov that handles searching articles and getting information about agencies
http://www.federalregister.gov/learn/developers
Other
72 stars 22 forks source link

Specs for type casting #4

Closed yonkeltron closed 13 years ago

yonkeltron commented 13 years ago

Specs for type casting of dates because of a bug in the API. I thought it was in the gem so tried to write specs to reproduce it but it is actually in the data returned from the API.

The effective_on attribute is not a date object! It's actually this:

article.instance_variable_get('@attributes')['effective_on'] {"place_id"=>nil, "entry_id"=>568141, "title"=>"Modifications of Certain Derivative Contracts; Correction", "delta"=>false, "remote_call_in _available"=>nil, "id"=>413030, "date"=>Fri, 19 Aug 2011, "event_type"=>"EffectiveDate"}

It took some weirdness with the debugger but it worked. I can actually fix this with a custom getter but I'm not sure if that's how you want to approach this issue or not. Let me know and I'll be happy to add the method with nil checking and specs after you merge in these specs.