Class: SpecsFor::Runner
- Inherits:
-
Object
- Object
- SpecsFor::Runner
- Defined in:
- lib/specs_for/runner.rb
Overview
Runner parses CLI arguments, discovers spec files, and executes RSpec.
Constant Summary collapse
- DEFAULT_OPTIONS =
{ verbose: false, dry_run: false, rspec_options: [], }.freeze
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(argv = ARGV) ⇒ Runner
constructor
A new instance of Runner.
-
#run ⇒ Object
Entry-point: parse args, find specs, run rspec.
Constructor Details
#initialize(argv = ARGV) ⇒ Runner
Returns a new instance of Runner.
17 18 19 20 21 |
# File 'lib/specs_for/runner.rb', line 17 def initialize(argv = ARGV) @argv = argv.dup @options = DEFAULT_OPTIONS.dup @files = [] end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
9 10 11 |
# File 'lib/specs_for/runner.rb', line 9 def files @files end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/specs_for/runner.rb', line 9 def @options end |
Instance Method Details
#run ⇒ Object
Entry-point: parse args, find specs, run rspec. Returns the exit status (Integer).
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/specs_for/runner.rb', line 25 def run resolve_files spec_files = find_spec_files if spec_files.empty? warn "specs-for: no spec files found" return 1 end execute_rspec(spec_files) end |