This project serves to evaluate developers' proficiency in Ruby & Rails.
Interviees are expected to clone this project and enter its interactive console for two types of tests:
- Read a piece of code, and name the returned value by evaluating the code.
- Read the specifications, and write a method to fulfill the specs.
Also, start the rails server
if the they are expected to debug several Rails problems. Interviers can sit by the interviewees to see how they handle the problems.
The interactive console looks like this:
Clone:
git clone https://github.com/adlerhsieh/interview.git
cd interview
Setup:
bundle install
Run:
rake questions
which brings you to an interactive console. You will see several pieces of code. Input the returned values for each code piece. Type Exception
if you expect an exception.
Other commands:
- Use
exit
to exit. - Use
skip
to skip a question.
Run:
rake methods
which brings you to another interactive console. Write methods in one line and fulfill the instructions.
Each submission triggers rspec
to run tests against the submitted code. Make them pass to move on to the next method.
Other commands:
- Use
exit
to exit. - Use
skip
to skip a method.
Setting up db is necessary for this part. Run:
rake db:migrate
rake db:seed
Start rails server
and open root /
in the browser. The interviewee should solve these problems:
- The posts should display a default avatar, which is their authors' first character of their name. They are missing. Fix it.
- Enter the post with
(Slow Post)
text. It reveals the performance issue for this app. Don't modify the layout and improve its performance. - When creating a
Post
with theNew post
button, thecontent
is always blank. Make sure the content is correctly displayed inposts#show
.
Intended for more senior candidates after debugging part 3. These are time consuming, so approach is more important than implementation. Encourage dialogue while discussing different approaches.
- Allow authors to optionally tag new posts.
- Paginate posts with an option size no less than 10 and no greater than 100 per page.
- Filter blog posts by author, date created, tags, and title.
- Full text search posts, comments, and user names
- Some common Interview Questions
- The whole test takes about 1.5 hour based on my experience. It is suggested that interviers only assign necessary tests.
Questions and methods are customizable in lib
directories. They follow a simple set of rules.
Add files in lib/questions
directory. Name the file 0
, 1
, 2
and so on. Every file will be process in order of their filename.
Do not add too many blank lines around the code. They will be displayed too.
Example:
a = 'foo'
b = 'bar'
a + b
If the filename is lib/questions/0.rb
, it will be processed as the first question.
Add files in lib/questions
directory.The specifications are:
- Name the file
0
,1
,2
and so on. Every file will be process in order of their filename. - Each file is written with 2 parts:
instruction
andmethod
.Instruction
describes the purpose of this method, andmethod
is for the interviewee to understand where the code is inserted. - Use
# method
to separate instructions and method. - Use
# code
to indicate which part the interviewees' code are inserted. - You can either comment out instructions or not. They will not be evaluated.
Example:
# Create a method that returns the sum of x and y.
#
# Example:
#
# plus(1, 1)
# # => 2
# plus(2, 3)
# # => 5
# plus(5, 5)
# # => 10
# method
def plus(x, y)
# code
end
Also, this project implements RSpec
as the test framework. You need to add specs in spec/lib/methods
in order to make sure interviewees' methods fulfill a specific standard.
Please add require 'interview_helper'
at the beginning of every spec file.
Example:
require 'interview_helper'
describe '#plus' do
it { expect(plus(1, 1)).to eq 2 }
it { expect(plus(2, 3)).to eq 5 }
it { expect(plus(5, 5)).to eq 10 }
end