admin-cf-plugin 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/admin-cf-plugin/version.rb +1 -1
- data/spec/factories/clients.rb +4 -0
- data/spec/factories/organizations.rb +13 -0
- data/spec/factories/quota_definitions.rb +13 -0
- data/spec/guid_spec.rb +1 -3
- data/spec/set_quota_spec.rb +14 -11
- data/spec/spec_helper.rb +0 -3
- metadata +13 -7
@@ -0,0 +1,13 @@
|
|
1
|
+
module CFoundry
|
2
|
+
FactoryGirl.define do
|
3
|
+
factory :organization, class: CFoundry::V2::Organization do
|
4
|
+
sequence(:guid) { |n| "organization-guid-#{n}" }
|
5
|
+
|
6
|
+
ignore do
|
7
|
+
client { FactoryGirl.build(:client) }
|
8
|
+
end
|
9
|
+
|
10
|
+
initialize_with { new(guid, client) }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module CFoundry
|
2
|
+
FactoryGirl.define do
|
3
|
+
factory :quota_definition, class: CFoundry::V2::QuotaDefinition do
|
4
|
+
sequence(:guid) { |n| "quota-definition-guid-#{n}" }
|
5
|
+
|
6
|
+
ignore do
|
7
|
+
client { FactoryGirl.build(:client) }
|
8
|
+
end
|
9
|
+
|
10
|
+
initialize_with { new(guid, client) }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/spec/guid_spec.rb
CHANGED
@@ -5,9 +5,7 @@ describe CFAdmin::Guid do
|
|
5
5
|
stub_home_dir_with { fake_home_dir }
|
6
6
|
|
7
7
|
before do
|
8
|
-
|
9
|
-
stub(client).info { { :version => 2 } }
|
10
|
-
end
|
8
|
+
CFoundry::Client.any_instance.stub(:info) { { :version => 2 } }
|
11
9
|
end
|
12
10
|
|
13
11
|
let(:api_response) {{
|
data/spec/set_quota_spec.rb
CHANGED
@@ -5,22 +5,25 @@ describe CFAdmin::SetQuota do
|
|
5
5
|
|
6
6
|
stub_home_dir_with { fake_home_dir }
|
7
7
|
|
8
|
-
let(:paid_quota) {
|
9
|
-
let(:free_quota) {
|
8
|
+
let(:paid_quota) { build :quota_definition, :name => "paid" }
|
9
|
+
let(:free_quota) { build :quota_definition, :name => "free" }
|
10
10
|
|
11
11
|
let(:organization) do
|
12
|
-
|
12
|
+
build :organization, :name => "some-org-name",
|
13
13
|
:quota_definition => free_quota
|
14
14
|
end
|
15
15
|
|
16
16
|
let(:client) do
|
17
|
-
|
18
|
-
|
17
|
+
build(:client).tap do |client|
|
18
|
+
client.stub(
|
19
|
+
:organizations => [organization],
|
20
|
+
:quota_definitions => [paid_quota, free_quota])
|
21
|
+
end
|
19
22
|
end
|
20
23
|
|
21
24
|
before do
|
22
|
-
|
23
|
-
stub(
|
25
|
+
CF::CLI.any_instance.stub(:client) { client }
|
26
|
+
organization.stub(:update!)
|
24
27
|
end
|
25
28
|
|
26
29
|
context "when given an organization and a quota definition" do
|
@@ -38,14 +41,14 @@ describe CFAdmin::SetQuota do
|
|
38
41
|
end
|
39
42
|
|
40
43
|
it "saves the changes made to the organization" do
|
41
|
-
|
44
|
+
organization.should_receive(:update!)
|
42
45
|
cf %W[set-quota paid some-org-name]
|
43
46
|
end
|
44
47
|
end
|
45
48
|
|
46
49
|
context "when NOT given a quota definition" do
|
47
50
|
it "prompts for the quota definition" do
|
48
|
-
|
51
|
+
should_ask("Quota", hash_including(:choices => client.quota_definitions)) do
|
49
52
|
paid_quota
|
50
53
|
end
|
51
54
|
|
@@ -66,7 +69,7 @@ describe CFAdmin::SetQuota do
|
|
66
69
|
end
|
67
70
|
|
68
71
|
it "saves the changes made to the organization" do
|
69
|
-
|
72
|
+
organization.should_receive(:update!)
|
70
73
|
cf %W[set-quota paid]
|
71
74
|
end
|
72
75
|
end
|
@@ -75,7 +78,7 @@ describe CFAdmin::SetQuota do
|
|
75
78
|
before { client.current_organization = nil }
|
76
79
|
|
77
80
|
it "prompts for the organization" do
|
78
|
-
|
81
|
+
should_ask("Organization", hash_including(:choices => client.organizations)) do
|
79
82
|
organization
|
80
83
|
end
|
81
84
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: admin-cf-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.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-06-
|
12
|
+
date: 2013-06-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cfoundry
|
@@ -18,10 +18,10 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.
|
21
|
+
version: 2.1.0
|
22
22
|
- - <
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: '
|
24
|
+
version: '3.0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,10 +29,10 @@ dependencies:
|
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 2.
|
32
|
+
version: 2.1.0
|
33
33
|
- - <
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
35
|
+
version: '3.0'
|
36
36
|
description:
|
37
37
|
email:
|
38
38
|
- asuraci@vmware.com
|
@@ -48,6 +48,9 @@ files:
|
|
48
48
|
- lib/admin-cf-plugin/set_quota.rb
|
49
49
|
- lib/admin-cf-plugin/version.rb
|
50
50
|
- spec/curl_spec.rb
|
51
|
+
- spec/factories/clients.rb
|
52
|
+
- spec/factories/organizations.rb
|
53
|
+
- spec/factories/quota_definitions.rb
|
51
54
|
- spec/guid_spec.rb
|
52
55
|
- spec/set_quota_spec.rb
|
53
56
|
- spec/spec_helper.rb
|
@@ -65,7 +68,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
68
|
version: '0'
|
66
69
|
segments:
|
67
70
|
- 0
|
68
|
-
hash: -
|
71
|
+
hash: -2425328729014942152
|
69
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
73
|
none: false
|
71
74
|
requirements:
|
@@ -80,6 +83,9 @@ specification_version: 3
|
|
80
83
|
summary: Cloud Foundry administration commands.
|
81
84
|
test_files:
|
82
85
|
- spec/curl_spec.rb
|
86
|
+
- spec/factories/clients.rb
|
87
|
+
- spec/factories/organizations.rb
|
88
|
+
- spec/factories/quota_definitions.rb
|
83
89
|
- spec/guid_spec.rb
|
84
90
|
- spec/set_quota_spec.rb
|
85
91
|
- spec/spec_helper.rb
|