docker-api 1.5.4 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +19 -10
  3. data/docker-api.gemspec +1 -1
  4. data/lib/docker.rb +14 -7
  5. data/lib/docker/connection.rb +6 -1
  6. data/lib/docker/image.rb +6 -5
  7. data/lib/docker/version.rb +1 -1
  8. data/spec/docker/connection_spec.rb +14 -6
  9. data/spec/docker/container_spec.rb +27 -8
  10. data/spec/docker/image_spec.rb +23 -5
  11. data/spec/docker_spec.rb +36 -28
  12. data/spec/vcr/Docker/_info/returns_the_info_as_a_Hash.yml +16 -13
  13. data/spec/vcr/Docker/_validate_version/when_nothing_is_raised/validate_version_/.yml +16 -13
  14. data/spec/vcr/Docker/_version/returns_the_version_as_a_Hash.yml +16 -13
  15. data/spec/vcr/Docker_Container/_all/when_the_HTTP_response_is_a_200/materializes_each_Container_into_a_Docker_Container.yml +120 -211
  16. data/spec/vcr/Docker_Container/_attach/yields_each_chunk.yml +46 -38
  17. data/spec/vcr/Docker_Container/_changes/returns_the_changes_as_an_array.yml +65 -53
  18. data/spec/vcr/Docker_Container/_commit/creates_a_new_Image_from_the_Container_s_changes.yml +50 -41
  19. data/spec/vcr/Docker_Container/_copy/when_the_file_does_not_exist/raises_an_error.yml +62 -48
  20. data/spec/vcr/Docker_Container/_copy/when_the_input_is_a_directory/yields_each_chunk_of_the_tarred_directory.yml +194 -119
  21. data/spec/vcr/Docker_Container/_copy/when_the_input_is_a_file/yields_each_chunk_of_the_tarred_file.yml +127 -52
  22. data/spec/vcr/Docker_Container/_create/when_the_Container_does_not_yet_exist/when_the_HTTP_request_returns_a_200/sets_the_id.yml +18 -15
  23. data/spec/vcr/Docker_Container/_delete/deletes_the_container.yml +62 -126
  24. data/spec/vcr/Docker_Container/_export/yields_each_chunk.yml +49 -66
  25. data/spec/vcr/Docker_Container/_json/returns_the_description_as_a_Hash.yml +33 -27
  26. data/spec/vcr/Docker_Container/_kill/kills_the_container.yml +91 -129
  27. data/spec/vcr/Docker_Container/_restart/restarts_the_container.yml +116 -95
  28. data/spec/vcr/Docker_Container/_run/when_the_Container_s_command_does_not_return_status_code_of_0/raises_an_error.yml +50 -41
  29. data/spec/vcr/Docker_Container/_run/when_the_Container_s_command_returns_a_status_code_of_0/creates_a_new_container_to_run_the_specified_command.yml +135 -109
  30. data/spec/vcr/Docker_Container/_start/starts_the_container.yml +28 -57
  31. data/spec/vcr/Docker_Container/_stop/stops_the_container.yml +107 -143
  32. data/spec/vcr/Docker_Container/_top/returns_the_top_commands_as_an_Array.yml +78 -39
  33. data/spec/vcr/Docker_Container/_wait/waits_for_the_command_to_finish.yml +50 -41
  34. data/spec/vcr/Docker_Container/_wait/when_an_argument_is_given/and_a_command_runs_for_too_long/raises_a_ServerError.yml +35 -29
  35. data/spec/vcr/Docker_Container/_wait/when_an_argument_is_given/sets_the_read_timeout_to_that_amount_of_time.yml +50 -41
  36. data/spec/vcr/Docker_Image/_all/materializes_each_Image_into_a_Docker_Image.yml +34 -26
  37. data/spec/vcr/Docker_Image/_build/with_a_valid_Dockerfile/builds_an_image.yml +17 -17
  38. data/spec/vcr/Docker_Image/_build/with_an_invalid_Dockerfile/throws_a_UnexpectedResponseError.yml +20 -15
  39. data/spec/vcr/Docker_Image/_create/when_the_Image_does_not_yet_exist_and_the_body_is_a_Hash/sets_the_id.yml +19 -14
  40. data/spec/vcr/Docker_Image/_history/returns_the_history_of_the_Image.yml +34 -26
  41. data/spec/vcr/Docker_Image/_insert/inserts_the_url_s_file_into_a_new_Image.yml +134 -95
  42. data/spec/vcr/Docker_Image/_insert_local/when_the_local_file_does_exist/creates_a_new_Image_that_has_that_file.yml +29 -29
  43. data/spec/vcr/Docker_Image/_insert_local/when_the_local_file_does_not_exist/raises_an_error.yml +5 -5
  44. data/spec/vcr/Docker_Image/_insert_local/when_there_are_multiple_files_passed/creates_a_new_Image_that_has_each_file.yml +30 -30
  45. data/spec/vcr/Docker_Image/_json/returns_additional_information_about_image_image.yml +34 -26
  46. data/spec/vcr/Docker_Image/_remove/removes_the_Image.yml +49 -38
  47. data/spec/vcr/Docker_Image/_run/when_the_argument_is_a_String/splits_the_String_by_spaces_and_creates_a_new_Container.yml +64 -51
  48. data/spec/vcr/Docker_Image/_run/when_the_argument_is_an_Array/creates_a_new_Container.yml +64 -51
  49. data/spec/vcr/Docker_Image/_search/materializes_each_Image_into_a_Docker_Image.yml +20 -14
  50. data/spec/vcr/Docker_Image/_tag/tags_the_image_with_the_repo_name.yml +33 -25
  51. metadata +29 -54
  52. data/spec/vcr/Docker_Container/_create/when_the_Container_does_not_yet_exist_and_the_body_is_a_Hash/when_the_HTTP_request_returns_a_200/sets_the_id.yml +0 -30
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 73fb37b59d2a47b3db7d9c8a380f6e62ebdff7eb
4
+ data.tar.gz: eb221917606fb54355f075be67c508597749c67e
5
+ SHA512:
6
+ metadata.gz: 089db48c5b0bf31aab2d7a2136ea0a26818a93faa41e27ec1e838037cdf94eb7873b1b099a6cfd6a6f942de7c2bddf356e412a6417a1c66f3a0defebe2c6c9e1
7
+ data.tar.gz: e6aa7b45e53e29e09130bf3f39722b5ec8eb8c537e6a01244aaf0411c65b729d38ee4603f7e7be28cb4b665feda025cf1f73e49e9e4b5b3f2be8b7a03585891b
data/README.md CHANGED
@@ -2,7 +2,7 @@ docker-api
2
2
  ==========
