Skip to content

This is a Sample Rails Test Project for testing AI Automated Code Assistants

License

Notifications You must be signed in to change notification settings

land-of-apps/rails-test-project

Repository files navigation

Ruby on Rails Sample Application

How to run this project

Run this project with Docker

Using the example Dockerfile. Build the container.

docker build -t rails-test-project .

Run the application with port 3000 forwarding correctly.

docker run -p 3000:3000 -v "$(pwd)":/app rails-test-project bundle exec rails server -b 0.0.0.0

Or run the tests:

docker run -p 3000:3000 -v "$(pwd)":/app rails-test-project bundle exec rails test

You can then log in as the sample administrative user with the email example@railstutorial.org and password foobar.

Run this project with Docker Compose

Using the example docker-compose.yml file in our sample project. Here is the relevant part of the config.

services:
  web:
    build: .
    command: bundle exec rails server -b 0.0.0.0
    ports:
      - "3000:3000"

Now run this to start the container.

docker compose up web

You can then log in as the sample administrative user with the email example@railstutorial.org and password foobar.

Run this project locally

To get started with the app, clone the repo and then install the needed gems. You can clone the repo as follows:

git clone https://github.com/land-of-apps/rails-test-project.git
cd rails-test-project/

This project needs the following version of Ruby and Bundler

Ruby: 3.1.2 Bundler: 2.3.14

The Ruby installation is system-dependent but we highly recommend asdf

Ensure the following commands return the right versions before continuing.

$ ruby -v
ruby 3.1.2p20

Once Ruby is installed, the bundler gem can be installed using the gem command:

$ gem install bundler -v 2.3.14

Confirm the version before continuing.

$ bundler --version
Bundler version 2.3.14

Then the rest of the necessary gems can be installed with bundle (taking care to skip any production gems in the development environment):

$ bundle _2.3.14_ config set --local without 'production'
$ bundle _2.3.14_ install

If you run into any trouble, you can remove Gemfile.lock and rebundle at any time:

$ rm -f Gemfile.lock
$ bundle install

Next, migrate the database:

$ bundle exec rails db:migrate

Finally, run the test suite to verify that everything is working correctly:

$ bundle exec rails test

If the test suite passes, you’ll be ready to seed the database with sample users and run the app in a local server:

$ bundle exec rails db:seed
$ bundle exec rails server

You can then log in as the sample administrative user with the email example@railstutorial.org and password foobar.

License

This is the sample application for the Ruby on Rails Tutorial: Learn Web Development with Rails by Michael Hartl.

See also the 6th edition README.

All source code in the Ruby on Rails Tutorial is available jointly under the MIT License and the Beerware License. See LICENSE.md for details.

About

This is a Sample Rails Test Project for testing AI Automated Code Assistants

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published