Skip to content

Commit 5710a18

Browse files
committed
Apply environment overrides to cli config.
1 parent 94d4b13 commit 5710a18

3 files changed

Lines changed: 9 additions & 18 deletions

File tree

lib/rubytest/cli.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ def run(argv=nil)
4444

4545
config.files.replace(argv) unless argv.empty?
4646

47-
#Test.run(config)
47+
config.apply_environment_overrides
4848

49+
#Test.run(config)
4950
runner = Runner.new(config)
5051
begin
5152
success = runner.run
@@ -57,10 +58,6 @@ def run(argv=nil)
5758
end
5859
end
5960

60-
def preparse_options(argv)
61-
62-
end
63-
6461
# Setup OptionsParser instance.
6562
#
6663
# @return [OptionParser]

lib/rubytest/config.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def to_shellwords
364364
#
365365
# @todo Better name for this method?
366366
# @return nothing
367-
def apply_environmemt_overrides
367+
def apply_environment_overrides
368368
@format = env(:format, @format)
369369
@autopath = env(:autopath, @autopath)
370370
@files = env(:files, @files)
@@ -379,7 +379,7 @@ def apply_environmemt_overrides
379379
# settings.
380380
#
381381
# @return nothing
382-
def apply_environmemt_defaults
382+
def apply_environment_defaults
383383
@format = env(:format, @format) if @format.nil?
384384
@autopath = env(:autopath, @autopath) if @autopath.nil?
385385
@files = env(:files, @files) if @files.empty?
@@ -415,14 +415,14 @@ def load_config(file)
415415

416416
private
417417

418-
# Lookup environment variable with name `RUBYTEST_{NAME}`,
418+
# Lookup environment variable with name `rubytest_{name}`,
419419
# and transform in according to the type of the given
420420
# default. If the environment variable is not set then
421421
# returns the default.
422422
#
423423
# @return [Object]
424424
def env(name, default=nil)
425-
value = ENV["rubytest-#{name}".downcase]
425+
value = ENV["rubytest_#{name}".downcase]
426426

427427
case default
428428
when Array

lib/rubytest/runner.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ def self.run(config=nil, &config_proc)
2626
end
2727
end
2828

29-
# Default report is in the old "dot-progress" format.
30-
#DEFAULT_FORMAT = 'dotprogress'
31-
3229
# Exceptions that are not caught by test runner.
3330
OPEN_ERRORS = [NoMemoryError, SignalException, Interrupt, SystemExit]
3431

@@ -87,17 +84,14 @@ def upon(type, &block)
8784
# Config instance.
8885
#
8986
def initialize(config=nil, &block)
90-
case config
91-
when Hash
92-
@config = Config.new(config)
87+
if config
88+
@config = Hash === config ? Config.new(config) : config
9389
else
94-
@config = config || Test.configuration
90+
@config = Test.configuration
9591
end
9692

9793
block.call(@config) if block
9894

99-
#@verbose = @config.verbose
100-
10195
@advice = Advice.new
10296
end
10397

0 commit comments

Comments
 (0)