Parent

Turn::Configuration

Central interface for Turn configuration.

Attributes

exclude[R]

List of file names or globs to exclude from tests list.

format[RW]

Reporter type.

framework[RW]

Test framework, either `:minitest` or `:testunit`. @todo Is this used any more?

live[RW]

Test against live install (i.e. Don't use loadpath option)

loadpath[R]

Add these folders to the $LOAD_PATH.

log[RW]

Log results? May be true/false or log file name. (TODO)

mark[RW]

Runtime threshold.

matchcase[RW]

Regexp pattern that all test cases must match to be eligible to run.

natural[RW]

Use natural language case names.

pattern[RW]

Regexp pattern that all test name's must match to be eligible to run.

requires[R]

Libs to require when running tests.

runmode[RW]

Run mode.

tests[R]

List of if file names or glob pattern of tests to run.

trace[RW]

Enable full backtrace

verbose[RW]

Verbose output?

Public Class Methods

new() click to toggle source
# File lib/turn/configuration.rb, line 83
def initialize
  yield(self) if block_given?
  initialize_defaults
end

Public Instance Methods

ansi=(boolean) click to toggle source
# File lib/turn/configuration.rb, line 138
def ansi=(boolean)
  @ansi = boolean ? true : false
end
ansi?() click to toggle source
# File lib/turn/configuration.rb, line 77
def ansi?
  @ansi
end
environment_ansi() click to toggle source
# File lib/turn/configuration.rb, line 226
def environment_ansi
  case ENV['ansi']
  when 'true','yes','on'
    true
  when 'false','no','off'
    false
  else
    nil
  end
end
environment_format() click to toggle source
# File lib/turn/configuration.rb, line 216
def environment_format
  ENV['rpt']
end
environment_trace() click to toggle source
# File lib/turn/configuration.rb, line 221
def environment_trace
  (ENV['backtrace'] ? ENV['backtrace'].to_i : nil)
end
exclude=(paths) click to toggle source
# File lib/turn/configuration.rb, line 150
def exclude=(paths)
  @exclude = list_option(paths)
end
files() click to toggle source

Test files.

# File lib/turn/configuration.rb, line 159
def files
  @files ||= (
    fs = tests.map do |t|
      File.directory?(t) ? Dir[File.join(t, '**', '*')] : Dir[t]
    end
    fs = fs.flatten.reject{ |f| File.directory?(f) }

    ex = exclude.map do |x|
      File.directory?(x) ? Dir[File.join(x, '**', '*')] : Dir[x]
    end
    ex = ex.flatten.reject{ |f| File.directory?(f) }

    (fs - ex).uniq.map{ |f| File.expand_path(f) }
  ).flatten
end
live?() click to toggle source
# File lib/turn/configuration.rb, line 69
def live?
  @live
end
loadpath=(paths) click to toggle source
# File lib/turn/configuration.rb, line 146
def loadpath=(paths)
  @loadpath = list_option(paths)
end
natural?() click to toggle source
# File lib/turn/configuration.rb, line 73
def natural?
  @natural
end
reporter() click to toggle source

Select reporter based on output mode.

# File lib/turn/configuration.rb, line 181
def reporter
  @reporter ||= (
    opts = reporter_options
    case format
    when :marshal
      require 'turn/reporters/marshal_reporter'
      Turn::MarshalReporter.new($stdout, opts)
    when :progress
      require 'turn/reporters/progress_reporter'
      Turn::ProgressReporter.new($stdout, opts)
    when :dotted, :dot
      require 'turn/reporters/dot_reporter'
      Turn::DotReporter.new($stdout, opts)
    when :outline
      require 'turn/reporters/outline_reporter'
      Turn::OutlineReporter.new($stdout, opts)
    when :cue
      require 'turn/reporters/cue_reporter'
      Turn::CueReporter.new($stdout, opts)
    when :pretty
      require 'turn/reporters/pretty_reporter'
      Turn::PrettyReporter.new($stdout, opts)
    else
      require 'turn/reporters/pretty_reporter'
      Turn::PrettyReporter.new($stdout, opts)
    end
  )
end
reporter_options() click to toggle source
# File lib/turn/configuration.rb, line 211
def reporter_options
  { :trace=>trace, :natural=>natural?, :verbose=>verbose?, :mark=>mark }
end
requires=(paths) click to toggle source
# File lib/turn/configuration.rb, line 154
def requires=(paths)
  @requires = list_option(paths)
end
suite_name() click to toggle source

TODO: Better name ?

# File lib/turn/configuration.rb, line 176
def suite_name
  files.map{ |path| File.dirname(path).sub(Dir.pwd+'/','') }.uniq.join(',')
end
tests=(paths) click to toggle source
# File lib/turn/configuration.rb, line 142
def tests=(paths)
  @tests = list_option(paths)
end
verbose?() click to toggle source
# File lib/turn/configuration.rb, line 65
def verbose?
  @verbose
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.