Ruby on Rails with Rake

TIP: Please make sure to read Getting started with programming tasks first.

You can start with our sample project that can be found on GitHub:

Open sample project.

Download the sample project. 

Technical details for Ruby on Rails support

Any Ruby on Rails project might be used as a programming task. We use CI::Reporter for running unit tests, so any test framework supported by CI::Reporter (Cucumber, Minitest, RSpec, Spinach, or Test::Unit) might be used for unit tests. Our sample project uses the Minitest framework.

Your project will be executed with the following commands:

bundle install
bundle exec rake ci

To make it work you will have to define a ci task in your Rakefile, that will set up CI::Reporter for the chosen test framework. Here is an example for the Minitest framework:

require 'ci/reporter/rake/minitest'task :ci => ['ci:setup:minitest', 'test']

Of course, it is also required to add a dependency to CI:Reporter at Gemfile:

gem 'ci_reporter_minitest'

See sample project files for a fully working example.

When you will be creating a ZIP package with project contents, please skip ./tmp and ./.bundle folders.

Automatic assessment

It is possible to automatically assess the solution posted by the candidate. Automatic assessment is based on Unit Test results and Code Quality measurements.

There are two kinds of unit tests:

  1. Candidate tests - unit tests that are visible for the candidate during the test. Should be used to do only the basic verification and help the candidate to understand the requirements. Candidate tests WILL NOT be used to calculate the final score.
  2. Verification tests - unit tests that are hidden from the candidate during the test. Files containing verification tests will be added to the project after the candidate finishes the test and will be executed during the verification phase. Verification tests result will be used to calculate the final score.

After the candidate finishes the test, our platform builds the project posted by the candidate and executes verification tests and static code analysis.

Devskiller project descriptor

The programming task can be configured with the Devskiller project descriptor file. Just create a devskiller.json file and place it in the root directory of your project. Here is an example project descriptor:

  "verification" : {
    "testNamePatterns" : ["Verify.*"],
    "pathPatterns" : ["test/**/verify_**"]

You can find more details about devskiller.json descriptor in our documentation.


Automatic verification with verification tests

To enable automatic verification of candidates' solutions, you need to define which tests should be treated as verification tests.

All files classified as verification tests will be removed from a project prepared for the candidate.

To define verification tests, you need to set two configuration properties in devskiller.json project descriptor:

  • testNamePatterns - an array of RegEx patterns that should match all the test names of verification tests. Test name contains: [class_name]. In our sample project, all verification tests are in a class that starts with Verify prefix, so the following pattern will be sufficient:
"testNamePatterns" : ["Verify.*"],
  • pathPatterns - an array of GLOB patterns that should match all the files containing verification tests. All the files that match defined patterns will be deleted from candidates' projects and will be added to the projects during the verification phase. These files will not be visible for candidates during the test.
"pathPatterns" : ["test/**/verify_**"]
Was this article helpful?
0 out of 0 found this helpful