Module: Dev::Executables::Commands::Test
- Included in:
- Dev::Executable
- Defined in:
- lib/dev/executables/commands/test.rb
Instance Method Summary collapse
-
#test(*apps) ⇒ nil
Esegue i test delle app specificate.
Instance Method Details
#test(*apps) ⇒ nil
Esegue i test delle app specificate. Se non viene specificato niente, esegue i test di tutte le app.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/dev/executables/commands/test.rb', line 13 def test(*apps) if apps.any? # Esegue i test per le app specificate tested_apps = [] # Controlla che le app specificate siano valide apps.each do |app| @project.valid_app?(app) tested_apps << app end else # Esegue i test per tutte le main app tested_apps = @project.main_apps end tested_apps.each do |current_app| @project.current_app = current_app @project.chdir_app print "Eseguo test dell'app " print current_app.to_s.teal puts '..' puts test_output = exec('script -q /dev/null rspec --format documentation') test_output = test_output[2..-1] .gsub("\s\s", '§§') # Memorizza le indentazioni .split("\n") # Divide ogni riga .map(&:squish).join("\n\t\t") # E ne toglie spazi extra .gsub('§§', "\s\s\s\s") # Riunisce tutto preservando le indentazioni puts "\t\t#{test_output}" puts end end |