Class: PLSQL::Spec::CLI
- Inherits:
-
Thor
- Object
- Thor
- PLSQL::Spec::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/plsql/spec/cli.rb
Instance Method Summary collapse
- #init ⇒ Object
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #run_tests(*files) ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
9 10 11 12 |
# File 'lib/plsql/spec/cli.rb', line 9 def initialize(*) super self.source_paths << File.('../templates', __FILE__) end |
Instance Method Details
#init ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/plsql/spec/cli.rb', line 17 def init empty_directory 'spec' %w(spec_helper.rb database.yml).each do |file| copy_file file, "spec/#{file}" end directory 'helpers', 'spec/helpers' empty_directory 'spec/factories' say <<-EOS, :red Please update spec/database.yml file and specify your database connection parameters. Create tests in spec/ directory (or in subdirectories of it) in *_spec.rb files. Run created tests with "plsql-spec run". Run tests with "plsql-spec run --coverage" to generate code coverage report in coverage/ directory. EOS end |
#run_tests(*files) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/plsql/spec/cli.rb', line 49 def run_tests(*files) unless File.directory?('spec') say "No spec subdirectory in current directory", :red exit 1 end ENV['PLSQL_DBMS_OUTPUT'] = 'true' if [:"dbms-output"] ENV['PLSQL_COVERAGE'] = [:coverage] if [:coverage] ENV['PLSQL_COVERAGE_IGNORE_SCHEMAS'] = [:"ignore-schemas"].join(',') if [:"ignore-schemas"] ENV['PLSQL_COVERAGE_LIKE'] = [:like].join(',') if [:like] if files.empty? say "Running all specs from spec/", :yellow puts run('spec spec', :verbose => false) else say "Running specs from #{files.join(', ')}", :yellow puts run("spec #{files.join(' ')}", :verbose => false) end unless $?.exitstatus == 0 say "Failing tests!", :red exit 1 end end |