Class: Detroit::RSpec
- Inherits:
-
Tool
- Object
- Tool
- Detroit::RSpec
- Defined in:
- lib/detroit-rspec.rb
Overview
The RSpec tool is used to run project specifications written with RSpec. Specifications are expected to found in the standard ‘spec/` directory unless otherwise specified in the tools options.
Options:
specs File glob(s) of spec files. Defaults to ['spec/**/*_spec.rb', 'spec/**/spec_*.rb'].
loadpath Paths to add $LOAD_PATH. Defaults to ['lib'].
live Ignore loadpath, use installed libraries instead. Default is false.
require Lib(s) to require before excuting specifications.
warning Whether to show warnings or not. Default is false.
format Format of RSpec output.
extra Additional commandl ine options for spec command.
NOTE: This tool currently shells out to the command line.
– TODO: Use rspec options file?
TODO: RCOV suppot?
ruby [ruby_opts] -Ilib -S rcov [rcov_opts] bin/spec -- examples [spec_opts]
++
Instance Attribute Summary collapse
-
#extra ⇒ Object
Additional command line options for rspec.
-
#format ⇒ Object
Format of RSpec output.
-
#loadpath ⇒ Object
Paths to add $LOAD_PATH.
-
#output ⇒ Object
Output file, STDOUT if nil.
-
#requires ⇒ Object
Scripts to require before excuting specifications.
-
#specs ⇒ Object
File glob(s) of spec files.
-
#warning ⇒ Object
Whether to show warnings or not.
Class Method Summary collapse
Instance Method Summary collapse
-
#assemble(station, options = {}) ⇒ Object
Attach test method to test assembly.
- #assemble?(station, options = {}) ⇒ Boolean
-
#document ⇒ Object
Run all specs with documentation output.
-
#run ⇒ Object
(also: #test)
Run all specs.
Instance Attribute Details
#extra ⇒ Object
Additional command line options for rspec.
60 61 62 |
# File 'lib/detroit-rspec.rb', line 60 def extra @extra end |
#format ⇒ Object
Format of RSpec output.
54 55 56 |
# File 'lib/detroit-rspec.rb', line 54 def format @format end |
#loadpath ⇒ Object
Paths to add $LOAD_PATH. Defaults to [‘lib’].
42 43 44 |
# File 'lib/detroit-rspec.rb', line 42 def loadpath @loadpath end |
#output ⇒ Object
Output file, STDOUT if nil.
57 58 59 |
# File 'lib/detroit-rspec.rb', line 57 def output @output end |
#requires ⇒ Object
Scripts to require before excuting specifications.
48 49 50 |
# File 'lib/detroit-rspec.rb', line 48 def requires @requires end |
#specs ⇒ Object
File glob(s) of spec files. Defaults to [‘spec/*/_spec.rb’, ‘spec/*/spec_.rb’].
36 37 38 |
# File 'lib/detroit-rspec.rb', line 36 def specs @specs end |
#warning ⇒ Object
Whether to show warnings or not. Default is false.
51 52 53 |
# File 'lib/detroit-rspec.rb', line 51 def warning @warning end |
Class Method Details
.man_page ⇒ Object
160 161 162 |
# File 'lib/detroit-rspec.rb', line 160 def self.man_page File.dirname(__FILE__)+'/../man/detroit-rspec.5' end |
Instance Method Details
#assemble(station, options = {}) ⇒ Object
Attach documentaton?
Attach test method to test assembly.
75 76 77 78 79 80 |
# File 'lib/detroit-rspec.rb', line 75 def assemble(station, ={}) case station #when :document then document when :test then run end end |
#assemble?(station, options = {}) ⇒ Boolean
66 67 68 69 70 |
# File 'lib/detroit-rspec.rb', line 66 def assemble?(station, ={}) case station when :test then true end end |
#document ⇒ Object
Run all specs with documentation output.
96 97 98 |
# File 'lib/detroit-rspec.rb', line 96 def document run_specs('documentation') end |
#run ⇒ Object Also known as: test
Run all specs.
Returns false
if any tests failed, otherwise true
.
88 89 90 |
# File 'lib/detroit-rspec.rb', line 88 def run run_specs end |