Module: Testy

Defined in:
lib/testy.rb

Defined Under Namespace

Classes: Test

Class Method Summary collapse

Class Method Details

.testing(*args, &block) ⇒ Object



160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/testy.rb', line 160

def Testy.testing(*args, &block)
  list = ARGV.delete('--list')||ARGV.delete('-l')
  selectors = ARGV.map{|arg| eval(arg =~ %r|^/.*| ? arg : "/^#{ Regexp.escape(arg) }/")}
  test = Test.new(*args, &block)
  if list
    y test.list
  else
    failures = test.run(:selectors => selectors)
    size = test.size
    pct_failed = size==0 || failures==0 ? 0 : [ ((failures/size.to_f)*100).to_i, 1 ].max
    exit(pct_failed)
  end
end

.versionObject



6
# File 'lib/testy.rb', line 6

def Testy.version() '0.5.0' end