Bug fix in the overriding of max_threads when it was nil
This commit is contained in:
@@ -197,7 +197,7 @@ class Browser
|
|||||||
# Override with the options if they are set
|
# Override with the options if they are set
|
||||||
def override_config_with_options(options)
|
def override_config_with_options(options)
|
||||||
options.each do |option, value|
|
options.each do |option, value|
|
||||||
if ACCESSOR_OPTIONS.include?(option)
|
if value != nil and ACCESSOR_OPTIONS.include?(option)
|
||||||
self.send(:"#{option}=", value)
|
self.send(:"#{option}=", value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ describe Browser do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "#instance with :config_file = #{CONFIG_FILE_WITHOUT_PROXY}" do
|
describe "#instance with :config_file = #{CONFIG_FILE_WITHOUT_PROXY}" do
|
||||||
it 'will check the instance vars' do
|
it "will check the instance vars" do
|
||||||
Browser.reset
|
Browser.reset
|
||||||
check_instance_variables(
|
check_instance_variables(
|
||||||
Browser.instance(:config_file => CONFIG_FILE_WITHOUT_PROXY),
|
Browser.instance(:config_file => CONFIG_FILE_WITHOUT_PROXY),
|
||||||
@@ -104,7 +104,7 @@ describe Browser do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "#instance with :config_file = #{CONFIG_FILE_WITH_PROXY}" do
|
describe "#instance with :config_file = #{CONFIG_FILE_WITH_PROXY}" do
|
||||||
it 'will check the instance vars' do
|
it "will check the instance vars" do
|
||||||
Browser.reset
|
Browser.reset
|
||||||
check_instance_variables(
|
check_instance_variables(
|
||||||
Browser.instance(:config_file => CONFIG_FILE_WITH_PROXY),
|
Browser.instance(:config_file => CONFIG_FILE_WITH_PROXY),
|
||||||
@@ -113,16 +113,27 @@ describe Browser do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# => @todo Write something to test all possible overriding
|
# TODO Write something to test all possible overriding
|
||||||
describe "override option : user_agent" do
|
describe "override option : user_agent & threads" do
|
||||||
it "will check the instance vars, with an overriden one" do
|
it "will check the instance vars, with an overriden one" do
|
||||||
Browser.reset
|
Browser.reset
|
||||||
check_instance_variables(
|
check_instance_variables(
|
||||||
Browser.instance(
|
Browser.instance(
|
||||||
:config_file => CONFIG_FILE_WITHOUT_PROXY,
|
:config_file => CONFIG_FILE_WITHOUT_PROXY,
|
||||||
:user_agent => 'fake IE'
|
:user_agent => "fake IE"
|
||||||
),
|
),
|
||||||
@json_config_without_proxy.merge('user_agent' => 'fake IE')
|
@json_config_without_proxy.merge("user_agent" => "fake IE")
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should not override the max_threads if max_threads = nil" do
|
||||||
|
Browser.reset
|
||||||
|
check_instance_variables(
|
||||||
|
Browser.instance(
|
||||||
|
:config_file => CONFIG_FILE_WITHOUT_PROXY,
|
||||||
|
:max_threads => nil
|
||||||
|
),
|
||||||
|
@json_config_without_proxy
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user