smartdc 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/.gitignore +2 -0
  2. data/.travis.yml +2 -1
  3. data/Gemfile +5 -2
  4. data/README.md +3 -4
  5. data/lib/smartdc/api/analytics.rb +1 -1
  6. data/lib/smartdc/api/analytics/heatmap.rb +1 -1
  7. data/lib/smartdc/api/datacenters.rb +1 -1
  8. data/lib/smartdc/api/datasets.rb +1 -1
  9. data/lib/smartdc/api/keys.rb +1 -1
  10. data/lib/smartdc/api/machine/metadata.rb +1 -1
  11. data/lib/smartdc/api/machine/snapshots.rb +1 -1
  12. data/lib/smartdc/api/machine/tags.rb +1 -1
  13. data/lib/smartdc/api/machines.rb +1 -1
  14. data/lib/smartdc/api/packages.rb +1 -0
  15. data/lib/smartdc/client.rb +1 -1
  16. data/lib/smartdc/error.rb +1 -1
  17. data/lib/smartdc/response/raise_error.rb +1 -1
  18. data/lib/smartdc/version.rb +1 -1
  19. data/smartdc.gemspec +1 -1
  20. data/spec/fixtures/datacenter.json +1 -1
  21. data/spec/fixtures/datacenters.json +1 -1
  22. data/spec/fixtures/machines.json +1 -1
  23. data/spec/fixtures/packages.json +1 -1
  24. data/spec/fixtures/snapshots.json +1 -1
  25. data/spec/fixtures/tag.json +1 -1
  26. data/spec/unit/smartdc/api/analytics_spec.rb +24 -29
  27. data/spec/unit/smartdc/api/datacenters_spec.rb +12 -15
  28. data/spec/unit/smartdc/api/datasets_spec.rb +14 -17
  29. data/spec/unit/smartdc/api/keys_spec.rb +24 -29
  30. data/spec/unit/smartdc/api/machine/metadata_spec.rb +19 -23
  31. data/spec/unit/smartdc/api/machine/snapshots_spec.rb +23 -107
  32. data/spec/unit/smartdc/api/machine/tags_spec.rb +23 -28
  33. data/spec/unit/smartdc/api/machines_spec.rb +24 -29
  34. data/spec/unit/smartdc/api/packages_spec.rb +13 -16
  35. data/spec/unit/smartdc/client_spec.rb +15 -14
  36. data/spec/unit/smartdc_spec.rb +4 -4
  37. metadata +4 -4
data/.gitignore CHANGED
@@ -20,3 +20,5 @@ tmp
20
20
  .rspec
21
21
  .sdccfg
22
22
  .sdccfg.*
23
+
24
+ sftp-config.json
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.0.0
3
4
  - 1.9.3
4
5
  gemfile:
5
- - Gemfile
6
+ - Gemfile
data/Gemfile CHANGED
@@ -4,11 +4,14 @@ gem "rake"
4
4
 
5
5
  group :development do
6
6
  gem "bundler"
7
- gem "rspec"
7
+ end
8
+
9
+ group :test do
10
+ gem "rspec", ">= 2.11"
8
11
  end
9
12
 
10
13
  group :runtime do
11
14
  gem "faraday", "~> 0.8"
12
- gem "thor", "~> 0.16"
15
+ gem "thor", "~> 0.18"
13
16
  gem "terminal-table", "~> 1.4"
