This is an interactive exercise introducing the basics of web development with Ruby on Rails 6.0 (not the latest 6.1.4 release). It is used in the course SSE at the Hasso Plattner Institute.
The exercise is inspired by the offical "Getting Started with Rails" guide, so in case of getting stuck, this is a good start 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:
Settings
tab on the GitHub website.
git clone
. Cloning via SSH instead of HTTPS avoids having to type credentials when pushing.
ruby --version
. It should be 2.7.4
(or higher). Previous versions (up to 2.5.0 should work, but aren't tested.)rbenv install 2.7.4
, might take a few minutes).ruby_version
file in the repository instructs the ruby version manager to use the correct version.vagrant ssh #connect with VM
cd <app_folder>
rails s -b 0 # -b required to not drop requests coming from host OS
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/
)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.