Ruby

To create a new assignment in Ruby, click into one of your courses, and then click Add assignment. Choose Ruby from the drop-down list of available backend languages and set the the rest of your assignment's parameters (deadline, etc.). Once the assignment is created, a new folder will be created in the private GitHub/GitLab template repository for the course in which you are added this assignment. This folder will contain a standard Ruby project structure:

Automated test-suite setup

If you would like to add tests that are automatically run by AssignmentOS against each student's solution to your assignment, you can add these as unit test files in the tests/ directory.

All unit tests files must be added in the tests/ directory and use the Test::Unit testing framework.

All unit test filenames must begin with test_ and unit test files with filenames that begin with test_hidden will not be visible to the student.

If you want to add files that your hidden unit tests use and hence are also not visible to the student, the names of these files must begin with hidden, e.g., hiddenFoo.json, hiddenFoo.csv, hidden_foo.rb, etc.

All dependencies required for your assignment must be added to the Gemfile.

Your assignment also must use/be compatible with Ruby version 3.0.

The current content of the Rakefile must not be modified. You may add to the Rakefile as required for your assignment.

GitHub Action & GitLab CI/CD

AssignmentOS uses either GitHub Actions or GitLab CI/CD (depending on whether you use with GitHub or GitLab) to run automated unit tests. We provide the following GitHub Action & GitLab CI/CD file for Ruby assignments. Note that this file is added dynamically to the repo of each student taking your assignment, so please do not include it in your template repo. This file also cannot be changed.

GitHub Action .yml fileGitLab CI/CD .yml file
name: Ruby

on: [push]

jobs:

  test:

    runs-on: ubuntu-latest

    steps:
    
    - uses: actions/checkout@v3
    
    - name: Set up Ruby
      uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
      with:
        ruby-version: 3.0
        
    - name: Install
      run: bundle install
      
    - name: Test
      run: bundle exec rake test

Coming soon!

Examples

An example Ruby assignment that uses automated test suite scoring can be seen here: https://github.com/AssignmentOS-HQ/Ruby-AssignmentOS-Fibonacci.

Last updated