From 086f53547e6ff3eb3b9d11e7ae3e572801566190 Mon Sep 17 00:00:00 2001 From: Natan Nobre Chaves Date: Tue, 17 Sep 2024 10:39:26 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20Conserta=20execu=C3=A7=C3=A3o=20dos=20te?= =?UTF-8?q?stes=20(#62)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: conserta execução dos testes * fix: conserta testes na CI --- .github/workflows/ci.yml | 2 +- .rspec | 4 +--- bin/test | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100755 bin/test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5193ba9a..0212932e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,4 +61,4 @@ jobs: run: RAILS_ENV=test bundle exec rails db:migrate - name: Run tests - run: bundle exec rspec + run: bundle exec rspec --require spec_helper --require rails_helper diff --git a/.rspec b/.rspec index c821136e..82b8369c 100644 --- a/.rspec +++ b/.rspec @@ -1,3 +1 @@ ---require spec_helper ---require rails_helper ---format documentation +--require spec_helper \ No newline at end of file diff --git a/bin/test b/bin/test new file mode 100755 index 00000000..dd151859 --- /dev/null +++ b/bin/test @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby +require "fileutils" + +# path to your application root. +APP_ROOT = File.expand_path("..", __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +FileUtils.chdir APP_ROOT do + puts "\n== Running RSpec ==" + if ARGV.first&.include?("--auto") + unless system("gem list retest -i --silent") + puts "Installing retest..." + system("gem install retest") + end + + puts "retest 'bundle exec rspec '" + system "retest 'bundle exec rspec '" + else + puts "bundle exec rspec #{ARGV.join(' ')}" + system "bundle exec rspec #{ARGV.join(' ')}" + end +end