linode 0.7.10 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.rspec +1 -1
- data/Gemfile +5 -5
- data/Gemfile.lock +31 -0
- data/README.md +5 -2
- data/Rakefile +0 -17
- data/VERSION +1 -1
- data/lib/linode.rb +5 -2
- data/lib/linode/account.rb +4 -0
- data/lib/linode/avail.rb +2 -2
- data/lib/linode/image.rb +4 -0
- data/lib/linode/linode.rb +2 -2
- data/lib/linode/linode/disk.rb +2 -2
- data/lib/linode/linode/ip.rb +1 -1
- data/linode.gemspec +20 -74
- data/spec/linode/account_spec.rb +50 -0
- data/spec/linode/avail_spec.rb +17 -15
- data/spec/linode/domain/resource_spec.rb +16 -14
- data/spec/linode/domain_spec.rb +24 -22
- data/spec/linode/image_spec.rb +50 -0
- data/spec/linode/linode/config_spec.rb +16 -14
- data/spec/linode/linode/disk_spec.rb +18 -16
- data/spec/linode/linode/ip_spec.rb +17 -15
- data/spec/linode/linode/job_spec.rb +16 -14
- data/spec/linode/linode_spec.rb +48 -46
- data/spec/linode/nodebalancer/config_spec.rb +16 -14
- data/spec/linode/nodebalancer/node_spec.rb +16 -14
- data/spec/linode/nodebalancer_spec.rb +31 -29
- data/spec/linode/stackscript_spec.rb +16 -14
- data/spec/linode/test_spec.rb +17 -15
- data/spec/linode/user_spec.rb +3 -3
- data/spec/linode_spec.rb +48 -12
- data/spec/spec_helper.rb +2 -2
- metadata +84 -99
@@ -6,42 +6,44 @@ describe Linode::Nodebalancer::Config do
|
|
6
6
|
@api_key = 'foo'
|
7
7
|
@linode = Linode::Nodebalancer::Config.new(:api_key => @api_key)
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
it 'should be a Linode instance' do
|
11
11
|
@linode.class.should < Linode
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
%w(create delete update list).each do |action|
|
15
15
|
it "should allow accessing the #{action} API" do
|
16
16
|
@linode.should respond_to(action.to_sym)
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
describe "when accessing the #{action} API" do
|
20
20
|
it 'should allow a data hash' do
|
21
|
-
|
21
|
+
@linode.stubs(:send_request)
|
22
|
+
lambda { @linode.send(action.to_sym, {}) }.should_not raise_error
|
22
23
|
end
|
23
|
-
|
24
|
+
|
24
25
|
it 'should not require arguments' do
|
25
|
-
|
26
|
+
@linode.stubs(:send_request)
|
27
|
+
lambda { @linode.send(action.to_sym) }.should_not raise_error
|
26
28
|
end
|
27
|
-
|
29
|
+
|
28
30
|
it "should request the nodebalancer.config.#{action} action" do
|
29
31
|
@linode.expects(:send_request).with {|api_action, data| api_action == "nodebalancer.config.#{action}" }
|
30
32
|
@linode.send(action.to_sym)
|
31
33
|
end
|
32
|
-
|
34
|
+
|
33
35
|
it 'should provide the data hash when making its request' do
|
34
36
|
@linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } }
|
35
37
|
@linode.send(action.to_sym, {:foo => :bar})
|
36
38
|
end
|
37
|
-
|
39
|
+
|
38
40
|
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
|
+
@linode.expects(:send_request).returns(:bar => :baz)
|
42
|
+
@linode.send(action.to_sym).should == { :bar => :baz }
|
41
43
|
end
|
42
|
-
|
43
|
-
it "should consider the documentation to live at
|
44
|
-
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "
|
44
|
+
|
45
|
+
it "should consider the documentation to live at https://www.linode.com/api/nodebalancer/nodebalancer.config.#{action}" do
|
46
|
+
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/nodebalancer/nodebalancer.config.#{action}"
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|
@@ -6,42 +6,44 @@ describe Linode::Nodebalancer::Node do
|
|
6
6
|
@api_key = 'foo'
|
7
7
|
@linode = Linode::Nodebalancer::Node.new(:api_key => @api_key)
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
it 'should be a Linode instance' do
|
11
11
|
@linode.class.should < Linode
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
%w(create delete update list).each do |action|
|
15
15
|
it "should allow accessing the #{action} API" do
|
16
16
|
@linode.should respond_to(action.to_sym)
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
describe "when accessing the #{action} API" do
|
20
20
|
it 'should allow a data hash' do
|
21
|
-
|
21
|
+
@linode.stubs(:send_request)
|
22
|
+
lambda { @linode.send(action.to_sym, {}) }.should_not raise_error
|
22
23
|
end
|
23
|
-
|
24
|
+
|
24
25
|
it 'should not require arguments' do
|
25
|
-
|
26
|
+
@linode.stubs(:send_request)
|
27
|
+
lambda { @linode.send(action.to_sym) }.should_not raise_error
|
26
28
|
end
|
27
|
-
|
29
|
+
|
28
30
|
it "should request the nodebalancer.node.#{action} action" do
|
29
31
|
@linode.expects(:send_request).with {|api_action, data| api_action == "nodebalancer.node.#{action}" }
|
30
32
|
@linode.send(action.to_sym)
|
31
33
|
end
|
32
|
-
|
34
|
+
|
33
35
|
it 'should provide the data hash when making its request' do
|
34
36
|
@linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } }
|
35
37
|
@linode.send(action.to_sym, {:foo => :bar})
|
36
38
|
end
|
37
|
-
|
39
|
+
|
38
40
|
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
|
+
@linode.expects(:send_request).returns(:bar => :baz)
|
42
|
+
@linode.send(action.to_sym).should == { :bar => :baz }
|
41
43
|
end
|
42
|
-
|
43
|
-
it "should consider the documentation to live at
|
44
|
-
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "
|
44
|
+
|
45
|
+
it "should consider the documentation to live at https://www.linode.com/api/nodebalancer/nodebalancer.node.#{action}" do
|
46
|
+
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/nodebalancer/nodebalancer.node.#{action}"
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|
@@ -6,50 +6,52 @@ describe Linode::Nodebalancer do
|
|
6
6
|
@api_key = 'foo'
|
7
7
|
@linode = Linode::Nodebalancer.new(:api_key => @api_key)
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
it 'should be a Linode instance' do
|
11
11
|
@linode.class.should < Linode
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
%w(update create list delete).each do |action|
|
15
15
|
it "should allow accessing the #{action} API" do
|
16
16
|
@linode.should respond_to(action.to_sym)
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
describe "when accessing the #{action} API" do
|
20
20
|
it 'should allow a data hash' do
|
21
|
-
|
21
|
+
@linode.stubs(:send_request)
|
22
|
+
lambda { @linode.send(action.to_sym, {}) }.should_not raise_error
|
22
23
|
end
|
23
|
-
|
24
|
+
|
24
25
|
it 'should not require arguments' do
|
25
|
-
|
26
|
+
@linode.stubs(:send_request)
|
27
|
+
lambda { @linode.send(action.to_sym) }.should_not raise_error
|
26
28
|
end
|
27
|
-
|
29
|
+
|
28
30
|
it "should request the nodebalancer.#{action} action" do
|
29
31
|
@linode.expects(:send_request).with {|api_action, data| api_action == "nodebalancer.#{action}" }
|
30
32
|
@linode.send(action.to_sym)
|
31
33
|
end
|
32
|
-
|
34
|
+
|
33
35
|
it 'should provide the data hash when making its request' do
|
34
36
|
@linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } }
|
35
37
|
@linode.send(action.to_sym, {:foo => :bar})
|
36
38
|
end
|
37
|
-
|
39
|
+
|
38
40
|
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
|
+
@linode.expects(:send_request).returns(:bar => :baz)
|
42
|
+
@linode.send(action.to_sym).should == { :bar => :baz }
|
41
43
|
end
|
42
|
-
|
43
|
-
it "should consider the documentation to live at
|
44
|
-
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "
|
44
|
+
|
45
|
+
it "should consider the documentation to live at https://www.linode.com/api/nodebalancer/nodebalancer.#{action}" do
|
46
|
+
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/nodebalancer/nodebalancer.#{action}"
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|
48
|
-
|
50
|
+
|
49
51
|
it 'should be able to provide access to the Linode Nodebalancer Config API' do
|
50
52
|
@linode.should respond_to(:config)
|
51
53
|
end
|
52
|
-
|
54
|
+
|
53
55
|
describe 'when providing access to the Linode Nodebalancer Config API' do
|
54
56
|
before :each do
|
55
57
|
@api_key = 'foo'
|
@@ -58,36 +60,36 @@ describe Linode::Nodebalancer do
|
|
58
60
|
end
|
59
61
|
|
60
62
|
it 'should allow no arguments' do
|
61
|
-
lambda { @linode.config }.should_not raise_error
|
63
|
+
lambda { @linode.config }.should_not raise_error
|
62
64
|
end
|
63
65
|
|
64
66
|
it 'should require no arguments' do
|
65
67
|
lambda { @linode.config(:foo) }.should raise_error(ArgumentError)
|
66
68
|
end
|
67
|
-
|
69
|
+
|
68
70
|
it 'should return a Linode::Nodebalancer::Config instance' do
|
69
71
|
@linode.config.class.should == Linode::Nodebalancer::Config
|
70
72
|
end
|
71
|
-
|
73
|
+
|
72
74
|
it 'should set the API key on the Linode::Nodebalancer::Config instance to be our API key' do
|
73
75
|
@linode.config.api_key.should == @api_key
|
74
76
|
end
|
75
|
-
|
77
|
+
|
76
78
|
it 'should set the API url on the Linode::Nodebalancer::Config instance to be our API url' do
|
77
79
|
@linode.config.api_url.should == @api_url
|
78
80
|
end
|
79
|
-
|
81
|
+
|
80
82
|
it 'should return the same Linode::Nodebalancer::Config instance when called again' do
|
81
83
|
linode = Linode::Nodebalancer.new(:api_key => @api_key)
|
82
84
|
result = linode.config
|
83
85
|
linode.config.should == result
|
84
86
|
end
|
85
87
|
end
|
86
|
-
|
88
|
+
|
87
89
|
it 'should be able to provide access to the Linode Nodebalancer Node API' do
|
88
90
|
@linode.should respond_to(:node)
|
89
91
|
end
|
90
|
-
|
92
|
+
|
91
93
|
describe 'when providing access to the Linode Nodebalancer Node API' do
|
92
94
|
before :each do
|
93
95
|
@api_key = 'foo'
|
@@ -96,25 +98,25 @@ describe Linode::Nodebalancer do
|
|
96
98
|
end
|
97
99
|
|
98
100
|
it 'should allow no arguments' do
|
99
|
-
lambda { @linode.node }.should_not raise_error
|
101
|
+
lambda { @linode.node }.should_not raise_error
|
100
102
|
end
|
101
|
-
|
103
|
+
|
102
104
|
it 'should require no arguments' do
|
103
105
|
lambda { @linode.node(:foo) }.should raise_error(ArgumentError)
|
104
106
|
end
|
105
|
-
|
107
|
+
|
106
108
|
it 'should return a Linode::Nodebalancer::Node instance' do
|
107
109
|
@linode.node.class.should == Linode::Nodebalancer::Node
|
108
110
|
end
|
109
|
-
|
111
|
+
|
110
112
|
it 'should set the API key on the Linode::Nodebalancer::Node instance to be our API key' do
|
111
113
|
@linode.node.api_key.should == @api_key
|
112
114
|
end
|
113
|
-
|
115
|
+
|
114
116
|
it 'should set the API url on the Linode::Nodebalancer::Node instance to be our API url' do
|
115
117
|
@linode.node.api_url.should == @api_url
|
116
118
|
end
|
117
|
-
|
119
|
+
|
118
120
|
it 'should return the same Linode::Nodebalancer::Node instance when called again' do
|
119
121
|
linode = Linode::Nodebalancer.new(:api_key => @api_key)
|
120
122
|
result = linode.node
|
@@ -6,42 +6,44 @@ describe Linode::Stackscript do
|
|
6
6
|
@api_key = 'foo'
|
7
7
|
@linode = Linode::Stackscript.new(:api_key => @api_key)
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
it 'should be a Linode instance' do
|
11
11
|
@linode.class.should < Linode
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
%w(update create list delete).each do |action|
|
15
15
|
it "should allow accessing the #{action} API" do
|
16
16
|
@linode.should respond_to(action.to_sym)
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
describe "when accessing the #{action} API" do
|
20
20
|
it 'should allow a data hash' do
|
21
|
-
|
21
|
+
@linode.stubs(:send_request)
|
22
|
+
lambda { @linode.send(action.to_sym, {}) }.should_not raise_error
|
22
23
|
end
|
23
|
-
|
24
|
+
|
24
25
|
it 'should not require arguments' do
|
25
|
-
|
26
|
+
@linode.stubs(:send_request)
|
27
|
+
lambda { @linode.send(action.to_sym) }.should_not raise_error
|
26
28
|
end
|
27
|
-
|
29
|
+
|
28
30
|
it "should request the stackscript.#{action} action" do
|
29
31
|
@linode.expects(:send_request).with {|api_action, data| api_action == "stackscript.#{action}" }
|
30
32
|
@linode.send(action.to_sym)
|
31
33
|
end
|
32
|
-
|
34
|
+
|
33
35
|
it 'should provide the data hash when making its request' do
|
34
36
|
@linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } }
|
35
37
|
@linode.send(action.to_sym, {:foo => :bar})
|
36
38
|
end
|
37
|
-
|
39
|
+
|
38
40
|
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
|
+
@linode.expects(:send_request).returns(:bar => :baz)
|
42
|
+
@linode.send(action.to_sym).should == { :bar => :baz }
|
41
43
|
end
|
42
|
-
|
43
|
-
it "should consider the documentation to live at
|
44
|
-
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "
|
44
|
+
|
45
|
+
it "should consider the documentation to live at https://www.linode.com/api/stackscript/stackscript.#{action}" do
|
46
|
+
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/stackscript/stackscript.#{action}"
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|
data/spec/linode/test_spec.rb
CHANGED
@@ -6,43 +6,45 @@ describe Linode::Test do
|
|
6
6
|
@api_key = 'foo'
|
7
7
|
@linode = Linode::Test.new(:api_key => @api_key)
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
it 'should be a Linode instance' do
|
11
11
|
@linode.class.should < Linode
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
["echo"].each do |action|
|
15
|
-
|
15
|
+
|
16
16
|
it "should allow accessing the #{action} API" do
|
17
17
|
@linode.should respond_to(action.to_sym)
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
describe "when accessing the #{action} API" do
|
21
21
|
it 'should allow a data hash' do
|
22
|
-
|
22
|
+
@linode.stubs(:send_request)
|
23
|
+
lambda { @linode.send(action.to_sym, {}) }.should_not raise_error
|
23
24
|
end
|
24
|
-
|
25
|
+
|
25
26
|
it 'should not require arguments' do
|
26
|
-
|
27
|
+
@linode.stubs(:send_request)
|
28
|
+
lambda { @linode.send(action.to_sym) }.should_not raise_error
|
27
29
|
end
|
28
|
-
|
30
|
+
|
29
31
|
it "should request the test.#{action} action" do
|
30
32
|
@linode.expects(:send_request).with {|api_action, data| api_action == "test.#{action}" }
|
31
33
|
@linode.send(action.to_sym)
|
32
34
|
end
|
33
|
-
|
35
|
+
|
34
36
|
it 'should provide the data hash when making its request' do
|
35
37
|
@linode.expects(:send_request).with {|api_action, data| data = { :foo => :bar } }
|
36
38
|
@linode.send(action.to_sym, {:foo => :bar})
|
37
39
|
end
|
38
|
-
|
40
|
+
|
39
41
|
it 'should return the result of the request' do
|
40
|
-
@linode.expects(:send_request).returns(:bar => :baz)
|
41
|
-
@linode.send(action.to_sym).should == { :bar => :baz }
|
42
|
+
@linode.expects(:send_request).returns(:bar => :baz)
|
43
|
+
@linode.send(action.to_sym).should == { :bar => :baz }
|
42
44
|
end
|
43
|
-
|
44
|
-
it "should consider the documentation to live at
|
45
|
-
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "
|
45
|
+
|
46
|
+
it "should consider the documentation to live at https://www.linode.com/api/linode/linode.#{action}" do
|
47
|
+
@linode.documentation_path(Linode.action_path(@linode.class.name, action)).should == "https://www.linode.com/api/utility/test.#{action}"
|
46
48
|
end
|
47
49
|
end
|
48
50
|
end
|
data/spec/linode/user_spec.rb
CHANGED
@@ -17,7 +17,7 @@ describe Linode::User do
|
|
17
17
|
|
18
18
|
describe 'when returning the API key for the connection' do
|
19
19
|
it 'should work without arguments' do
|
20
|
-
lambda { @linode.getapikey }.should_not raise_error
|
20
|
+
lambda { @linode.getapikey }.should_not raise_error
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should not allow arguments' do
|
@@ -29,8 +29,8 @@ describe Linode::User do
|
|
29
29
|
@linode.getapikey.should == 'foo'
|
30
30
|
end
|
31
31
|
|
32
|
-
it "should consider the documentation to live at
|
33
|
-
@linode.documentation_path(Linode.action_path(@linode.class.name, 'getapikey')).should == "
|
32
|
+
it "should consider the documentation to live at https://www.linode.com/api/utility/user.getapikey" do
|
33
|
+
@linode.documentation_path(Linode.action_path(@linode.class.name, 'getapikey')).should == "https://www.linode.com/api/utility/user.getapikey"
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/spec/linode_spec.rb
CHANGED
@@ -9,7 +9,7 @@ describe Linode do
|
|
9
9
|
|
10
10
|
describe 'when creating a new Linode instance' do
|
11
11
|
it 'should accept an arguments hash' do
|
12
|
-
lambda { Linode.new(:api_key => 'foo') }.should_not raise_error
|
12
|
+
lambda { Linode.new(:api_key => 'foo') }.should_not raise_error
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should require an arguments hash' do
|
@@ -17,17 +17,22 @@ describe Linode do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should not fail if an API key is given' do
|
20
|
-
lambda { Linode.new({ :api_key => 'foo' }) }.should_not raise_error
|
20
|
+
lambda { Linode.new({ :api_key => 'foo' }) }.should_not raise_error
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should not fail if a username/password combo is given' do
|
24
|
-
lambda { Linode.new({ :username => 'bar', :password => 'baz' }) }.should_not raise_error
|
24
|
+
lambda { Linode.new({ :username => 'bar', :password => 'baz' }) }.should_not raise_error
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should fail if no API key nor username/password combo is given' do
|
28
28
|
lambda { Linode.new({}) }.should raise_error(ArgumentError)
|
29
29
|
end
|
30
30
|
|
31
|
+
it 'should allow providing a logger' do
|
32
|
+
linode = Linode.new(:api_key => 'foo', :logger => 'bar')
|
33
|
+
linode.logger.should == 'bar'
|
34
|
+
end
|
35
|
+
|
31
36
|
it 'should return a Linode instance' do
|
32
37
|
Linode.new(:api_key => 'foo').class.should == Linode
|
33
38
|
end
|
@@ -144,7 +149,7 @@ describe 'Linode' do
|
|
144
149
|
end
|
145
150
|
|
146
151
|
it 'should allow a request name and a data hash' do
|
147
|
-
lambda { @linode.send_request('test.echo', {}) }.should_not raise_error
|
152
|
+
lambda { @linode.send_request('test.echo', {}) }.should_not raise_error
|
148
153
|
end
|
149
154
|
|
150
155
|
it 'should require a request name and a data hash' do
|
@@ -285,7 +290,7 @@ describe 'Linode' do
|
|
285
290
|
|
286
291
|
describe 'when providing access to the Linode Test API' do
|
287
292
|
it 'should allow no arguments' do
|
288
|
-
lambda { @linode.test }.should_not raise_error
|
293
|
+
lambda { @linode.test }.should_not raise_error
|
289
294
|
end
|
290
295
|
|
291
296
|
it 'should require no arguments' do
|
@@ -317,7 +322,7 @@ describe 'Linode' do
|
|
317
322
|
|
318
323
|
describe 'when providing access to the Linode Avail API' do
|
319
324
|
it 'should allow no arguments' do
|
320
|
-
lambda { @linode.avail }.should_not raise_error
|
325
|
+
lambda { @linode.avail }.should_not raise_error
|
321
326
|
end
|
322
327
|
|
323
328
|
it 'should require no arguments' do
|
@@ -349,7 +354,7 @@ describe 'Linode' do
|
|
349
354
|
|
350
355
|
describe 'when providing access to the Linode User API' do
|
351
356
|
it 'should allow no arguments' do
|
352
|
-
lambda { @linode.user }.should_not raise_error
|
357
|
+
lambda { @linode.user }.should_not raise_error
|
353
358
|
end
|
354
359
|
|
355
360
|
it 'should require no arguments' do
|
@@ -381,7 +386,7 @@ describe 'Linode' do
|
|
381
386
|
|
382
387
|
describe 'when providing access to the Linode Domain API' do
|
383
388
|
it 'should allow no arguments' do
|
384
|
-
lambda { @linode.domain }.should_not raise_error
|
389
|
+
lambda { @linode.domain }.should_not raise_error
|
385
390
|
end
|
386
391
|
|
387
392
|
it 'should require no arguments' do
|
@@ -413,7 +418,7 @@ describe 'Linode' do
|
|
413
418
|
|
414
419
|
describe 'when providing access to the Linode Linode API' do
|
415
420
|
it 'should allow no arguments' do
|
416
|
-
lambda { @linode.linode }.should_not raise_error
|
421
|
+
lambda { @linode.linode }.should_not raise_error
|
417
422
|
end
|
418
423
|
|
419
424
|
it 'should require no arguments' do
|
@@ -439,13 +444,45 @@ describe 'Linode' do
|
|
439
444
|
end
|
440
445
|
end
|
441
446
|
|
447
|
+
it 'should be able to provide access to the Linode Account API' do
|
448
|
+
@linode.should respond_to(:account)
|
449
|
+
end
|
450
|
+
|
451
|
+
describe 'when providing access to the Linode Account API' do
|
452
|
+
it 'should allow no arguments' do
|
453
|
+
lambda { @linode.account }.should_not raise_error
|
454
|
+
end
|
455
|
+
|
456
|
+
it 'should require no arguments' do
|
457
|
+
lambda { @linode.account(:foo) }.should raise_error(ArgumentError)
|
458
|
+
end
|
459
|
+
|
460
|
+
it 'should return a Linode::Account instance' do
|
461
|
+
@linode.account.class.should == Linode::Account
|
462
|
+
end
|
463
|
+
|
464
|
+
it 'should set the API key on the Linode::Account instance to be our API key' do
|
465
|
+
@linode.account.api_key.should == @api_key
|
466
|
+
end
|
467
|
+
|
468
|
+
it 'should set the API url on the Linode::Account instance to be our API url' do
|
469
|
+
@linode.account.api_url.should == @api_url
|
470
|
+
end
|
471
|
+
|
472
|
+
it 'should return the same Linode::Account instance when called again' do
|
473
|
+
linode = Linode.new(:api_key => @api_key)
|
474
|
+
result = linode.account
|
475
|
+
linode.account.should == result
|
476
|
+
end
|
477
|
+
end
|
478
|
+
|
442
479
|
it 'should be able to provide access to the Linode Nodebalancer API' do
|
443
480
|
@linode.should respond_to(:nodebalancer)
|
444
481
|
end
|
445
482
|
|
446
483
|
describe 'when providing access to the Linode Nodebalancer API' do
|
447
484
|
it 'should allow no arguments' do
|
448
|
-
lambda { @linode.nodebalancer }.should_not raise_error
|
485
|
+
lambda { @linode.nodebalancer }.should_not raise_error
|
449
486
|
end
|
450
487
|
|
451
488
|
it 'should require no arguments' do
|
@@ -477,7 +514,7 @@ describe 'Linode' do
|
|
477
514
|
|
478
515
|
describe 'when providing access to the Linode Stackscript API' do
|
479
516
|
it 'should allow no arguments' do
|
480
|
-
lambda { @linode.stackscript }.should_not raise_error
|
517
|
+
lambda { @linode.stackscript }.should_not raise_error
|
481
518
|
end
|
482
519
|
|
483
520
|
it 'should require no arguments' do
|
@@ -503,4 +540,3 @@ describe 'Linode' do
|
|
503
540
|
end
|
504
541
|
end
|
505
542
|
end
|
506
|
-
|