linode-incandescent 0.6.2.SNAPSHOT
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/CHANGELOG +2 -0
- data/MIT-LICENSE +20 -0
- data/README +140 -0
- data/Rakefile +31 -0
- data/VERSION +1 -0
- data/lib/linode.rb +102 -0
- data/lib/linode/avail.rb +3 -0
- data/lib/linode/domain.rb +4 -0
- data/lib/linode/domain/resource.rb +3 -0
- data/lib/linode/linode.rb +4 -0
- data/lib/linode/linode/config.rb +3 -0
- data/lib/linode/linode/disk.rb +3 -0
- data/lib/linode/linode/ip.rb +3 -0
- data/lib/linode/linode/job.rb +3 -0
- data/lib/linode/stackscript.rb +3 -0
- data/lib/linode/test.rb +3 -0
- data/lib/linode/user.rb +3 -0
- data/linode.gemspec +87 -0
- data/spec/linode/avail_spec.rb +45 -0
- data/spec/linode/domain/resource_spec.rb +44 -0
- data/spec/linode/domain_spec.rb +82 -0
- data/spec/linode/linode/config_spec.rb +44 -0
- data/spec/linode/linode/disk_spec.rb +44 -0
- data/spec/linode/linode/ip_spec.rb +44 -0
- data/spec/linode/linode/job_spec.rb +44 -0
- data/spec/linode/linode_spec.rb +196 -0
- data/spec/linode/stackscript_spec.rb +44 -0
- data/spec/linode/test_spec.rb +45 -0
- data/spec/linode/user_spec.rb +45 -0
- data/spec/linode_spec.rb +350 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +22 -0
- metadata +129 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
+
require 'linode'
|
3
|
+
|
4
|
+
describe Linode::Avail do
|
5
|
+
before :each do
|
6
|
+
@api_key = 'foo'
|
7
|
+
@linode = Linode::Avail.new(:api_key => @api_key)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be a Linode instance' do
|
11
|
+
@linode.class.should < Linode
|
12
|
+
end
|
13
|
+
|
14
|
+
%w(datacenters kernels linodeplans distributions stackscripts).each do |action|
|
15
|
+
it "should allow accessing the #{action} API" do
|
16
|
+
@linode.should respond_to(action.to_sym)
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "when accessing the #{action} API" do
|
20
|
+
it 'should allow a data hash' do
|
21
|
+
lambda { @linode.send(action.to_sym, {}) }.should_not raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should not require arguments' do
|
25
|
+
lambda { @linode.send(action.to_sym) }.should_not raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should request the avail.#{action} action" do
|
29
|
+
@linode.expects(:send_request).with {|api_action, data| api_action == "avail.#{action}" }
|
30
|
+
@linode.send(action.to_sym)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should provide the data hash when making its request' do
|
34
|
+
@linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } }
|
35
|
+
@linode.send(action.to_sym, {:foo => :bar})
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return the result of the request' do
|
39
|
+
@linode.expects(:send_request).returns(:bar => :baz)
|
40
|
+
@linode.send(action.to_sym).should == { :bar => :baz }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
2
|
+
require 'linode'
|
3
|
+
|
4
|
+
describe Linode::Domain::Resource do
|
5
|
+
before :each do
|
6
|
+
@api_key = 'foo'
|
7
|
+
@linode = Linode::Domain::Resource.new(:api_key => @api_key)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be a Linode instance' do
|
11
|
+
@linode.class.should < Linode
|
12
|
+
end
|
13
|
+
|
14
|
+
%w(create delete update list).each do |action|
|
15
|
+
it "should allow accessing the #{action} API" do
|
16
|
+
@linode.should respond_to(action.to_sym)
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "when accessing the #{action} API" do
|
20
|
+
it 'should allow a data hash' do
|
21
|
+
lambda { @linode.send(action.to_sym, {}) }.should_not raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should not require arguments' do
|
25
|
+
lambda { @linode.send(action.to_sym) }.should_not raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should request the avail.#{action} action" do
|
29
|
+
@linode.expects(:send_request).with {|api_action, data| api_action == "domain.resource.#{action}" }
|
30
|
+
@linode.send(action.to_sym)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should provide the data hash when making its request' do
|
34
|
+
@linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } }
|
35
|
+
@linode.send(action.to_sym, {:foo => :bar})
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return the result of the request' do
|
39
|
+
@linode.expects(:send_request).returns(:bar => :baz)
|
40
|
+
@linode.send(action.to_sym).should == { :bar => :baz }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
+
require 'linode'
|
3
|
+
|
4
|
+
describe Linode::Domain do
|
5
|
+
before :each do
|
6
|
+
@api_key = 'foo'
|
7
|
+
@linode = Linode::Domain.new(:api_key => @api_key)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be a Linode instance' do
|
11
|
+
@linode.class.should < Linode
|
12
|
+
end
|
13
|
+
|
14
|
+
%w(update create list delete).each do |action|
|
15
|
+
it "should allow accessing the #{action} API" do
|
16
|
+
@linode.should respond_to(action.to_sym)
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "when accessing the #{action} API" do
|
20
|
+
it 'should allow a data hash' do
|
21
|
+
lambda { @linode.send(action.to_sym, {}) }.should_not raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should not require arguments' do
|
25
|
+
lambda { @linode.send(action.to_sym) }.should_not raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should request the domain.#{action} action" do
|
29
|
+
@linode.expects(:send_request).with {|api_action, data| api_action == "domain.#{action}" }
|
30
|
+
@linode.send(action.to_sym)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should provide the data hash when making its request' do
|
34
|
+
@linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } }
|
35
|
+
@linode.send(action.to_sym, {:foo => :bar})
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return the result of the request' do
|
39
|
+
@linode.expects(:send_request).returns(:bar => :baz)
|
40
|
+
@linode.send(action.to_sym).should == { :bar => :baz }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should be able to provide access to the Linode Domain Resource API' do
|
46
|
+
@linode.should respond_to(:resource)
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'when providing access to the Linode Domain Resource API' do
|
50
|
+
before :each do
|
51
|
+
@api_key = 'foo'
|
52
|
+
@api_url = 'https://fake.linode.com/'
|
53
|
+
@linode = Linode::Domain.new(:api_key => @api_key, :api_url => @api_url)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should allow no arguments' do
|
57
|
+
lambda { @linode.resource }.should_not raise_error(ArgumentError)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should require no arguments' do
|
61
|
+
lambda { @linode.resource(:foo) }.should raise_error(ArgumentError)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should return a Linode::Domain::Resource instance' do
|
65
|
+
@linode.resource.class.should == Linode::Domain::Resource
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should set the API key on the Linode::Domain::Resource instance to be our API key' do
|
69
|
+
@linode.resource.api_key.should == @api_key
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should set the API url on the Linode::Domain::Resource instance to be our API url' do
|
73
|
+
@linode.resource.api_url.should == @api_url
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should return the same Linode::Domain::Resource instance when called again' do
|
77
|
+
linode = Linode::Domain.new(:api_key => @api_key)
|
78
|
+
result = linode.resource
|
79
|
+
linode.resource.should == result
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
2
|
+
require 'linode'
|
3
|
+
|
4
|
+
describe Linode::Linode::Config do
|
5
|
+
before :each do
|
6
|
+
@api_key = 'foo'
|
7
|
+
@linode = Linode::Linode::Config.new(:api_key => @api_key)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be a Linode instance' do
|
11
|
+
@linode.class.should < Linode
|
12
|
+
end
|
13
|
+
|
14
|
+
%w(update create list delete).each do |action|
|
15
|
+
it "should allow accessing the #{action} API" do
|
16
|
+
@linode.should respond_to(action.to_sym)
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "when accessing the #{action} API" do
|
20
|
+
it 'should allow a data hash' do
|
21
|
+
lambda { @linode.send(action.to_sym, {}) }.should_not raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should not require arguments' do
|
25
|
+
lambda { @linode.send(action.to_sym) }.should_not raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should request the avail.#{action} action" do
|
29
|
+
@linode.expects(:send_request).with {|api_action, data| api_action == "linode.config.#{action}" }
|
30
|
+
@linode.send(action.to_sym)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should provide the data hash when making its request' do
|
34
|
+
@linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } }
|
35
|
+
@linode.send(action.to_sym, {:foo => :bar})
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return the result of the request' do
|
39
|
+
@linode.expects(:send_request).returns(:bar => :baz)
|
40
|
+
@linode.send(action.to_sym).should == { :bar => :baz }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
2
|
+
require 'linode'
|
3
|
+
|
4
|
+
describe Linode::Linode::Disk do
|
5
|
+
before :each do
|
6
|
+
@api_key = 'foo'
|
7
|
+
@linode = Linode::Linode::Disk.new(:api_key => @api_key)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be a Linode instance' do
|
11
|
+
@linode.class.should < Linode
|
12
|
+
end
|
13
|
+
|
14
|
+
%w(update create list createfromdistribution createfromstackscript duplicate delete resize).each do |action|
|
15
|
+
it "should allow accessing the #{action} API" do
|
16
|
+
@linode.should respond_to(action.to_sym)
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "when accessing the #{action} API" do
|
20
|
+
it 'should allow a data hash' do
|
21
|
+
lambda { @linode.send(action.to_sym, {}) }.should_not raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should not require arguments' do
|
25
|
+
lambda { @linode.send(action.to_sym) }.should_not raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should request the avail.#{action} action" do
|
29
|
+
@linode.expects(:send_request).with {|api_action, data| api_action == "linode.disk.#{action}" }
|
30
|
+
@linode.send(action.to_sym)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should provide the data hash when making its request' do
|
34
|
+
@linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } }
|
35
|
+
@linode.send(action.to_sym, {:foo => :bar})
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return the result of the request' do
|
39
|
+
@linode.expects(:send_request).returns(:bar => :baz)
|
40
|
+
@linode.send(action.to_sym).should == { :bar => :baz }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
2
|
+
require 'linode'
|
3
|
+
|
4
|
+
describe Linode::Linode::Ip do
|
5
|
+
before :each do
|
6
|
+
@api_key = 'foo'
|
7
|
+
@linode = Linode::Linode::Ip.new(:api_key => @api_key)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be a Linode instance' do
|
11
|
+
@linode.class.should < Linode
|
12
|
+
end
|
13
|
+
|
14
|
+
%w(list).each do |action|
|
15
|
+
it "should allow accessing the #{action} API" do
|
16
|
+
@linode.should respond_to(action.to_sym)
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "when accessing the #{action} API" do
|
20
|
+
it 'should allow a data hash' do
|
21
|
+
lambda { @linode.send(action.to_sym, {}) }.should_not raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should not require arguments' do
|
25
|
+
lambda { @linode.send(action.to_sym) }.should_not raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should request the avail.#{action} action" do
|
29
|
+
@linode.expects(:send_request).with {|api_action, data| api_action == "linode.ip.#{action}" }
|
30
|
+
@linode.send(action.to_sym)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should provide the data hash when making its request' do
|
34
|
+
@linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } }
|
35
|
+
@linode.send(action.to_sym, {:foo => :bar})
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return the result of the request' do
|
39
|
+
@linode.expects(:send_request).returns(:bar => :baz)
|
40
|
+
@linode.send(action.to_sym).should == { :bar => :baz }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
2
|
+
require 'linode'
|
3
|
+
|
4
|
+
describe Linode::Linode::Job do
|
5
|
+
before :each do
|
6
|
+
@api_key = 'foo'
|
7
|
+
@linode = Linode::Linode::Job.new(:api_key => @api_key)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be a Linode instance' do
|
11
|
+
@linode.class.should < Linode
|
12
|
+
end
|
13
|
+
|
14
|
+
%w(list).each do |action|
|
15
|
+
it "should allow accessing the #{action} API" do
|
16
|
+
@linode.should respond_to(action.to_sym)
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "when accessing the #{action} API" do
|
20
|
+
it 'should allow a data hash' do
|
21
|
+
lambda { @linode.send(action.to_sym, {}) }.should_not raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should not require arguments' do
|
25
|
+
lambda { @linode.send(action.to_sym) }.should_not raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should request the avail.#{action} action" do
|
29
|
+
@linode.expects(:send_request).with {|api_action, data| api_action == "linode.job.#{action}" }
|
30
|
+
@linode.send(action.to_sym)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should provide the data hash when making its request' do
|
34
|
+
@linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } }
|
35
|
+
@linode.send(action.to_sym, {:foo => :bar})
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return the result of the request' do
|
39
|
+
@linode.expects(:send_request).returns(:bar => :baz)
|
40
|
+
@linode.send(action.to_sym).should == { :bar => :baz }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,196 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
2
|
+
require 'linode'
|
3
|
+
|
4
|
+
describe Linode::Linode do
|
5
|
+
before :each do
|
6
|
+
@api_key = 'foo'
|
7
|
+
@linode = Linode::Linode.new(:api_key => @api_key)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be a Linode instance' do
|
11
|
+
@linode.class.should < Linode
|
12
|
+
end
|
13
|
+
|
14
|
+
%w(update create list shutdown boot delete reboot).each do |action|
|
15
|
+
it "should allow accessing the #{action} API" do
|
16
|
+
@linode.should respond_to(action.to_sym)
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "when accessing the #{action} API" do
|
20
|
+
it 'should allow a data hash' do
|
21
|
+
lambda { @linode.send(action.to_sym, {}) }.should_not raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should not require arguments' do
|
25
|
+
lambda { @linode.send(action.to_sym) }.should_not raise_error(ArgumentError)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should request the linode.#{action} action" do
|
29
|
+
@linode.expects(:send_request).with {|api_action, data| api_action == "linode.#{action}" }
|
30
|
+
@linode.send(action.to_sym)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should provide the data hash when making its request' do
|
34
|
+
@linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } }
|
35
|
+
@linode.send(action.to_sym, {:foo => :bar})
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should return the result of the request' do
|
39
|
+
@linode.expects(:send_request).returns(:bar => :baz)
|
40
|
+
@linode.send(action.to_sym).should == { :bar => :baz }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should be able to provide access to the Linode Config API' do
|
46
|
+
@linode.should respond_to(:config)
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'when providing access to the Linode Config API' do
|
50
|
+
before :each do
|
51
|
+
@api_key = 'foo'
|
52
|
+
@api_url = 'https://fake.linode.com/'
|
53
|
+
@linode = Linode::Linode.new(:api_key => @api_key, :api_url => @api_url)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should allow no arguments' do
|
57
|
+
lambda { @linode.config }.should_not raise_error(ArgumentError)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should require no arguments' do
|
61
|
+
lambda { @linode.config(:foo) }.should raise_error(ArgumentError)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should return a Linode::Linode::Config instance' do
|
65
|
+
@linode.config.class.should == Linode::Linode::Config
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should set the API key on the Linode::Linode::Config instance to be our API key' do
|
69
|
+
@linode.config.api_key.should == @api_key
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should set the API url on the Linode::Linode::Config instance to be our API url' do
|
73
|
+
@linode.config.api_url.should == @api_url
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should return the same Linode::Linode::Config instance when called again' do
|
77
|
+
linode = Linode::Linode.new(:api_key => @api_key)
|
78
|
+
result = linode.config
|
79
|
+
linode.config.should == result
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should be able to provide access to the Linode Disk API' do
|
84
|
+
@linode.should respond_to(:disk)
|
85
|
+
end
|
86
|
+
|
87
|
+
describe 'when providing access to the Linode Disk API' do
|
88
|
+
before :each do
|
89
|
+
@api_key = 'foo'
|
90
|
+
@api_url = 'https://fake.linode.com/'
|
91
|
+
@linode = Linode::Linode.new(:api_key => @api_key, :api_url => @api_url)
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'should allow no arguments' do
|
95
|
+
lambda { @linode.disk }.should_not raise_error(ArgumentError)
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'should require no arguments' do
|
99
|
+
lambda { @linode.disk(:foo) }.should raise_error(ArgumentError)
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'should return a Linode::Linode::Disk instance' do
|
103
|
+
@linode.disk.class.should == Linode::Linode::Disk
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'should set the API key on the Linode::Linode::Disk instance to be our API key' do
|
107
|
+
@linode.disk.api_key.should == @api_key
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'should set the API url on the Linode::Linode::Disk instance to be our API url' do
|
111
|
+
@linode.disk.api_url.should == @api_url
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'should return the same Linode::Linode::Disk instance when called again' do
|
115
|
+
linode = Linode::Linode.new(:api_key => @api_key)
|
116
|
+
result = linode.disk
|
117
|
+
linode.disk.should == result
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'should be able to provide access to the Linode Job API' do
|
122
|
+
@linode.should respond_to(:job)
|
123
|
+
end
|
124
|
+
|
125
|
+
describe 'when providing access to the Linode Job API' do
|
126
|
+
before :each do
|
127
|
+
@api_key = 'foo'
|
128
|
+
@api_url = 'https://fake.linode.com/'
|
129
|
+
@linode = Linode::Linode.new(:api_key => @api_key, :api_url => @api_url)
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'should allow no arguments' do
|
133
|
+
lambda { @linode.job }.should_not raise_error(ArgumentError)
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'should require no arguments' do
|
137
|
+
lambda { @linode.job(:foo) }.should raise_error(ArgumentError)
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'should return a Linode::Linode::Job instance' do
|
141
|
+
@linode.job.class.should == Linode::Linode::Job
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'should set the API key on the Linode::Linode::Job instance to be our API key' do
|
145
|
+
@linode.job.api_key.should == @api_key
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'should set the API url on the Linode::Linode::Job instance to be our API url' do
|
149
|
+
@linode.job.api_url.should == @api_url
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'should return the same Linode::Linode::Job instance when called again' do
|
153
|
+
linode = Linode::Linode.new(:api_key => @api_key)
|
154
|
+
result = linode.job
|
155
|
+
linode.job.should == result
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'should be able to provide access to the Linode Ip API' do
|
160
|
+
@linode.should respond_to(:ip)
|
161
|
+
end
|
162
|
+
|
163
|
+
describe 'when providing access to the Linode Ip API' do
|
164
|
+
before :each do
|
165
|
+
@api_key = 'foo'
|
166
|
+
@api_url = 'https://fake.linode.com/'
|
167
|
+
@linode = Linode::Linode.new(:api_key => @api_key, :api_url => @api_url)
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'should allow no arguments' do
|
171
|
+
lambda { @linode.ip }.should_not raise_error(ArgumentError)
|
172
|
+
end
|
173
|
+
|
174
|
+
it 'should require no arguments' do
|
175
|
+
lambda { @linode.ip(:foo) }.should raise_error(ArgumentError)
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'should return a Linode::Linode::Ip instance' do
|
179
|
+
@linode.ip.class.should == Linode::Linode::Ip
|
180
|
+
end
|
181
|
+
|
182
|
+
it 'should set the API key on the Linode::Linode::Ip instance to be our API key' do
|
183
|
+
@linode.ip.api_key.should == @api_key
|
184
|
+
end
|
185
|
+
|
186
|
+
it 'should set the API url on the Linode::Linode::Ip instance to be our API url' do
|
187
|
+
@linode.ip.api_url.should == @api_url
|
188
|
+
end
|
189
|
+
|
190
|
+
it 'should return the same Linode::Linode::Linode instance when called again' do
|
191
|
+
linode = Linode::Linode.new(:api_key => @api_key)
|
192
|
+
result = linode.ip
|
193
|
+
linode.ip.should == result
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|