module Test
Public Class Methods
config()
click to toggle source
Stores test configurations.
# File lib/rubytest/config.rb, line 4 def self.config @config ||= {} end
configuration(profile=nil, reconfigurable=false)
click to toggle source
Get the current configuration.
@return [Config]
# File lib/rubytest/config.rb, line 31 def self.configuration(profile=nil, reconfigurable=false) @reconfigure = true if reconfigurable config[profile.to_s] ||= Config.new end
configure(profile=nil, &block)
click to toggle source
Configure test run via a block then will be passed a ‘Config` instance.
@return [Config]
# File lib/rubytest/config.rb, line 11 def self.configure(profile=nil, &block) if reconfigure? configuration(profile).apply(profile, &block) else config[profile.to_s] = Config.new(&block) end end
const_missing(name)
click to toggle source
Lookup missing constant in project index.
Calls superclass method
# File lib/rubytest.rb, line 21 def self.const_missing(name) index[name.to_s.downcase] || super(name) end
index()
click to toggle source
Load project index on demand.
# 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?()
click to toggle source
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.
@return [Config]
# File lib/rubytest/config.rb, line 24 def self.reconfigure? @reconfigure end
run(profile=nil, &config_proc)
click to toggle source
Alias for ‘Test.configure`. Use run! to run tests immediately.
# File lib/rubytest/runner.rb, line 6 def self.run(profile=nil, &config_proc) configure(profile, &config_proc) end
run!(config=nil, &config_proc)
click to toggle source
Configure and run immediately.
@todo Should this method return the success instead of exiting? @todo Wrap run in at_exit ?
@return [void]
# File lib/rubytest/runner.rb, line 16 def self.run!(config=nil, &config_proc) begin success = Runner.run(config, &config_proc) exit -1 unless success rescue => error raise error if $DEBUG $stderr.puts('ERROR: ' + error.to_s) exit -1 end end