dubdubdub 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/dubdubdub.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "dubdubdub"
8
- s.version = "0.2.6"
8
+ s.version = "0.2.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Hu"]
data/lib/dubdubdub.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class DubDubDub
2
2
  # Version
3
- VERSION = "0.2.6"
3
+ VERSION = "0.2.7"
4
4
 
5
5
  attr_accessor :client
6
6
 
@@ -16,13 +16,13 @@ class DubDubDub::Client
16
16
  if options[:proxy]
17
17
  # If true, refer to global proxy config
18
18
  if options[:proxy] == true
19
- proxy = DubDubDub.configuration.proxy
19
+ unless DubDubDub.configuration.ignore_proxy?
20
+ proxy = DubDubDub.configuration.proxy
20
21
 
21
- if proxy.nil? and !DubDubDub.configuration.ignore_proxy
22
- raise DubDubDub::Exception, "No proxy has been configured or provided!"
23
- end
22
+ raise DubDubDub::Exception, "No proxy has been configured or provided!" if proxy.nil?
24
23
 
25
- self.proxy = proxy
24
+ self.proxy = proxy
25
+ end
26
26
  # Otherwise, it should be a proxy url
27
27
  else
28
28
  self.proxy = options[:proxy]
@@ -7,6 +7,8 @@ class DubDubDub::Configuration
7
7
  self.ignore_proxy = false
8
8
  end
9
9
 
10
+ alias_method :ignore_proxy?, :ignore_proxy
11
+
10
12
  # Can be used as callable-setter when block provided.
11
13
  def proxy(&block)
12
14
  if block_given?
@@ -41,6 +41,16 @@ describe DubDubDub do
41
41
  www.proxy.should == "localhost:8000"
42
42
  end
43
43
 
44
+ it "ignores proxy if configured to and it's set to nil" do
45
+ DubDubDub.configure do |config|
46
+ config.ignore_proxy = true
47
+ config.proxy = nil
48
+ end
49
+
50
+ www = DubDubDub.new(proxy: true)
51
+ www.should_not be_proxy
52
+ end
53
+
44
54
  it "raises an error if we have specified to use a proxy but none has been set globally" do
45
55
  DubDubDub.configure do |config|
46
56
  config.ignore_proxy = false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dubdubdub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -208,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
208
208
  version: '0'
209
209
  segments:
210
210
  - 0
211
- hash: 172753336999949758
211
+ hash: 4395775456282320006
212
212
  required_rubygems_version: !ruby/object:Gem::Requirement
213
213
  none: false
214
214
  requirements: