Module: DuckTest::ConfigHelper

Included in:
FrameWork::Base, FrameWork::FileManager, FrameWork::Map, FrameWork::Queue, FrameWork::WatchConfig
Defined in:
lib/duck_test/config_helper.rb

Overview

For inclusion in classes that need the standard attributes

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) autorun

Controls if tests/specs should be run automatically when changed.

Returns:

  • (Boolean)


71
72
73
74
# File 'lib/duck_test/config_helper.rb', line 71

def autorun
  @autorun = true unless defined? @autorun
  @autorun
end

- (Boolean) autorun=(value)

Sets if tests/specs should be run automatically when changed. A value of true means test will be automatically run, otherwise, tests have to be run manually.

Returns:

  • (Boolean)


87
88
89
# File 'lib/duck_test/config_helper.rb', line 87

def autorun=(value)
  @autorun = value
end

- (Boolean) autorun?

Returns true is autorun is enabled, otherwise, returns false.

Returns:

  • (Boolean)


79
80
81
# File 'lib/duck_test/config_helper.rb', line 79

def autorun?
  @autorun
end

- (String) autorun_status

Constructs a message indicating the current status of autorun.

Returns:

  • (String)

    Current autorun status message.



94
95
96
# File 'lib/duck_test/config_helper.rb', line 94

def autorun_status
  return "Autorun is #{self.autorun ? 'ON' : 'OFF'}"
end

- (String) root

Root directory for all files to watch. Typically, this will equate to Rails.root The default value is the current directory '.'

puts DuckTest::Config.root  # '.'

Returns:

  • (String)


13
14
15
# File 'lib/duck_test/config_helper.rb', line 13

def root
  return @root ||= "."
end

- (String) root=(value)

Sets the root directory for all files to watch. Typically, this will equate to Rails.root The default value is the current directory '.', however, DuckTest::Config will set this value to the Rails.root directory if being loaded in a Rails environment. The purpose of this attribute is to account for the event that a development environment might deviate slightly from the standard to compensate for an unknown requirement.

DuckTest::Config.root = "/my_directory"
puts DuckTest::Config.root  # => '/my_directory'

Returns:

  • (String)


28
29
30
31
32
# File 'lib/duck_test/config_helper.rb', line 28

def root=(value)
  @root = value.to_s unless value.blank?
  @root = File.expand_path(@root) unless @root.blank?
  return @root
end

- (String) runnable_basedir

Note:

See README for details and examples

The runnable_basedir is used when evaluating directories and files and it's main purpose is to provide the conveinence of not having to specify full directory paths in runnable definitions.

Returns:

  • (String)

    Returns the current value of runnable_basedir



57
58
59
# File 'lib/duck_test/config_helper.rb', line 57

def runnable_basedir
  return @runnable_basedir ||= ""
end

- (String) runnable_basedir=(value)

Sets the current of runnable_basedir.

Returns:

  • (String)


64
65
66
# File 'lib/duck_test/config_helper.rb', line 64

def runnable_basedir=(value)
  @runnable_basedir = value.to_s unless value.blank?
end

- (String) watch_basedir

Note:

See README for details and examples

The watch_basedir is used when evaluating directories and files and it's main purpose is to provide the conveinence of not having to specify full directory paths in watch definitions.

Returns:

  • (String)

    Returns the current value of watch_basedir



40
41
42
# File 'lib/duck_test/config_helper.rb', line 40

def watch_basedir
  return @watch_basedir ||= ""
end

- (String) watch_basedir=(value)

Sets the current of watch_basedir.

Returns:

  • (String)


47
48
49
# File 'lib/duck_test/config_helper.rb', line 47

def watch_basedir=(value)
  @watch_basedir = value.to_s unless value.blank?
end