Skip to content

Commit df96206

Browse files
committed
Fix reference to config, and be able to apply a hash.
1 parent 3c3899d commit df96206

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

lib/rubytest/config.rb

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def self.configure(profile=nil, &block)
1212
if reconfigure?
1313
configuration(profile).apply(profile, &block)
1414
else
15-
@config[profile.to_s] = Config.new(&block)
15+
config[profile.to_s] = Config.new(&block)
1616
end
1717
end
1818

@@ -30,7 +30,7 @@ def self.reconfigure?
3030
# @return [Config]
3131
def self.configuration(profile=nil, reconfigurable=false)
3232
@reconfigure = true if reconfigurable
33-
@config[profile.to_s] ||= Config.new
33+
config[profile.to_s] ||= Config.new
3434
end
3535

3636
##
@@ -116,19 +116,16 @@ def initialize(settings={}, &block)
116116

117117
#apply_environment
118118

119-
settings.each do |k,v|
120-
send("#{k}=", v)
121-
end
122-
123-
self.class.load_config # deprecated!!!
124-
125-
apply(&block)
119+
apply(settings, &block)
126120
end
127121

128122
# Evaluate configuration block.
129123
#
130124
# @return nothing
131-
def apply(&block)
125+
def apply(hash={}, &block)
126+
hash.each do |k,v|
127+
send("#{k}=", v)
128+
end
132129
block.call(self) if block
133130
end
134131

lib/rubytest/runner.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def self.run(profile=nil, &config_proc)
1313
# @todo Wrap run in at_exit ?
1414
#
1515
# @return [void]
16-
def run!(config=nil, &config_proc)
16+
def self.run!(config=nil, &config_proc)
1717
begin
1818
success = Runner.run(config, &config_proc)
1919
exit -1 unless success
@@ -44,7 +44,7 @@ def self.run(config=nil) #:yield:
4444
config = Test.configuration(config)
4545
end
4646

47-
yeild config if block_given?
47+
yeild(config) if block_given?
4848

4949
runner = Runner.new(config)
5050
runner.run
@@ -108,6 +108,7 @@ def upon(type, &block)
108108
# Config instance.
109109
#
110110
def initialize(config)
111+
@config = config
111112
@advice = Advice.new
112113
end
113114

0 commit comments

Comments
 (0)