Refactored test to use factory
Improved spec
DRY up JSON parsing