webmock icon indicating copy to clipboard operation
webmock copied to clipboard

WebMock.disable_net_connect! Overwrite

Open eric-zhu-uw opened this issue 6 years ago • 0 comments

Currently the behavior for WebMock is for every call to WebMock.disable_net_connect!(options = {}) it will overwrite all previous configurations.

 def self.disable_net_connect!(options = {})
    Config.instance.allow_net_connect = false
    Config.instance.allow_localhost = options[:allow_localhost]
    Config.instance.allow = options[:allow]
    Config.instance.net_http_connect_on_start = options[:net_http_connect_on_start]
  end

This is annoying since it forces the user to reconfigure and redeclare all pre-existing allowed urls every time a change needs to be made.

It would be better if you had the option to append and remove instead of overwrite.

This ideology can be applied to a bunch of configuration settings however this is the one I used in particular so I am using it as an example

eric-zhu-uw avatar Feb 08 '19 22:02 eric-zhu-uw