This is an interactive exercise introducing web development with Ruby on Rails 7.0 based on the v6.0 Rails Guide. It is used in HPI's Scalable Software Engineerung course.
This exercise is inspired by the offical "Getting Started with Rails" Guide in version 6.0 (explictly in version 6.0, v7.0 is different). So in case of getting stuck, the v6.0 guide is a good starting point to find solutions.
The interactivity of this exercise is provided by opening issues in the GitHub issue tracker. The issues contain details of the feature to tackle next as well as the currently failing test case and the corresponding error message.
This repository contains an application stub of an academic paper management system with a failing test case. Follow these steps to complete the software and the exercise:
Ensure that the issue tracker of your repository is active (i.e. an "Issues" tab is visible). If not, activate it in the Settings
tab on the GitHub website.
Ensure that GitHub Actions, the Continuous Integration service that runs tests and facilitates the exercise, is active. If not, activate it on the Actions
tab.
Three options to setup your local Ruby on Rails development environment:
After you have access to a Linux-like shell:
git clone
. Cloning via SSH instead of HTTPS avoids having to type credentials when pushing.
cd
into it), check the Ruby version: ruby --version
. It should be 2.7.4
(or higher).rbenv install 2.7.4
(might take a few minutes, requires ruby-build).ruby_version
file in the repository instructs the ruby version manager to use the correct version.bundle install
to install the dependencies of the project (they are stored in the Gemfile
)
bundle
command was not found, install bundler with gem install bundler
rails db:migrate RAILS_ENV=development && rails db:migrate RAILS_ENV=test
to migrate the databaserails s
) and check that the application runs (default: http://localhost:3000/
). When running in WSL/container: rails s -b 0 # -b required to not drop requests coming from host OS
bundle exec rspec
to run the tests (RSpec is a test framework for Ruby)Actions
tab on the repo website.Failing test for #<ISSUE NUMBER>
.rails s
starts the development server (by default on http://localhost:3000) so you can try out your app in the browser.rails routes
shows all available routes of the application.rspec spec/<path_to_spec>.rb
to only run tests within a single file./spec/factories
to get inspiration for your data model.rails db:drop && rails db:migrate
deletes the database and recreates it. This might be helpful for error recovery.git status
) and pushed to the upstream repository (i.e., the one on GitHub) before the deadline.