Class: Detroit::RSpec

Inherits:
Tool
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#extraObject

Additional command line options for rspec.



57
58
59
# File 'lib/detroit-rspec.rb', line 57

def extra
  @extra
end

#formatObject

Format of RSpec output.



54
55
56
# File 'lib/detroit-rspec.rb', line 54

def format
  @format
end

#loadpathObject

Paths to add $LOAD_PATH. Defaults to [‘lib’].



42
43
44
# File 'lib/detroit-rspec.rb', line 42

def loadpath
  @loadpath
end

#requiresObject

Scripts to require before excuting specifications.



48
49
50
# File 'lib/detroit-rspec.rb', line 48

def requires
  @requires
end

#specsObject

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

#warningObject

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_pageObject



148
149
150
# File 'lib/detroit-rspec.rb', line 148

def self.man_page
  File.dirname(__FILE__)+'/../man/detroit-rspec.5'      
end

Instance Method Details

#documentObject

Run all specs with documentation output.



86
87
88
# File 'lib/detroit-rspec.rb', line 86

def document
  run_specs('documentation')
end

#runObject Also known as: test

Run all specs.

Returns false if any tests failed, otherwise true.



78
79
80
# File 'lib/detroit-rspec.rb', line 78

def run
  run_specs
end

#station_documentObject

Attach document method to document assembly station.



68
69
70
# File 'lib/detroit-rspec.rb', line 68

def station_document
  document
end

#station_testObject

Attach test method to test assembly station.



63
64
65
# File 'lib/detroit-rspec.rb', line 63

def station_test
  test
end