Module: Test

Defined in:
lib/rubytest.rb,
lib/rubytest/cli.rb,
lib/rubytest/rake.rb,
lib/rubytest/advice.rb,
lib/rubytest/config.rb,
lib/rubytest/runner.rb,
lib/rubytest/recorder.rb,
lib/rubytest/code_snippet.rb,
lib/rubytest/reporters/abstract.rb

Defined Under Namespace

Modules: Rake, Reporters Classes: Advice, CLI, CodeSnippet, Config, Recorder, Runner

Class Method Summary collapse

Class Method Details

.configuration(reconfigurable = false) ⇒ Config

Get the current configuration.

Returns:



26
27
28
29
# File 'lib/rubytest/config.rb', line 26

def self.configuration(reconfigurable=false)
  @reconfigure = true if reconfigurable
  @config ||= Config.new
end

.configure(&block) ⇒ Config

Configure test run via a block then will be passed a Config instance.

Returns:



6
7
8
9
10
11
12
# File 'lib/rubytest/config.rb', line 6

def self.configure(&block)
  if reconfigure?
    configuration.apply(&block)
  else
    @config = Config.new(&block)
  end
end

.const_missing(name) ⇒ Object

Lookup missing constant in project index.



21
22
23
# File 'lib/rubytest.rb', line 21

def self.const_missing(name)
  index[name.to_s.downcase] || super(name)
end

.indexObject

Load project index on demand.



11
12
13
14
15
16
17
18
# File 'lib/rubytest.rb', line 11

def self.index
  @index ||= (
    require 'yaml'
    __dir__  = File.dirname(__FILE__)
    file = File.expand_path('rubytest.yml', __dir__)
    YAML.load_file(file)
  )
end

.reconfigure?Config

Reconfigure test run via a block then will be passed the Config instance. Unlike configure this does not create a new Config instance, but instead augments the current configuration.

Returns:



19
20
21
# File 'lib/rubytest/config.rb', line 19

def self.reconfigure?
  @reconfigure
end

.run(config = nil, &config_proc) ⇒ Object

Deprecated.

Will probably change behavior in future.

Currently this is an alias for configure, however it is likely to become an alias for Runner.run in the future.



7
8
9
10
# File 'lib/rubytest/runner.rb', line 7

def self.run(config=nil, &config_proc)
  $stderr.puts "configuration profiles no longer supported." if config
  configure(&config_proc)
end