3
3
  [![Gem Version](https://badge.fury.io/rb/docker-api.png)](http://badge.fury.io/rb/docker-api) [![travis-ci](https://travis-ci.org/swipely/docker-api.png?branch=master)](https://travis-ci.org/swipely/docker-api) [![Code Climate](https://codeclimate.com/github/swipely/docker-api.png)](https://codeclimate.com/github/swipely/docker-api) [![Dependency Status](https://gemnasium.com/swipely/docker-api.png)](https://gemnasium.com/swipely/docker-api)
4
4
 
5
- This gem provides an object-oriented interface to the [Docker Remote API](http://docs.docker.io/en/latest/api/docker_remote_api_v1.4/). Every method listed there is implemented, with the exception of attaching to the STDIN of a Container. At the time of this writing, docker-api is meant to interface with Docker version 0.5.*.
5
+ This gem provides an object-oriented interface to the [Docker Remote API](http://docs.docker.io/en/latest/api/docker_remote_api_v1.4/). Every method listed there is implemented, with the exception of attaching to the STDIN of a Container. At the time of this writing, docker-api is meant to interface with Docker version 0.6.*.
6
6
 
7
7
  Installation
8
8
  ------------
@@ -42,25 +42,34 @@ $ sudo docker -d
42
42
 
43
43
  This will daemonize Docker so that it can be used for the remote API calls.
44
44
 
45
- If you're running Docker locally, there is no setup to do in Ruby. If you're not, you'll have to point the gem to your server. For example:
45
+ If you're running Docker locally as a socket, there is no setup to do in Ruby. If you're not or change the path of the socket, you'll have to point the gem to your socket or local/remote port. For example:
46
46
 
47
47
  ```ruby
48
- Docker.url = 'http://example.com'
49
- Docker.options = { :port => 5422 }
48
+ Docker.url = 'http://example.com:5422'
50
49
  ```
51
50
 
52
- Two things to note here. The first is that this gem uses [excon](http://www.github.com/geemus/excon), so any of the options that are valid for `Excon.new` are alse valid for `Docker.options`. Second, by default Docker runs on port 4243. The gem will assume you want to connnect to port 4243 unless you specify otherwise.
51
+ Two things to note here. The first is that this gem uses [excon](http://www.github.com/geemus/excon), so any of the options that are valid for `Excon.new` are alse valid for `Docker.options`. Second, by default Docker runs on a socket. The gem will assume you want to connnect to the socket unless you specify otherwise.
53
52
 
54
53
  Also, you may set the above variables via `ENV` variables. For example:
55
54
 
56
55
  ```shell
57
- $ DOCKER_HOST=example.com DOCKER_PORT=1000 irb
56
+ $ DOCKER_URL=unix:///var/docker.sock irb
58
57
  irb(main):001:0> require 'docker'
59
58
  => true
60
59
  irb(main):002:0> Docker.url
61
- => http://example.com
60
+ => "unix:///var/docker.sock"
62
61
  irb(main):003:0> Docker.options
63
- => {:port=>1000}
62
+ => {}
63
+ ```
64
+
65
+ ```shell
66
+ $ DOCKER_URL=http://example.com:1000 irb
67
+ irb(main):001:0> require 'docker'
68
+ => true
69
+ irb(main):003:0> Docker.url
70
+ => "http://example.com:1000"
71
+ irb(main):004:0> Docker.options
72
+ => {}
64
73
  ```
65
74
 
66
75
  Before doing anything else, ensure you have the correct version of the Docker API. To do this, run `Docker.validate_version!`. If your installed version is not supported, a `Docker::Error::VersionError` is raised.
@@ -91,7 +100,7 @@ require 'docker'
91
100
  # => true
92
101
 
93
102
  # Create an Image.
94
- Docker::Image.create('fromRepo' => 'base')
103
+ Docker::Image.create('fromImage' => 'base')
95
104
  # => Docker::Image { :id => ae7ffbcd1, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
96
105
 
97
106
  # Insert a file into an Image from a url.
@@ -252,7 +261,7 @@ By default, each object connects to the connection specified by `Docker.connecti
252
261
  ```ruby
253
262
  require 'docker'
254
263
 
255
- Docker::Container.all({}, Docker::Connection.new(:url => 'http://example.com'))
264
+ Docker::Container.all({}, Docker::Connection.new('http://example.com:4243', {}))
256
265
  ```
257
266
 
258
267
  ## Known Issues
data/docker-api.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "docker-api"
15
15
  gem.require_paths = %w{lib}
16
16
  gem.version = Docker::VERSION
17
- gem.add_dependency 'excon', '>= 0.22.0'
17
+ gem.add_dependency 'excon', '>= 0.27.3'
18
18
  gem.add_dependency 'json'
19
19
  gem.add_dependency 'archive-tar-minitar'
20
20
  gem.add_development_dependency 'rake'
data/lib/docker.rb CHANGED
@@ -10,13 +10,20 @@ require 'archive/tar/minitar'
10
10
  module Docker
11
11
  attr_reader :creds
12
12
 
13
+ def default_socket_url
14
+ 'unix:///var/run/docker.sock'
15
+ end
16
+
17
+ def env_url
18
+ ENV['DOCKER_URL']
19
+ end
20
+
13
21
  def url
14
- @url ||= "http://#{ENV['DOCKER_HOST'] || 'localhost'}"
22
+ @url ||= ENV['DOCKER_URL'] || default_socket_url
15
23
  end
16
24
 
17
25
  def options
18
- port = (ENV['DOCKER_PORT'].nil? ? 4243 : ENV['DOCKER_PORT']).to_i
19
- @options ||= { :port => port.to_i }
26
+ @options ||= {}
20
27
  end
21
28
 
22
29
  def url=(new_url)
@@ -25,7 +32,7 @@ module Docker
25
32
  end
26
33
 
27
34
  def options=(new_options)
28
- @options = { :port => 4243 }.merge(new_options)
35
+ @options = new_options
29
36
  reset_connection!
30
37
  end
31
38
 
@@ -63,9 +70,9 @@ module Docker
63
70
  raise Docker::Error::VersionError, "Expected API Version: #{API_VERSION}"
64
71
  end
65
72
 
66
- module_function :url, :url=, :options, :options=, :connection,
67
- :reset_connection!, :version, :info, :authenticate!,
68
- :validate_version!
73
+ module_function :default_socket_url, :env_url, :url, :url=, :options,
74
+ :options=, :connection, :reset_connection!, :version,
75
+ :info, :authenticate!, :validate_version!
69
76
  end
70
77
 
71
78
  require 'docker/version'
@@ -15,7 +15,12 @@ class Docker::Connection
15
15
  when !opts.is_a?(Hash)
16
16
  raise ArgumentError, "Expected a Hash, got: '#{opts}'"
17
17
  else
18
- @url, @options = url, opts
18
+ uri = URI.parse(url)
19
+ if uri.scheme == "unix"
20
+ @url, @options = 'unix:///', {:socket => uri.path}.merge(opts)
21
+ else
22
+ @url, @options = url, opts
23
+ end
19
24
  end
20
25
  end
21
26
 
data/lib/docker/image.rb CHANGED
@@ -2,12 +2,12 @@
2
2
  class Docker::Image
3
3
  include Docker::Error
4
4
 
5
- attr_accessor :id, :connection
5
+ attr_accessor :id, :connection, :info
6
6
 
7
7
  # The private new method accepts a connection and optional id.
8
- def initialize(connection, id = nil)
8
+ def initialize(connection, id = nil, info = {})
9
9
  if connection.is_a?(Docker::Connection)
10
- @connection, @id = connection, id
10
+ @connection, @id, @info = connection, id, info
11
11
  else
12
12
  raise ArgumentError, "Expected a Docker::Connection, got: #{connection}."
13
13
  end
@@ -67,7 +67,8 @@ class Docker::Image
67
67
 
68
68
  # Return a String representation of the Image.
69
69
  def to_s
70
- "Docker::Image { :id => #{self.id}, :connection => #{self.connection} }"
70
+ "Docker::Image { :id => #{self.id}, :info => #{self.info.inspect}, "\
71
+ ":connection => #{self.connection} }"
71
72
  end
72
73
 
73
74
  # #json returns extra information about an Image, #history returns its
@@ -96,7 +97,7 @@ class Docker::Image
96
97
  # Return every Image.
97
98
  def all(opts = {}, conn = Docker.connection)
98
99
  hashes = Docker::Util.parse_json(conn.get('/images/json', opts)) || []
99
- hashes.map { |hash| new(conn, hash['Id']) }
100
+ hashes.map { |hash| new(conn, hash['Id'], hash.tap{|h| h.delete('Id')}) }
100
101
  end
101
102
 
102
103
  # Given a query like `{ :term => 'sshd' }`, queries the Docker Registry for
@@ -1,6 +1,6 @@
1
1
  module Docker
2
2
  # The version of the docker-api gem.
3
- VERSION = '1.5.4'
3
+ VERSION = '1.6.0'
4
4
 
5
5
  # The version of the compatible Docker remote API.
6
6
  API_VERSION = '1.4'
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Docker::Connection do
4
- subject { described_class.new('http://localhost', :port => 4243) }
4
+ subject { described_class.new('http://localhost:4243', {}) }
5
5
 
6
6
  describe '#initialize' do
7
- let(:url) { 'http://localhost' }
8
- let(:options) { { :port => 4243 } }
7
+ let(:url) { 'http://localhost:4243' }
8
+ let(:options) { {} }
9
9
  subject { described_class.new(url, options) }
10
10
 
11
11
  context 'when the first argument is not a String' do
@@ -17,6 +17,15 @@ describe Docker::Connection do
17
17
  end
18
18
 
19
19
  context 'when the first argument is a String' do
20
+ context 'and the url is a unix socket' do
21
+ let(:url) { 'unix:///var/run/docker.sock' }
22
+
23
+ it 'sets the socket path in the options' do
24
+ expect(subject.url).to eq('unix:///')
25
+ expect(subject.options).to include(:socket => '/var/run/docker.sock')
26
+ end
27
+ end
28
+
20
29
  context 'but the second argument is not a Hash' do
21
30
  let(:options) { :lol_not_a_hash }
22
31
 
@@ -80,9 +89,8 @@ describe Docker::Connection do
80
89
  end
81
90
 
82
91
  describe '#to_s' do
83
- let(:url) { 'google.com' }
84
- let(:port) { 4000 }
85
- let(:options) { { :port => port } }
92
+ let(:url) { 'http://google.com:4000' }
93
+ let(:options) { {} }
86
94
  let(:expected_string) {
87
95
  "Docker::Connection { :url => #{url}, :options => #{options} }"
88
96
  }
@@ -40,17 +40,34 @@ describe Docker::Container do
40
40
  before { subject.tap(&:start).tap(&:wait) }
41
41
 
42
42
  it 'returns the changes as an array', :vcr do
43
- changes.should == [{'Path' => '/root', 'Kind' => 2}]
43
+ changes.should == [
44
+ {
45
+ "Path" => "/root",
46
+ "Kind" => 2
47
+ },
48
+ {
49
+ "Path" => "/dev",
50
+ "Kind" => 0
51
+ },
52
+ {
53
+ "Path" => "/dev/kmsg",
54
+ "Kind" => 1
55
+ }
56
+ ]
44
57
  end
45
58
  end
46
59
 
47
60
  describe '#top' do
48
61
  subject {
49
- described_class.create('Cmd' => %w[find / -name '*'], 'Image' => 'base')
62
+ described_class.create(
63
+ 'Cmd' => %w[while true; do; done;],
64
+ 'Image' => 'base'
65
+ )
50
66
  }
51
67
  let(:top) { subject.top }
52
68
 
53
69
  before { subject.start }
70
+ after { subject.kill }
54
71
 
55
72
  it 'returns the top commands as an Array', :vcr do
56
73
  top.should be_a Array
@@ -60,7 +77,11 @@ describe Docker::Container do
60
77
  end
61
78
 
62
79
  describe '#copy' do
63
- subject { Docker::Image.create('fromImage' => 'base').run('ls') }
80
+ subject {
81
+ Docker::Image.create(
82
+ 'fromImage' => 'base'
83
+ ).run('touch /test').tap { |c| c.start.wait }
84
+ }
64
85
 
65
86
  context 'when the file does not exist' do
66
87
  it 'raises an error', :vcr do
@@ -72,8 +93,9 @@ describe Docker::Container do
72
93
  context 'when the input is a file' do
73
94
  it 'yields each chunk of the tarred file', :vcr do
74
95
  chunks = []
75
- subject.copy('/etc/hosts') { |chunk| chunks << chunk }
76
- chunks.join("\n").should include('localhost')
96
+ subject.copy('/test') { |chunk| chunks << chunk }
97
+ chunks = chunks.join("\n")
98
+ expect(chunks).to be_include('test')
77
99
  end
78
100
  end
79
101
 
@@ -173,9 +195,6 @@ describe Docker::Container do
173
195
  described_class.all.map(&:id).should be_none { |id|
174
196
  id.start_with?(subject.id)
175
197
  }
176
- described_class.all(:all => true).map(&:id).should be_any { |id|
177
- id.start_with?(subject.id)
178
- }
179
198
  end
180
199
  end
181
200
 
@@ -6,13 +6,22 @@ describe Docker::Image do
6
6
 
7
7
  let(:id) { 'bf119e2' }
8
8
  let(:connection) { Docker.connection }
9
+
10
+ let(:info) do
11
+ {"Repository" => "base", "Tag" => "latest",
12
+ "Created" => 1364102658, "Size" => 24653, "VirtualSize" => 180116135}
13
+ end
14
+
9
15
  let(:expected_string) do
10
- "Docker::Image { :id => #{id}, :connection => #{connection} }"
16
+ "Docker::Image { :id => #{id}, :info => #{info.inspect}, "\
17
+ ":connection => #{connection} }"
11
18
  end
19
+
12
20
  before do
13
21
  {
14
22
  :@id => id,
15
- :@connection => connection
23
+ :@connection => connection,
24
+ :@info => info
16
25
  }.each { |k, v| subject.instance_variable_set(k, v) }
17
26
  end
18
27
 
@@ -184,9 +193,18 @@ describe Docker::Image do
184
193
  before { subject.create('fromImage' => 'base') }
185
194
 
186
195
  it 'materializes each Image into a Docker::Image', :vcr do
187
- images.should be_all { |image|
188
- !image.id.nil? && image.is_a?(described_class)
189
- }
196
+ images.each do |image|
197
+ image.should_not be_nil
198
+
199
+ image.should be_a(described_class)
200
+
201
+ image.id.should_not be_nil
202
+
203
+ %w(Created Size VirtualSize).each do |key|
204
+ image.info.should have_key(key)
205
+ end
206
+ end
207
+
190
208
  images.length.should_not be_zero
191
209
  end
192
210
  end
data/spec/docker_spec.rb CHANGED
@@ -4,39 +4,31 @@ describe Docker do
4
4
  subject { Docker }
5
5
 
6
6
  before do
7
- ENV['DOCKER_HOST'] = nil
8
- ENV['DOCKER_PORT'] = nil
7
+ ENV['DOCKER_URL'] = nil
9
8
  end
10
9
 
11
10
  it { should be_a Module }
12
- its(:options) { should == { :port => 4243 } }
13
- its(:url) { should == 'http://localhost' }
14
- its(:connection) { should be_a Docker::Connection }
15
-
16
- context 'when the DOCKER_HOST ENV variable is set' do
17
- let(:host) { 'google.com' }
18
- let(:url) { "http://#{host}" }
19
11
 
12
+ context 'default url and connection' do
20
13
  before do
21
- Docker.instance_variable_set(:@url, nil)
22
- ENV['DOCKER_HOST'] = host
14
+ Docker.url = nil
15
+ Docker.options = nil
23
16
  end
24
17
 
25
- it 'sets Docker.url to that variable' do
26
- subject.url.should == url
18
+ context "when the DOCKER_* ENV variables aren't set" do
19
+ its(:options) { {} }
20
+ its(:url) { should == 'unix:///var/run/docker.sock' }
21
+ its(:connection) { should be_a Docker::Connection }
27
22
  end
28
- end
29
23
 
30
- context 'when the DOCKER_PORT ENV variable is set' do
31
- let(:port) { 1234 }
32
-
33
- before do
34
- Docker.instance_variable_set(:@options, nil)
35
- ENV['DOCKER_PORT'] = port.to_s
36
- end
24
+ context "when the DOCKER_* ENV variables are set" do
25
+ before do
26
+ ENV['DOCKER_URL'] = 'unixs:///var/run/not-docker.sock'
27
+ end
37
28
 
38
- it 'sets Docker.options[:port] to that variable' do
39
- subject.options[:port].should == port
29
+ its(:options) { {} }
30
+ its(:url) { should == 'unixs:///var/run/not-docker.sock' }
31
+ its(:connection) { should be_a Docker::Connection }
40
32
  end
41
33
  end
42
34
 
@@ -52,8 +44,8 @@ describe Docker do
52
44
  [:options=, :url=].each do |method|
53
45
  describe "##{method}" do
54
46
  after(:all) do
55
- subject.options = { :port => 4243 }
56
- subject.url = 'http://localhost'
47
+ subject.instance_variable_set(:@url, nil)
48
+ subject.instance_variable_set(:@options, nil)
57
49
  end
58
50
  it 'calls #reset_connection!' do
59
51
  subject.should_receive(:reset_connection!)
@@ -63,18 +55,29 @@ describe Docker do
63
55
  end
64
56
 
65
57
  describe '#version' do
58
+ before do
59
+ subject.url = nil
60
+ subject.options = nil
61
+ end
62
+
66
63
  let(:version) { subject.version }
67
64
  it 'returns the version as a Hash', :vcr do
68
65
  version.should be_a Hash
69
- version.keys.sort.should == %w[GoVersion Version]
66
+ version.keys.sort.should == %w[GitCommit GoVersion Version]
70
67
  end
71
68
  end
72
69
 
73
70
  describe '#info' do
71
+ before do
72
+ subject.url = nil
73
+ subject.options = nil
74
+ end
75
+
74
76
  let(:info) { subject.info }
75
77
  let(:keys) do
76
- %w(Containers Debug Images KernelVersion LXCVersion MemoryLimit
77
- NEventsListener NFd NGoroutines)
78
+ %w(Containers Debug IPv4Forwarding Images IndexServerAddress
79
+ KernelVersion LXCVersion MemoryLimit NEventsListener NFd
80
+ NGoroutines)
78
81
  end
79
82
 
80
83
  it 'returns the info as a Hash', :vcr do
@@ -90,6 +93,11 @@ describe Docker do
90
93
  end
91
94
 
92
95
  describe '#validate_version' do
96
+ before do
97
+ subject.url = nil
98
+ subject.options = nil
99
+ end
100
+
93
101
  context 'when a Docker Error is raised' do
94
102
  before { Docker.stub(:info).and_raise(Docker::Error::ClientError) }
95
103