Refactored to be pure JavaScript instead of Jasmine and JavaScript in Rails