Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3837 add rake tasks to run every module only #3843

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ group :development, :test do
gem "i18n-tasks"
gem "spring"
gem "puma"
gem "open3", "~> 0.1.1"
end

group :test do
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ GEM
racc (~> 1.4)
nori (2.6.0)
oj (3.10.16)
open3 (0.1.1)
open4 (1.3.4)
os (1.1.1)
paper_trail (12.0.0)
Expand Down Expand Up @@ -572,6 +573,7 @@ DEPENDENCIES
minitest-stub_any_instance
mocha
net-ldap
open3 (~> 0.1.1)
paper_trail
paranoia
pg (~> 1.1)
Expand Down
43 changes: 43 additions & 0 deletions lib/tasks/test.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# frozen_string_literal: true

require 'open3'

namespace :test do
modules = %w{
gobierto_admin
gobierto_attachments
gobierto_budgets
gobierto_calendars
gobierto_cms gobierto_common
gobierto_core
gobierto_dashboards
gobierto_data
gobierto_exports
gobierto_indicators
gobierto_investments
gobierto_observatory
gobierto_people
gobierto_plans
gobierto_visualizations
gobierto_others
gobierto_engines
}

modules.each do |mod|
desc "run test for module #{mod}.safe_constantize "
task "#{mod}".to_sym, [:fail_fast_enable] => :environment do |_t, args|
files = `find test -path '*#{mod}*' -name '*_test.rb' | grep -v '#{mod}\/gobierto_'`.gsub("\n"," ")
cmd = "bin/rails test #{files} #{"--fail-fast" if args[:fail_fast_enable]}"

Open3::popen3(cmd) do |std_in, std_out, std_err|
std_err.each_line do |line|
puts line
end
std_out.each_line do |line|
puts line
end
end

end
end
end