14
17
  end
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  smartdc
2
2
  =======
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/smartdc.png)](https://rubygems.org/gems/smartdc) [![Build Status](https://travis-ci.org/ogom/ruby-smartdc.png?branch=master)](https://travis-ci.org/ogom/ruby-smartdc)
5
+
4
6
  ```
5
7
  .
6
8
  |
@@ -10,7 +12,7 @@ smartdc
10
12
 
11
13
  ```
12
14
 
13
- smartdc is Joyent's [SmartDataCenter](http://www.joyent.com/software/smartdatacenter) client and SmartDataCenter Command Line Interface.
15
+ smartdc is Joyent's [SmartDataCenter](http://www.joyent.com/software/smartdatacenter) client and SDC Command Line Interface.
14
16
  [Joyent CloudAPI Documentation](http://apidocs.joyent.com/sdcapidoc/cloudapi/).
15
17
 
16
18
 
@@ -89,9 +91,6 @@ end
89
91
  $ rake spec
90
92
  ```
91
93
 
92
- [![Build Status](https://travis-ci.org/ogom/ruby-smartdc.png?branch=master)](https://travis-ci.org/ogom/ruby-smartdc)
93
-
94
-
95
94
  ## License
96
95
 
97
96
  * MIT
@@ -41,4 +41,4 @@ module Smartdc
41
41
  end
42
42
  end
43
43
  end
44
- end
44
+ end
@@ -17,4 +17,4 @@ module Smartdc::Api
17
17
  end
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -17,4 +17,4 @@ module Smartdc
17
17
  end
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -17,4 +17,4 @@ module Smartdc
17
17
  end
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -26,4 +26,4 @@ module Smartdc
26
26
  end
27
27
  end
28
28
  end
29
- end
29
+ end
@@ -21,4 +21,4 @@ module Smartdc::Api
21
21
  end
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -32,4 +32,4 @@ module Smartdc::Api
32
32
  end
33
33
  end
34
34
  end
35
- end
35
+ end
@@ -26,4 +26,4 @@ module Smartdc::Api
26
26
  end
27
27
  end
28
28
  end
29
- end
29
+ end
@@ -67,4 +67,4 @@ module Smartdc
67
67
  end
68
68
  end
69
69
  end
70
- end
70
+ end
@@ -18,3 +18,4 @@ module Smartdc
18
18
  end
19
19
  end
20
20
  end
21
+
@@ -37,4 +37,4 @@ module Smartdc
37
37
  Smartdc::Api::Analytics.new(options)
38
38
  end
39
39
  end
40
- end
40
+ end
data/lib/smartdc/error.rb CHANGED
@@ -32,4 +32,4 @@ module Smartdc
32
32
  class Error::NotImplemented < Smartdc::Error; end
33
33
  class Error::BadGateway < Smartdc::Error; end
34
34
  class Error::ServiceUnavailable < Smartdc::Error; end
35
- end
35
+ end
@@ -35,4 +35,4 @@ module Smartdc
35
35
  end
36
36
  end
37
37
  end
38
- end
38
+ end
@@ -1,3 +1,3 @@
1
1
  module Smartdc
2
- VERSION = '1.2.2'
2
+ VERSION = '1.3.0'
3
3
  end
data/smartdc.gemspec CHANGED
@@ -18,6 +18,6 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
 
20
20
  gem.add_runtime_dependency(%q<faraday>, ["~> 0.8"])
21
- gem.add_runtime_dependency(%q<thor>, ["~> 0.16"])
21
+ gem.add_runtime_dependency(%q<thor>, ["~> 0.18"])
22
22
  gem.add_runtime_dependency(%q<terminal-table>, ["~> 1.4"])
23
23
  end
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "code": "ResourceMoved",
3
3
  "message": "Osaka is at https://127.0.0.1"
4
- }
4
+ }
@@ -1,3 +1,3 @@
1
1
  {
2
2
  "Osaka": "https://127.0.0.1"
3
- }
3
+ }
@@ -33,4 +33,4 @@
33
33
  "updated": "2012-12-12T23:59:04+00:00",
34
34
  "primaryIp": "192.168.1.3"
35
35
  }
36
- ]
36
+ ]
@@ -15,4 +15,4 @@
15
15
  "swap": 1024,
16
16
  "default": false
17
17
  }
18
- ]
18
+ ]
@@ -5,4 +5,4 @@
5
5
  "created": "2012-12-12T23:59:01+00:00",
6
6
  "updated": "2012-12-12T23:59:02+00:00"
7
7
  }
8
- ]
8
+ ]
@@ -1,3 +1,3 @@
1
1
  {
2
2
  "k001": "v001"
3
- }
3
+ }
@@ -1,52 +1,47 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Smartdc::Api::Analytics" do
4
-
5
- before(:all) do
6
- @object = Object.new
7
- @request = Smartdc::Request
8
- end
3
+ describe Smartdc::Api::Analytics do
4
+
5
+ let(:object) {Object.new}
6
+ let(:request) {Smartdc::Request}
7
+ let(:analytics) {Smartdc::Api::Analytics.new({})}
9
8
 
10
9
  describe ".create" do
11
- it "should return a instrumentation" do
12
- @object.stub(:content) {fixture('analytics')[0]}
13
- analytic = @object.content
14
- @request.stub_chain(:new, :post).with('my/analytics/instrumentations/', analytic) {@object}
10
+ it "creates a instrumentation" do
11
+ object.stub(:content) {fixture('analytics')[0]}
12
+ analytic = object.content
13
+ request.stub_chain(:new, :post).with('my/analytics/instrumentations/', analytic) {object}
15
14
 
16
- analytics = Smartdc::Api::Analytics.new({})
17
- analytics.create(analytic).content['id'].should == analytic['id']
15
+ expect(analytics.create(analytic).content['id']).to eq(analytic['id'])
18
16
  end
19
17
  end
20
18
 
21
19
  describe ".read" do
22
- it "should return a instrumentation" do
23
- @object.stub(:content) {fixture('analytics')[0]}
24
- id = @object.content['id']
25
- @request.stub_chain(:new, :get).with('my/analytics/instrumentations/' + id) {@object}
20
+ it "returns a instrumentation" do
21
+ object.stub(:content) {fixture('analytics')[0]}
22
+ id = object.content['id']
23
+ request.stub_chain(:new, :get).with('my/analytics/instrumentations/' + id) {object}
26
24
 
27
- analytics = Smartdc::Api::Analytics.new({})
28
- analytics.read(id).content['id'].should == id
25
+ expect(analytics.read(id).content['id']).to eq(id)
29
26
  end
30
27
  end
31
28
 
32
29
  describe ".all" do
33
- it "should return some instrumentations" do
34
- @object.stub(:content) {fixture('analytics')}
35
- @request.stub_chain(:new, :get).with('my/analytics/instrumentations', {}) {@object}
30
+ it "returns some instrumentations" do
31
+ object.stub(:content) {fixture('analytics')}
32
+ request.stub_chain(:new, :get).with('my/analytics/instrumentations', {}) {object}
36
33
 
37
- analytics = Smartdc::Api::Analytics.new({})
38
- analytics.all.content.count.should > 0
34
+ expect(analytics.all.content.count).to be > 0
39
35
  end
40
36
  end
41
37
 
42
- describe ".delete" do
43
- it "should return true when success" do
38
+ describe ".destroy" do
39
+ it "returns true when success" do
44
40
  analytic = fixture('analytics')[0]
45
- @object.stub(:status) {204}
46
- @request.stub_chain(:new, :del).with('my/analytics/instrumentations/' + analytic['id']) {@object}
41
+ object.stub(:status) {204}
42
+ request.stub_chain(:new, :del).with('my/analytics/instrumentations/' + analytic['id']) {object}
47
43
 
48
- analytics = Smartdc::Api::Analytics.new({})
49
- analytics.destroy(analytic['id']).status.should == 204
44
+ expect(analytics.destroy(analytic['id']).status).to eq(204)
50
45
  end
51
46
  end
52
47
 
@@ -1,30 +1,27 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Smartdc::Api::Datacenters" do
3
+ describe Smartdc::Api::Datacenters do
4
4
 
5
- before(:all) do
6
- @object = Object.new
7
- @request = Smartdc::Request
8
- end
5
+ let(:object) {Object.new}
6
+ let(:request) {Smartdc::Request}
7
+ let(:datacenters) {Smartdc::Api::Datacenters.new({})}
9
8
 
10
9
  describe ".read" do
11
- it "should return a datacenter" do
12
- @object.stub(:content) {fixture('datacenter')}
10
+ it "returns a datacenter" do
11
+ object.stub(:content) {fixture('datacenter')}
13
12
  name = fixture('datacenters').first[0]
14
- @request.stub_chain(:new, :get).with('my/datacenters/' + name) {@object}
13
+ request.stub_chain(:new, :get).with('my/datacenters/' + name) {object}
15
14
 
16
- datacenters = Smartdc::Api::Datacenters.new({})
17
- datacenters.read(name).content['message'].should match(/#{name}/)
15
+ expect(datacenters.read(name).content['message']).to match(/#{name}/)
18
16
  end
19
17
  end
20
18
 
21
19
  describe ".all" do
22
- it "should return some datacenter" do
23
- @object.stub(:content) {fixture('datacenters')}
24
- @request.stub_chain(:new, :get).with('my/datacenters', {}) {@object}
20
+ it "returns some datacenter" do
21
+ object.stub(:content) {fixture('datacenters')}
22
+ request.stub_chain(:new, :get).with('my/datacenters', {}) {object}
25
23
 
26
- datacenters = Smartdc::Api::Datacenters.new({})
27
- datacenters.all.content.count.should > 0
24
+ expect(datacenters.all.content.count).to be > 0
28
25
  end
29
26
  end
30
27
 
@@ -1,31 +1,28 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Smartdc::Api::Datasets" do
3
+ describe Smartdc::Api::Datasets do
4
4
 
5
- before(:all) do
6
- @object = Object.new
7
- @request = Smartdc::Request
8
- end
5
+ let(:object) {Object.new}
6
+ let(:request) {Smartdc::Request}
7
+ let(:datasets) {Smartdc::Api::Datasets.new({})}
9
8
 
10
9
  describe ".read" do
11
- it "should return a dataset" do
12
- @object.stub(:content) {fixture('datasets')[0]}
13
- id = @object.content['id']
14
- @request.stub_chain(:new, :get).with('my/datasets/' + id) {@object}
10
+ it "returns a dataset" do
11
+ object.stub(:content) {fixture('datasets')[0]}
12
+ id = object.content['id']
13
+ request.stub_chain(:new, :get).with('my/datasets/' + id) {object}
15
14
 
16
- datasets = Smartdc::Api::Datasets.new({})
17
- datasets.read(id).content['id'].should == id
15
+ expect(datasets.read(id).content['id']).to eq(id)
18
16
  end
19
17
  end
20
18
 
21
19
  describe ".all" do
22
- it "should return some datasets" do
23
- @object.stub(:content) {fixture('datasets')}
24
- @request.stub_chain(:new, :get).with('my/datasets', {}) {@object}
20
+ it "returns some datasets" do
21
+ object.stub(:content) {fixture('datasets')}
22
+ request.stub_chain(:new, :get).with('my/datasets', {}) {object}
25
23
 
26
- datasets = Smartdc::Api::Datasets.new({})
27
- datasets.all.content.count.should > 0
24
+ expect(datasets.all.content.count).to be > 0
28
25
  end
29
26
  end
30
27
 
31
- end
28
+ end
@@ -1,53 +1,48 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Smartdc::Api::Keys" do
3
+ describe Smartdc::Api::Keys do
4
4
 
5
- before(:all) do
6
- @object = Object.new
7
- @request = Smartdc::Request
8
- end
5
+ let(:object) {Object.new}
6
+ let(:request) {Smartdc::Request}
7
+ let(:keys) {Smartdc::Api::Keys.new({})}
9
8
 
10
9
  describe ".create" do
11
- it "should return a key" do
12
- @object.stub(:content) {fixture('keys')[0]}
13
- key = @object.content
14
- @request.stub_chain(:new, :post).with('my/keys/', key) {@object}
10
+ it "creates a key" do
11
+ object.stub(:content) {fixture('keys')[0]}
12
+ key = object.content
13
+ request.stub_chain(:new, :post).with('my/keys/', key) {object}
15
14
 
16
- keys = Smartdc::Api::Keys.new({})
17
- keys.create(key).content['name'].should == key['name']
15
+ expect(keys.create(key).content['name']).to eq(key['name'])
18
16
  end
19
17
  end
20
18
 
21
19
  describe ".read" do
22
- it "should return a key" do
23
- @object.stub(:content) {fixture('keys')[0]}
24
- name = @object.content['name']
25
- @request.stub_chain(:new, :get).with('my/keys/' + name) {@object}
20
+ it "returns a key" do
21
+ object.stub(:content) {fixture('keys')[0]}
22
+ name = object.content['name']
23
+ request.stub_chain(:new, :get).with('my/keys/' + name) {object}
26
24
 
27
- keys = Smartdc::Api::Keys.new({})
28
- keys.read(name).content['name'].should == name
25
+ expect(keys.read(name).content['name']).to eq(name)
29
26
  end
30
27
  end
31
28
 
32
29
  describe ".all" do
33
- it "should return some keys" do
34
- @object.stub(:content) {fixture('keys')}
35
- @request.stub_chain(:new, :get).with('my/keys', {}) {@object}
30
+ it "returns some keys" do
31
+ object.stub(:content) {fixture('keys')}
32
+ request.stub_chain(:new, :get).with('my/keys', {}) {object}
36
33
 
37
- keys = Smartdc::Api::Keys.new({})
38
- keys.all.content.count.should > 0
34
+ expect(keys.all.content.count).to be > 1
39
35
  end
40
36
  end
41
37
 
42
- describe ".delete" do
43
- it "should return true when success" do
38
+ describe ".destroy" do
39
+ it "returns true when success" do
44
40
  key = fixture('keys')[0]
45
- @object.stub(:status) {204}
46
- @request.stub_chain(:new, :del).with('my/keys/' + key['name']) {@object}
41
+ object.stub(:status) {204}
42
+ request.stub_chain(:new, :del).with('my/keys/' + key['name']) {object}
47
43
 
48
- keys = Smartdc::Api::Keys.new({})
49
- keys.destroy(key['name']).status.should == 204
44
+ expect(keys.destroy(key['name']).status).to eq(204)
50
45
  end
51
46
  end
52
47
 
53
- end
48
+ end
@@ -1,41 +1,37 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Smartdc::Api::Machine::Metadata" do
4
-
5
- before(:all) do
6
- @object = Object.new
7
- @request = Smartdc::Request
8
- end
3
+ describe Smartdc::Api::Machine::Metadata do
4
+
5
+ let(:object) {Object.new}
6
+ let(:request) {Smartdc::Request}
7
+ let(:metadata) {Smartdc::Api::Machine::Metadata.new('id', {})}
9
8
 
10
9
  describe ".create" do
11
- it "should return a metadata" do
12
- @object.stub(:content) {fixture('tag')}
13
- tag = @object.content
14
- @request.stub_chain(:new, :post).with('my/machines/id/metadata/', tag) {@object}
10
+ it "creates a metadata" do
11
+ object.stub(:content) {fixture('tag')}
12
+ tag = object.content
13
+ request.stub_chain(:new, :post).with('my/machines/id/metadata/', tag) {object}
15
14
 
16
- metadata = Smartdc::Api::Machine::Metadata.new('id', {})
17
- metadata.create(tag).content.should == tag
15
+ expect(metadata.create(tag).content).to eq(tag)
18
16
  end
19
17
  end
20
18
 
21
19
  describe ".read" do
22
- it "should return some metadata" do
23
- @object.stub(:content) {fixture('tag')}
24
- @request.stub_chain(:new, :get).with('my/machines/id/metadata', {}) {@object}
20
+ it "return some metadata" do
21
+ object.stub(:content) {fixture('tag')}
22
+ request.stub_chain(:new, :get).with('my/machines/id/metadata', {}) {object}
25
23
 
26
- metadata = Smartdc::Api::Machine::Metadata.new('id', {})
27
- metadata.read.content.count.should > 0
24
+ expect(metadata.read.content.count).to be > 0
28
25
  end
29
26
  end
30
27
 
31
- describe ".delete" do
32
- it "should return a metadata" do
33
- @object.stub(:status) {204}
28
+ describe ".destroy" do
29
+ it "return a metadata" do
30
+ object.stub(:status) {204}
34
31
  key = fixture('tag').first[0]
35
- @request.stub_chain(:new, :del).with('my/machines/id/metadata/' + key) {@object}
32
+ request.stub_chain(:new, :del).with('my/machines/id/metadata/' + key) {object}
36
33
 
37
- metadata = Smartdc::Api::Machine::Metadata.new('id', {})
38
- metadata.destroy(key).status.should == 204
34
+ expect(metadata.destroy(key).status).to eq(204)
39
35
  end
40
36
  end
41
37
 
@@ -1,132 +1,48 @@
1
-
2
1
  require 'spec_helper'
3
2
 
4
- describe "Smartdc::Api::Machine::Snapshots" do
3
+ describe Smartdc::Api::Machine::Snapshots do
5
4
 
6
- before(:all) do
7
- @object = Object.new
8
- @request = Smartdc::Request
9
- end
5
+ let(:object) {Object.new}
6
+ let(:request) {Smartdc::Request}
7
+ let(:snapshots) {Smartdc::Api::Machine::Snapshots.new('id', {})}
10
8
 
11
9
  describe ".create" do
12
- it "should return a snapshot" do
13
- @object.stub(:content) {fixture('snapshots')[0]}
14
- snapshot = @object.content
15
- @request.stub_chain(:new, :post).with('my/machines/id/snapshots/', snapshot) {@object}
10
+ it "creates a snapshot" do
11
+ object.stub(:content) {fixture('snapshots')[0]}
12
+ snapshot = object.content
13
+ request.stub_chain(:new, :post).with('my/machines/id/snapshots/', snapshot) {object}
16
14
 
17
- snapshots = Smartdc::Api::Machine::Snapshots.new('id', {})
18
- snapshots.create(snapshot).content['name'].should == snapshot['name']
15
+ expect(snapshots.create(snapshot).content['name']).to eq(snapshot['name'])
19
16
  end
20
17
  end
21
18
 
22
19
  describe ".read" do
23
- it "should return a snapshot" do
24
- @object.stub(:content) {fixture('snapshots')[0]}
25
- name = @object.content['name']
26
- @request.stub_chain(:new, :get).with('my/machines/id/snapshots/' + name) {@object}
20
+ it "return a snapshot" do
21
+ object.stub(:content) {fixture('snapshots')[0]}
22
+ name = object.content['name']
23
+ request.stub_chain(:new, :get).with('my/machines/id/snapshots/' + name) {object}
27
24
 
28
- snapshots = Smartdc::Api::Machine::Snapshots.new('id', {})
29
- snapshots.read(name).content['name'].should == name
25
+ expect(snapshots.read(name).content['name']).to eq(name)
30
26
  end
31
27
  end
32
28
 
33
29
  describe ".all" do
34
- it "should return some snapshots" do
35
- @object.stub(:content) {fixture('snapshots')}
36
- @request.stub_chain(:new, :get).with('my/machines/id/snapshots', {}) {@object}
30
+ it "return some snapshots" do
31
+ object.stub(:content) {fixture('snapshots')}
32
+ request.stub_chain(:new, :get).with('my/machines/id/snapshots', {}) {object}
37
33
 
38
- snapshots = Smartdc::Api::Machine::Snapshots.new('id', {})
39
- snapshots.all.content.count.should > 0
34
+ expect(snapshots.all.content.count).to be > 0
40
35
  end
41
36
  end
42
37
 
43
- describe ".delete" do
44
- it "should return a snapshot" do
45
- @object.stub(:status) {204}
38
+ describe ".destroy" do
39
+ it "return a snapshot" do
40
+ object.stub(:status) {204}
46
41
  name = fixture('snapshots')[0]['name']
47
- @request.stub_chain(:new, :del).with('my/machines/id/snapshots/' + name) {@object}
42
+ request.stub_chain(:new, :del).with('my/machines/id/snapshots/' + name) {object}
48
43
 
49
- snapshots = Smartdc::Api::Machine::Snapshots.new('id', {})
50
- snapshots.destroy(name).status.should == 204
44
+ expect(snapshots.destroy(name).status).to eq(204)
51
45
  end
52
46
  end
53
47
 
54
48
  end
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
- # require 'spec_helper'
64
-
65
- # describe "Smartdc::Api::Machine::Snapshots" do
66
- # before(:all) do
67
- # @fixture = fixture('tag')
68
- # @name = UUID.new.generate
69
- # client.datasets.find.each do |dataset|
70
- # if dataset.type == "smartmachine"
71
- # @dataset_urn = dataset.urn
72
- # break
73
- # end
74
- # end
75
-
76
- # machine = {
77
- # 'name' => @name,
78
- # 'dataset' => @dataset_urn
79
- # }
80
- # @machine = client.machines.create machine
81
- # machine = client.machines(@machine.id)
82
- # 88.times do |i|
83
- # break if machine.read.state == 'running'
84
- # sleep i
85
- # end
86
- # 88.times do |i|
87
- # break if machine.read.state == 'running'
88
- # sleep i
89
- # end
90
- # machine.stop
91
- # 88.times do |i|
92
- # break if machine.read.state == 'stopped'
93
- # sleep i
94
- # end
95
- # end
96
-
97
- # describe ".create" do
98
- # it "should return a snapshot" do
99
- # snapshot = client.machines(@machine.id).snapshots.create @fixture
100
- # snapshot.name.should eq @fixture['name']
101
- # end
102
- # end
103
-
104
- # describe ".read" do
105
- # it "should return a snapshot" do
106
- # client.machines(@machine.id).snapshots('sample').read.name.should eq @fixture['name']
107
- # end
108
- # end
109
-
110
- # describe ".find" do
111
- # it "should return some snapshots" do
112
- # client.machines(@machine.id).snapshots.find.count.should > 0
113
- # end
114
- # end
115
-
116
- # describe ".delete" do
117
- # it "should return true when success" do
118
- # client.machines(@machine.id).snapshots('sample').delete.should be_nil
119
- # end
120
- # end
121
-
122
- # after(:all) do
123
- # sleep 8
124
- # machine = client.machines(@machine.id)
125
- # machine.stop
126
- # 88.times do |i|
127
- # break if machine.read.state == 'stopped'
128
- # sleep i
129
- # end
130
- # client.machines(@machine.id).delete
131
- # end
132
- # end
@@ -1,52 +1,47 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Smartdc::Api::Machine::Tags" do
3
+ describe Smartdc::Api::Machine::Tags do
4
4
 
5
- before(:all) do
6
- @object = Object.new
7
- @request = Smartdc::Request
8
- end
5
+ let(:object) {Object.new}
6
+ let(:request) {Smartdc::Request}
7
+ let(:tags) {Smartdc::Api::Machine::Tags.new('id', {})}
9
8
 
10
9
  describe ".create" do
11
- it "should return a tag" do
12
- @object.stub(:content) {fixture('tag')}
13
- tag = @object.content
14
- @request.stub_chain(:new, :post).with('my/machines/id/tags/', tag) {@object}
10
+ it "creates a tag" do
11
+ object.stub(:content) {fixture('tag')}
12
+ tag = object.content
13
+ request.stub_chain(:new, :post).with('my/machines/id/tags/', tag) {object}
15
14
 
16
- tags = Smartdc::Api::Machine::Tags.new('id', {})
17
- tags.create(tag).content.should == tag
15
+ expect(tags.create(tag).content).to eq(tag)
18
16
  end
19
17
  end
20
18
 
21
19
  describe ".read" do
22
- it "should return a tag" do
23
- @object.stub(:content) {fixture('tag')}
24
- key = @object.content.first[0]
25
- @request.stub_chain(:new, :get).with('my/machines/id/tags/' + key) {@object}
20
+ it "return a tag" do
21
+ object.stub(:content) {fixture('tag')}
22
+ key = object.content.first[0]
23
+ request.stub_chain(:new, :get).with('my/machines/id/tags/' + key) {object}
26
24
 
27
- tags = Smartdc::Api::Machine::Tags.new('id', {})
28
- tags.read(key).content.first[0].should == key
25
+ expect(tags.read(key).content.first[0]).to eq(key)
29
26
  end
30
27
  end
31
28
 
32
29
  describe ".all" do
33
- it "should return some tags" do
34
- @object.stub(:content) {fixture('tag')}
35
- @request.stub_chain(:new, :get).with('my/machines/id/tags', {}) {@object}
30
+ it "return some tags" do
31
+ object.stub(:content) {fixture('tag')}
32
+ request.stub_chain(:new, :get).with('my/machines/id/tags', {}) {object}
36
33
 
37
- tags = Smartdc::Api::Machine::Tags.new('id', {})
38
- tags.all.content.count.should > 0
34
+ expect(tags.all.content.count).to be > 0
39
35
  end
40
36
  end
41
37
 
42
- describe ".delete" do
43
- it "should return a tag" do
44
- @object.stub(:status) {204}
38
+ describe ".destroy" do
39
+ it "return a tag" do
40
+ object.stub(:status) {204}
45
41
  key = fixture('tag').first[0]
46
- @request.stub_chain(:new, :del).with('my/machines/id/tags/' + key) {@object}
42
+ request.stub_chain(:new, :del).with('my/machines/id/tags/' + key) {object}
47
43
 
48
- tags = Smartdc::Api::Machine::Tags.new('id', {})
49
- tags.destroy(key).status.should == 204
44
+ expect(tags.destroy(key).status).to eq(204)
50
45
  end
51
46
  end
52
47
 
@@ -1,53 +1,48 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Smartdc::Api::Machines" do
3
+ describe Smartdc::Api::Machines do
4
4
 
5
- before(:all) do
6
- @object = Object.new
7
- @request = Smartdc::Request
8
- end
5
+ let(:object) {Object.new}
6
+ let(:request) {Smartdc::Request}
7
+ let(:machines) {Smartdc::Api::Machines.new({})}
9
8
 
10
9
  describe ".create" do
11
- it "should return a machine" do
12
- @object.stub(:content) {fixture('machines')[0]}
13
- machine = @object.content
14
- @request.stub_chain(:new, :post).with('my/machines/', machine) {@object}
10
+ it "creates a machine" do
11
+ object.stub(:content) {fixture('machines')[0]}
12
+ machine = object.content
13
+ request.stub_chain(:new, :post).with('my/machines/', machine) {object}
15
14
 
16
- machines = Smartdc::Api::Machines.new({})
17
- machines.create(machine).content['name'].should == machine['name']
15
+ expect(machines.create(machine).content['name']).to eq(machine['name'])
18
16
  end
19
17
  end
20
18
 
21
19
  describe ".read" do
22
- it "should return a machine" do
23
- @object.stub(:content) {fixture('machines')[0]}
24
- name = @object.content['name']
25
- @request.stub_chain(:new, :get).with('my/machines/' + name) {@object}
20
+ it "returns a machine" do
21
+ object.stub(:content) {fixture('machines')[0]}
22
+ name = object.content['name']
23
+ request.stub_chain(:new, :get).with('my/machines/' + name) {object}
26
24
 
27
- machines = Smartdc::Api::Machines.new({})
28
- machines.read(name).content['name'].should == name
25
+ expect(machines.read(name).content['name']).to eq(name)
29
26
  end
30
27
  end
31
28
 
32
29
  describe ".all" do
33
- it "should return some machines" do
34
- @object.stub(:content) {fixture('machines')}
35
- @request.stub_chain(:new, :get).with('my/machines', {}) {@object}
30
+ it "returns some machines" do
31
+ object.stub(:content) {fixture('machines')}
32
+ request.stub_chain(:new, :get).with('my/machines', {}) {object}
36
33
 
37
- machines = Smartdc::Api::Machines.new({})
38
- machines.all.content.count.should > 0
34
+ expect(machines.all.content.count).to be > 1
39
35
  end
40
36
  end
41
37
 
42
- describe ".delete" do
43
- it "should return true when success" do
38
+ describe ".destroy" do
39
+ it "returns true when success" do
44
40
  machine = fixture('machines')[0]
45
- @object.stub(:status) {204}
46
- @request.stub_chain(:new, :del).with('my/machines/' + machine['name']) {@object}
41
+ object.stub(:status) {204}
42
+ request.stub_chain(:new, :del).with('my/machines/' + machine['name']) {object}
47
43
 
48
- machines = Smartdc::Api::Machines.new({})
49
- machines.destroy(machine['name']).status.should == 204
44
+ expect(machines.destroy(machine['name']).status).to eq(204)
50
45
  end
51
46
  end
52
47
 
53
- end
48
+ end
@@ -1,30 +1,27 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Smartdc::Api::Packages" do
3
+ describe Smartdc::Api::Packages do
4
4
 
5
- before(:all) do
6
- @object = Object.new
7
- @request = Smartdc::Request
8
- end
5
+ let(:object) {Object.new}
6
+ let(:request) {Smartdc::Request}
7
+ let(:packages) {Smartdc::Api::Packages.new({})}
9
8
 
10
9
  describe ".read" do
11
- it "should return a package" do
12
- @object.stub(:content) {fixture('packages')[0]}
13
- name = @object.content['name']
14
- @request.stub_chain(:new, :get).with('my/packages/' + name) {@object}
10
+ it "returns a package" do
11
+ object.stub(:content) {fixture('packages')[0]}
12
+ name = object.content['name']
13
+ request.stub_chain(:new, :get).with('my/packages/' + name) {object}
15
14
 
16
- packages = Smartdc::Api::Packages.new({})
17
- packages.read(name).content['name'].should == name
15
+ expect(packages.read(name).content['name']).to eq(name)
18
16
  end
19
17
  end
20
18
 
21
19
  describe ".all" do
22
- it "should return some packages" do
23
- @object.stub(:content) {fixture('packages')}
24
- @request.stub_chain(:new, :get).with('my/packages', {}) {@object}
20
+ it "returns some packages" do
21
+ object.stub(:content) {fixture('packages')}
22
+ request.stub_chain(:new, :get).with('my/packages', {}) {object}
25
23
 
26
- packages = Smartdc::Api::Packages.new({})
27
- packages.all.content.count.should > 0
24
+ expect(packages.all.content.count).to be > 1
28
25
  end
29
26
  end
30
27
 
@@ -1,39 +1,40 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Smartdc::Client" do
3
+ describe Smartdc::Client do
4
4
  describe ".keys" do
5
- it "should return a Smartdc::Api::Keys" do
6
- Smartdc::Client.new.keys.should be_a Smartdc::Api::Keys
5
+ it "is a Smartdc::Api::Keys" do
6
+ expect(Smartdc::Client.new.keys).to be_a Smartdc::Api::Keys
7
7
  end
8
8
  end
9
9
 
10
10
  describe ".datacenters" do
11
- it "should return a Smartdc::Api::Datacenters" do
12
- Smartdc::Client.new.datacenters.should be_a Smartdc::Api::Datacenters
11
+ it "is a Smartdc::Api::Datacenters" do
12
+ expect(Smartdc::Client.new.datacenters).to be_a Smartdc::Api::Datacenters
13
13
  end
14
14
  end
15
15
 
16
16
  describe ".datasets" do
17
- it "should return a Smartdc::Api::Datasets" do
18
- Smartdc::Client.new.datasets.should be_a Smartdc::Api::Datasets
17
+ it "is a Smartdc::Api::Datasets" do
18
+ expect(Smartdc::Client.new.datasets).to be_a Smartdc::Api::Datasets
19
19
  end
20
20
  end
21
21
 
22
22
  describe ".packages" do
23
- it "should return a Smartdc::Api::Packages" do
24
- Smartdc::Client.new.packages.should be_a Smartdc::Api::Packages
23
+ it "is a Smartdc::Api::Packages" do
24
+ expect(Smartdc::Client.new.packages).to be_a Smartdc::Api::Packages
25
25
  end
26
26
  end
27
27
 
28
28
  describe ".machines" do
29
- it "should return a Smartdc::Api::Machines" do
30
- Smartdc::Client.new.machines.should be_a Smartdc::Api::Machines
29
+ it "is a Smartdc::Api::Machines" do
30
+ expect(Smartdc::Client.new.machines).to be_a Smartdc::Api::Machines
31
31
  end
32
32
  end
33
33
 
34
34
  describe ".analytics" do
35
- it "should return a Smartdc::Api::Analytics" do
36
- Smartdc::Client.new.analytics.should be_a Smartdc::Api::Analytics
35
+ it "is a Smartdc::Api::Analytics" do
36
+ expect(Smartdc::Client.new.analytics).to be_a Smartdc::Api::Analytics
37
37
  end
38
38
  end
39
- end
39
+
40
+ end
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Smartdc" do
3
+ describe Smartdc do
4
4
  describe ".new" do
5
- it "should return a Smartdc::Client" do
6
- Smartdc.new.should be_a Smartdc::Client
5
+ it "is a Smartdc::Client" do
6
+ expect(Smartdc.new).to be_a Smartdc::Client
7
7
  end
8
8
  end
9
- end
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartdc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
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: 2013-01-22 00:00:00.000000000 Z
12
+ date: 2013-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '0.16'
37
+ version: '0.18'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '0.16'
45
+ version: '0.18'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: terminal-table
48
48
  requirement: !ruby/object:Gem::Requirement