Module: Piggly::Command::Test
- Defined in:
- lib/piggly/command/test.rb
Overview
This command handles all the setup and teardown for running Ruby tests, that can otherwise be accomplished in a more manual fashion, using the other commands. It assumes that the test files will automatically establish a connection to the correct database when they are loaded (this is the case for Rails).
Class Method Summary collapse
Class Method Details
.main(argv) ⇒ Object
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 45 |
# File 'lib/piggly/command/test.rb', line 13 def main(argv) benchmark do tests, filters = (argv) profile = Profile.new # don't let rspec get these when loading spec files ARGV.clear load_tests(tests) Command.connect_to_database procedures = dump_procedures(filters) if procedures.empty? abort "No stored procedures in the database#{' matched your criteria' if filters.any?}" end result = begin trace(procedures) clear_coverage execute_tests ensure untrace(procedures) end create_index(procedures) create_reports(procedures) store_coverage exit! result # avoid running tests again end end |