zweimal / rails-interview

Sample programming exercise

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rails-interview — a sample Ruby on Rails app for potential hires

Introduction

Hi! Thanks for your interest in joining the team. This README will guide you through completing our interview application. While completing this application, you'll get a bit of exposure to testing and completing a basic Rails controller.

The app doesn't do much now, and has failing tests. Your job is to complete the application such that the views are populated with data, the tests pass, and all requested functionality is completed.

After that you'll get the chance to show us how you'd implement the same functionality in JavaScript if you were tasked with building a single-page application.

Have fun with the challenge! When you're done, please link your contact person to your forked repository on GitHub.

Getting Started

Prerequisites

  1. Ensure you have version 2.3 or higher of ruby installed on your machine.
  2. Ensure you have bundler installed (gem install bundler)
  3. Ensure you have git installed on your machine

Fork and Clone rails-interview

  1. Fork the rails-interview repository on GitHub.
  2. clone it locally to your machine
  3. When done, push your changes up to your fork

If you are unfamiliar with forking, follow these instructions

Start the Application

  1. cd into the directory
  2. Run bundle install to install gems
  3. Run bin\rails server
  4. Browse to http://localhost:3000

Solving the Problem - Ruby on Rails / TDD

This will run the tests as defined and report any errors making use of predefined fixtures.

We have given you some failing tests to try to fix. We've also provided you with some predefined fixture data to utilize. As you implement your Rails controller, you'll see the tests start to turn green.

You can run the tests by running

rake test

from the command line in the application directory.

Once all of your tests are passing, please move on to the JavaScript portion of the application.

Solving the Problem - JavaScript / SPA

Once you've completed the Rails portion of the application, you then get to use a bit of creativity to implement that same page, but in JavaScript as a single-page application. You may use any of the following frameworks:

  1. Backbone with or without Marionette
  2. AngularJS 1.x
  3. ReactJS

We have several JavaScript applications in production with a few different frameworks, so this part is important to us. Structure this JS application in a way that you find simple and easy to understand.

You may utilize a Rails view to load the header of the page, an entry point DOM element, any JS templates (ex. <script type="text/template" id="someTpl">DOM TEMPLATE IN HERE</script>) and any extra JavaScript files you need to load. All templates should be loaded from the JavaScript side, not rendered by Rails.

Tasks

  1. Allow /students to return JSON using headers. (Don't use /students.json)
  2. Add a nested collection route named :js to the :students resource
  3. Create a corresponding js method in the StudentsController
  4. Return a view from /students/js that will load a single-page application version of /students and fulfill the constraints listed above.
  5. SPA should only load everything below the h1 header with front-end views
  6. The JavaScript code should trigger the rendering of the rest of the page.
  7. SPA should have all functionality of /students with:
  • Sorting by clicking on table headers
  • Filtering by name with a text input just above the table
  1. SPA should only make JSON AJAX calls to /students
  • Must use Promises (native, jQuery, $q, etc) for AJAX requests
  • Must implement successful case when API responds properly
  • Must implement unsuccessful case when API fails to respond

Areas of Concern

We will be grading your interviews on a number of different criteria, but here are some things to keep in mind.

  1. We prefer readable code over clever code
  2. We will be inspecting your commits independently
  3. We like explanations in commits for why things were changed
  4. We like separation of concerns (data, presentation, controls)

You're all Done!

Did you make it this far? Good! We want to make sure you're paying attention. Make a POST route for /foo point to any controller and action. Inside that route, if a parameter named valid is present with the string true, you should return only the text BAR with a 202 status code. If the parameter is not present in the POST body or it is not the string true, raise an exception.

Thanks!

About

Sample programming exercise


Languages

Language:Ruby 70.4%Language:HTML 16.4%Language:CoffeeScript 9.0%Language:CSS 2.3%Language:JavaScript 1.9%