Skip to content

Instantly share code, notes, and snippets.

@daveboling
Last active August 1, 2019 19:13
Show Gist options
  • Save daveboling/2b32bf113f3fcc825a0ec41919b98a6c to your computer and use it in GitHub Desktop.
Save daveboling/2b32bf113f3fcc825a0ec41919b98a6c to your computer and use it in GitHub Desktop.
Rails Remote Programming Interview Question(s) (Mid-Level)

Foreword and Instructions

These questions are not made to be difficult and should be easy to a true mid-level Rails developer. The point here is to see how confidently they carry themselves. Candidates should get kudos for asking good questions. If they go off the deepend, try to steer them back to the objective. If an interview is going poorly, it's OK for you to step in herd them in any particular direction. A poor interview is not necessarily a sign of a poor candidate, use good judgment.


Expectations

  • Should be able to converse and gather requirements effectively
  • Bootstrap a Rails application
  • Install any needed gems
  • Create/execute a migration
  • Create models (ActiveModel)
  • Establish model relationships
  • Create a controller
  • Use ActiveRecord to retrieve a resource
  • Serialize a resource via ActiveModel::Serializers and render it to a view as JSON
  • Use Strong params to deserialize incoming requests
  • Create a route
  • Add tests
  • Bonus: Use a callback to trigger ActionMailer to send an email

Exercises

1. Trello Clone (30min-90min)

Using Rails, create a (very simple) ticketing system. A Ticket is owned by a User and has many Messages. After a Message is created, an email should be sent to the creator of the Ticket.

Tasks:

  • Add an endpoint to create a Ticket by a user
  • Add an endpoint get a single Ticket (including the creating user's email)
  • Add an endpoint get all tickets (order by created)
  • Add an endpoint to update a Ticket's status to "completed"
  • Add an endpoint to create a Message on a Ticket
  • Add the rspec-rails gem to the project and set it up using the documentation
  • Add either a controller or request spec to test your new endpoints
  • Email a user when a new message is created

Models

User
email
created_at
updated_at

Ticket
status (incomplete|completed)
title
body
weight
created_at
updated_at
user_id (fk)

Message
body
created_at
updated_at
user_id (fk)
ticket_id (fk)

Don't worry about authentication, candidate can assume that any user identifiers will be passed along with any requests.

Interviewer Grade Questions

  1. Does candidate fight against common Rails conventions in any way?

    • Did they fight pluralization?
    • Write idiomatic code?
    • Anything else? Investigate reasoning.
  2. Does the candidates naming/descriptions make semantic sense?

    • Table names
    • Column names
    • Variables names
    • Test descriptors
    • ...anything else that pops up.
  3. Does candidate write quality tests?

    • Do they simply make the test pass?
    • Do they only write successful test cases?
    • If a candidate has a weakness in this area, give them a input that will make their application fail if possible.
  4. Can the candidate navigate ActiveRecord effectively?

    • This is an important and valuable item and is a must have for any mid-level candidate.
  5. Does the candidate know how/when to use Rails callbacks effectively?

    • This is mostly opinionated
  6. Does the candidate know how to use ActiveModel relationships effectively?

    • has_many
    • has_one
    • belongs_to
    • ...and any advanced usage of these relationships
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment