waistband 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,7 @@ module Waistband
9
9
  include Singleton
10
10
 
11
11
  attr_accessor :config_dir
12
+ attr_writer :timeout
12
13
  attr_reader :env
13
14
 
14
15
  def initialize
@@ -51,7 +52,7 @@ module Waistband
51
52
  reload_on_failure: reload_on_failure,
52
53
  transport_options: {
53
54
  request: {
54
- open_timeout: @yml_config['timeout'],
55
+ open_timeout: timeout,
55
56
  timeout: @yml_config['timeout']
56
57
  }
57
58
  }
@@ -60,8 +61,17 @@ module Waistband
60
61
  Elasticsearch::Client.new client_hash
61
62
  end
62
63
 
64
+ def reset_timeout
65
+ remove_instance_variable '@timeout'
66
+ end
67
+
63
68
  private
64
69
 
70
+ def timeout
71
+ return @timeout if defined? @timeout
72
+ @yml_config['timeout']
73
+ end
74
+
65
75
  def default_config_dir
66
76
  @default_config_dir ||= begin
67
77
  return nil unless defined?(Rails)
@@ -1,3 +1,3 @@
1
1
  module Waistband
2
- VERSION = "0.9.4"
2
+ VERSION = "0.9.5"
3
3
  end
@@ -34,6 +34,14 @@ describe Waistband::Configuration do
34
34
  expect(::Waistband.client.transport.options[:adapter]).to eql :net_http
35
35
  end
36
36
 
37
+ it "permits changing the timeout on command" do
38
+ expect(::Waistband.config.send(:timeout)).to eql 2
39
+ ::Waistband.config.timeout = 10
40
+ expect(::Waistband.config.send(:timeout)).to eql 10
41
+ ::Waistband.config.reset_timeout
42
+ expect(::Waistband.config.send(:timeout)).to eql 2
43
+ end
44
+
37
45
  describe '#hosts' do
38
46
 
39
47
  it "returns array of all available servers' configs" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waistband
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-19 00:00:00.000000000 Z
12
+ date: 2014-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport