Skip to content

🔴 Rails example project running on docker-compose with breakpoints in tests

License

Notifications You must be signed in to change notification settings

GabLeRoux/rails-docker-compose-rubymine-example

Repository files navigation

Ruby on Rails 4.2 docker-compose example project

I wanted to run tests and have breakpoints in RubyMine in a Ruby on Rails 4.2 application running inside docker-compose. Current code base is based on the sample project Rails Stripe Membership Saas. I added docker-compose support and RubyMine setup instructions 🎉.

Getting started

cp .env.test .env
docker-compose up -d
docker-compose exec web bundle exec rake db:migrate

RubyMine

I created this project to demonstrate how to run tests inside Docker using RubyMine IDE or IntellijIdea.

Important files

What to add to your Gemfile:

group :development, :test do
  gem 'ruby-debug-ide'
  gem 'debase'
end

I personally had to also maintain local versions of gems for the ruby-debug-ide gem to get loaded into the IDE. This repository has a .ruby-version which is used by rbenv.

rbenv installation commands on MacOS:

brew install rbenv ruby-build ruby
rbenv init

For the current repository:

rbenv install
rbenv version
rbenv local
gem install bundler
bundle install

RubyMine step by step

Edit: 🔴 This is not working on Intellij IDEA, ruby is being ran locally on my system instead. See #1

Tested on RubyMine 2017.3.2 EAP 👍.

  1. Open settings -> Ruby SDK and Gems -> Add (+)
  2. Select docker-compose, setup Docker server and select web service (from docker-compose file)

01-configure-remote-debug-interpreter-docker-compose 02-ruby-sdk-and-gems 3. Right click on a test to add as a run configuration 03-right-click-add-test 4. Tweak the run configuration by adding environment variables. Hint on macos:

cat .env | pbcopy

Then hit the clipboard icon to paste all env variables at the same time 04-edit-run-configuration 5. Execute the run configuration in debug mode ✌️ 05-successful-test-with-breakpoint

License

MIT © Gabriel Le Breton

About

🔴 Rails example project running on docker-compose with breakpoints in tests

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published