Merge pull request #17 from NYULibraries/chore/upgrade-dependencies

Upgrade Dependencies
Add FactoryGirl::Rails to the Gemfile and lock in the change
Add factories
Don't use fixtures in the tests
Do use factories in the tests
Update functional tests to use factory girl more better
Error when saving so we can see what the problem is
Add a noop #performed? method on a TestRequest
Fix copy and paste error in record factory
Save test users without session maintenance for functional tests
Adjust RecordsController tests given FactoryGirl's more granular control

Since we have more granular control over the records we add for a particular test, the resulting HTML has fewer test records. This is a good thing, since before we were adding dummy records to users for other tests but they were effecting these tests. FactoryGirl gives us more isolation for our test data.
Rename RecordsController test helper methods for clarity

Decoupling the names of the methods from the order in which the records are rendered since that can be arbitrary.
Change the RecordsController print tests to reflect the rendered order change

@barnabyalter, I'm not sure what this is due to, but expect it has to do with arbitrary ordering from the SQL query. No need to investigate further, just something to keep in mind.
Don't record new episodes for the UsersController and RecordsController tests

We don't need any new VCR HTTP episodes for these tests at the moment, so don't allow them.
In functional tests assign the object that the record becomes to the instance variable before saving

There is an issue where when the record become the external system object and is then saved, the record instance variable doesn't reflect the persistence.
It's easier to explain with code, so here goes

@record = Record.new(external_id: 'primo_id', external_system: 'primo')
@record.becomes_external_system.save!
@record.new_record?

Obviously the above behavior is not what we want and sort of unexpected, so instead we do

@record = Record.new(external_id: 'primo_id', external_system: 'primo')
(@record = @record.becomes_external_system).save!
@record.new_record?

That's more like it.

I'm not sure if this unexpected behavior is a jRuby implementation issue or a general issue but I do know that inheritance + persistence is very strange.

The reason it worked before was that the external_system was getting written directly to the database and when it was found, it was no longer a new record, so it didn't try to create itself (via INSERT), it just wanted to update itself.