From 58353ef5b775e21be4d4f5823ee2b0e3cbf4dad4 Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 29 Feb 2024 13:12:55 +0300 Subject: [PATCH] Start Guard instead of sleeping --- Gemfile | 4 ++++ Gemfile.lock | 22 ++++++++++++++++++++++ Guardfile | 2 +- docker-compose.override.example.yml | 5 +++++ docker-compose.yml | 2 ++ docker/dev/backend/scripts/setup-tests | 9 +++++++-- 6 files changed, 41 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 6b539ba331c4..f26fc29eb987 100644 --- a/Gemfile +++ b/Gemfile @@ -231,6 +231,10 @@ group :test do gem 'rack-test', '~> 2.1.0' gem 'shoulda-context', '~> 2.0' + # Run specs with guard + gem "guard" + gem "guard-rspec" + # Test prof provides factories from code # and other niceties gem 'test-prof', '~> 1.3.0' diff --git a/Gemfile.lock b/Gemfile.lock index 1a04488b4a86..30219be88c30 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -595,6 +595,20 @@ GEM grape rack gravatar_image_tag (1.2.0) + guard (2.18.1) + formatador (>= 0.2.4) + listen (>= 2.7, < 4.0) + lumberjack (>= 1.0.12, < 2.0) + nenv (~> 0.1) + notiffany (~> 0.0) + pry (>= 0.13.0) + shellany (~> 0.0) + thor (>= 0.18.1) + guard-compat (1.2.1) + guard-rspec (4.7.3) + guard (~> 2.1) + guard-compat (~> 1.1) + rspec (>= 2.99.0, < 4.0) hana (1.3.7) hashdiff (1.1.0) hashery (2.1.2) @@ -692,6 +706,7 @@ GEM view_component (>= 2.0) yard (~> 0.9.25) zeitwerk (~> 2.5) + lumberjack (1.2.10) mail (2.8.1) mini_mime (>= 0.1.1) net-imap @@ -718,6 +733,7 @@ GEM mustermann-grape (1.0.2) mustermann (>= 1.0.0) mutex_m (0.2.0) + nenv (0.3.0) net-http (0.4.1) uri net-imap (0.4.10) @@ -734,6 +750,9 @@ GEM nokogiri (1.16.2) mini_portile2 (~> 2.8.2) racc (~> 1.4) + notiffany (0.1.3) + nenv (~> 0.1) + shellany (~> 0.0) oj (3.16.3) bigdecimal (>= 3.0) okcomputer (1.18.5) @@ -1009,6 +1028,7 @@ GEM rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) semantic (1.6.1) + shellany (0.0.1) shoulda-context (2.0.0) shoulda-matchers (6.1.0) activesupport (>= 5.2.0) @@ -1185,6 +1205,8 @@ DEPENDENCIES grape (~> 2.0.0) grape_logging (~> 1.8.4) grids! + guard + guard-rspec html-pipeline (~> 2.14.0) htmldiff httpx diff --git a/Guardfile b/Guardfile index 83e8583758b0..696cb767de96 100644 --- a/Guardfile +++ b/Guardfile @@ -26,7 +26,7 @@ # See COPYRIGHT and LICENSE files for more details. #++ -guard :rspec do # , :cli => "--drb" do +guard :rspec, cmd: 'rspec --format d' do # , :cli => "--drb" do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { 'spec' } diff --git a/docker-compose.override.example.yml b/docker-compose.override.example.yml index f1bf691b9fbe..14b9e51eb5d1 100644 --- a/docker-compose.override.example.yml +++ b/docker-compose.override.example.yml @@ -5,9 +5,14 @@ services: backend: environment: OPENPROJECT_CLI_PROXY: "http://localhost:${PORT}" + DISABLE_PRY_RAILS: 0 ports: - "3000:3000" + backend-test: + environment: + START_GUARD: 0 + frontend: ports: - "${PORT}:4200" diff --git a/docker-compose.yml b/docker-compose.yml index 5c77c0aa4a30..807e98193651 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -137,6 +137,8 @@ services: build: <<: *build target: test + tty: true + stdin_open: true command: setup-tests hostname: backend-test networks: diff --git a/docker/dev/backend/scripts/setup-tests b/docker/dev/backend/scripts/setup-tests index ddcdd7e5755b..eb74db7b75af 100755 --- a/docker/dev/backend/scripts/setup-tests +++ b/docker/dev/backend/scripts/setup-tests @@ -14,5 +14,10 @@ echo "to start the full suite, or " echo " bin/compose exec backend-test bundle exec rspec path/to/some_spec.rb" echo "to run a subset" -# Keep this container online -while true; do sleep 1000; done; +if [ ${START_GUARD} = "1" ]; then + echo "or use Guard gem events to run a specific tests.\n" + bundle exec guard start --no-bundler-warning +else + # Keep this container online + while true; do sleep 1000; done; +fi