Spec that we're returning the proper JSON response with the create response body
Fix link
Merge pull request #5 from hanachin/patch-1

Fix link
Merge pull request #2 from nickhammond/render_json_body_spec

Spec that we're returning the proper JSON response
Creates feature spec
Moves controller test to feature test

This test should live in a feature spec. Controller specs should test
the general logic/flow and not ensuring the JSON is formatted correctly.
Generates user resource
Creates user resource in db
Adds 'active_model_serializers' as a development dependency
Creates UserSerializer in dummy application

The feature spec ‘creating_models_remotely’ spec should return the
active_model_serializers serialization for the user resource
Stub out FactoryGirl.create

User.create(opts) throw a `ActiveModel::ForbiddenAttributesError`
because ‘first_name’ isn’t permitted with strong_parameters
Adds development dependency 'factory_girl_rails'
Replace mocked FactoryGirl with "real" FactoryGirl

The problems with stubbing FactoryGirl are:

1. This feature spec should be testing the full stack rather than
mocking/stubbing out interfaces;
2. The mocked FactoryGirl’s .create method created a user resource
using User.create(opts). The problem is that Rails 4 requires that
attributes be whitelisted for mass-assignment with strong parameters. I
didn’t want to implement the Rails 4 strong parameters because it is
possible that some users of this gem are using a version of Rails that
doesn’t support strong parameters. The ‘real’ FactoryGirl avoids this
problem
Define factories in spec_hepler :(

For some reason, the factories defined in the dummy app are not
available in the test suite.
Require 'active_model_serializers' in feature spec

‘active_model_serializers’ is not loaded until explicitly required. The
test now fails and is returning the active_model_serializer
(UserSerializer) JSON.
Returns JSON from #attributes

This is a bit of a hack, but it prevents the app from return
active_model_serializers  JSON.
Parse response body

Now that we are creating the user resource with factory_girl, the
`response.body` is returning more than just `{“first_name”:”Sam”}`.
Instead it is returning json like:
`"{\"id\":1,\"first_name\":\"Sam\",\"created_at\":\"2014-11-13T21:42:16.
205Z\",\"updated_at\":\"2014-11-13T21:42:16.205Z\”}”`

Instead of comparing the json as string equality (which is difficult
because of the changing date attributes), we are parsing the JSON and
comparing key/values.
Create helper to parse JSON
Use named route instead of string literal
Rename variable from 'factory' to 'resource'

An ActiveModel is object is returned when `FactoryGirl.create` is
invoked. ‘factory’ implies that a factory_girl object is returned, and
this is misleading.