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.



60
61
62
# File 'lib/detroit-rspec.rb', line 60

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

#outputObject

Output file, STDOUT if nil.



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

def output
  @output
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



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

TODO:

Attach documentaton?

Attach test method to test assembly.



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

def assemble(station, options={})
  case station
  #when :document then document
  when :test     then run
  end
end

#assemble?(station, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


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

def assemble?(station, options={})
  case station
  when :test then true
  end
end

#documentObject

Run all specs with documentation output.



96
97
98
# File 'lib/detroit-rspec.rb', line 96

def document
  run_specs('documentation')
end

#runObject 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