cfoundry 2.3.3 → 2.3.4
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.
@@ -64,22 +64,9 @@ module CFoundry
|
|
64
64
|
elsif klass.scoped_organization && current_organization
|
65
65
|
current_organization.send(plural, *args)
|
66
66
|
else
|
67
|
-
|
67
|
+
@base.send(plural, *args).collect do |json|
|
68
68
|
send(:"make_#{singular}", json)
|
69
69
|
end
|
70
|
-
|
71
|
-
filtered = prefiltered
|
72
|
-
if args && args[0]
|
73
|
-
opts = args[0]
|
74
|
-
if opts[:query]
|
75
|
-
filtered.select! do |obj|
|
76
|
-
key = opts[:query][0].to_s
|
77
|
-
value = opts[:query][1]
|
78
|
-
obj.send(key) == value
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
filtered
|
83
70
|
end
|
84
71
|
end
|
85
72
|
|
@@ -134,4 +121,4 @@ module CFoundry
|
|
134
121
|
end
|
135
122
|
end
|
136
123
|
end
|
137
|
-
end
|
124
|
+
end
|
data/lib/cfoundry/version.rb
CHANGED
@@ -11,126 +11,6 @@ module CFoundry
|
|
11
11
|
let(:summary_attributes) { {:name => "fizzbuzz"} }
|
12
12
|
end
|
13
13
|
|
14
|
-
describe "Querying" do
|
15
|
-
describe "by :name" do
|
16
|
-
let(:query_param) { "My Org" }
|
17
|
-
|
18
|
-
let(:matching_org) do
|
19
|
-
org = CcApiStub::Helper.load_fixtures("fake_cc_organization").symbolize_keys
|
20
|
-
org[:metadata] = org[:metadata].symbolize_keys
|
21
|
-
org[:entity] = org[:entity].symbolize_keys
|
22
|
-
|
23
|
-
org[:entity][:name] = query_param
|
24
|
-
org
|
25
|
-
end
|
26
|
-
|
27
|
-
let(:non_matching_org) do
|
28
|
-
org = CcApiStub::Helper.load_fixtures("fake_cc_organization").symbolize_keys
|
29
|
-
org[:metadata] = org[:metadata].symbolize_keys
|
30
|
-
org[:entity] = org[:entity].symbolize_keys
|
31
|
-
org[:metadata][:guid] = "organization-id-2"
|
32
|
-
|
33
|
-
org[:entity][:name] = "organization-name-2"
|
34
|
-
org
|
35
|
-
end
|
36
|
-
|
37
|
-
context "when there are two orgs and one match" do
|
38
|
-
before do
|
39
|
-
client.base.stub(:organizations).and_return([non_matching_org, matching_org])
|
40
|
-
end
|
41
|
-
|
42
|
-
context "when queried with #organizations" do
|
43
|
-
subject { client.organizations(:query => [:name, query_param]) }
|
44
|
-
|
45
|
-
it "returns the org with the given name" do
|
46
|
-
expect(subject.size).to eq 1
|
47
|
-
expect(subject[0].name).to eq query_param
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context "when queried with #organzations_by_name" do
|
52
|
-
subject { client.organizations_by_name(query_param) }
|
53
|
-
|
54
|
-
it "returns the org with the given name" do
|
55
|
-
expect(subject.size).to eq 1
|
56
|
-
expect(subject[0].name).to eq query_param
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context "when queried with #organization_by_name" do
|
61
|
-
subject { client.organization_by_name(query_param) }
|
62
|
-
|
63
|
-
it "returns the org with the given name" do
|
64
|
-
expect(subject).to be_a CFoundry::V2::Organization
|
65
|
-
expect(subject.name).to eq query_param
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
context "when there are orgs but no matches" do
|
71
|
-
before do
|
72
|
-
client.base.stub(:organizations).and_return([non_matching_org])
|
73
|
-
end
|
74
|
-
|
75
|
-
context "when queried with #organizations" do
|
76
|
-
subject { client.organizations(:query => [:name, query_param]) }
|
77
|
-
|
78
|
-
it "returns an empty list" do
|
79
|
-
expect(subject).to be_empty
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
context "when queried with #organzations_by_name" do
|
84
|
-
subject { client.organizations_by_name(query_param) }
|
85
|
-
|
86
|
-
it "returns an empty list" do
|
87
|
-
expect(subject).to be_empty
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
context "when queried with #organization_by_name" do
|
92
|
-
subject { client.organization_by_name(query_param) }
|
93
|
-
|
94
|
-
it "returns nil" do
|
95
|
-
expect(subject).to be nil
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
100
|
-
|
101
|
-
context "when there are no orgs" do
|
102
|
-
before do
|
103
|
-
client.base.stub(:organizations).and_return([])
|
104
|
-
end
|
105
|
-
|
106
|
-
context "when queried with #organizations" do
|
107
|
-
subject { client.organizations(:query => [:name, query_param]) }
|
108
|
-
|
109
|
-
it "returns an empty list" do
|
110
|
-
expect(subject).to be_empty
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
context "when queried with #organzations_by_name" do
|
115
|
-
subject { client.organizations_by_name(query_param) }
|
116
|
-
|
117
|
-
it "returns an empty list" do
|
118
|
-
expect(subject).to be_empty
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
context "when queried with #organization_by_name" do
|
123
|
-
subject { client.organization_by_name(query_param) }
|
124
|
-
|
125
|
-
it "returns nil" do
|
126
|
-
expect(subject).to be nil
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
14
|
it "has quota_definition" do
|
135
15
|
quota = build(:quota_definition)
|
136
16
|
organization.quota_definition = quota
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfoundry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-07-
|
13
|
+
date: 2013-07-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|
@@ -415,7 +415,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
415
415
|
version: '0'
|
416
416
|
segments:
|
417
417
|
- 0
|
418
|
-
hash:
|
418
|
+
hash: 2387389838306883676
|
419
419
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
420
420
|
none: false
|
421
421
|
requirements:
|
@@ -424,7 +424,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
424
424
|
version: '0'
|
425
425
|
segments:
|
426
426
|
- 0
|
427
|
-
hash:
|
427
|
+
hash: 2387389838306883676
|
428
428
|
requirements: []
|
429
429
|
rubyforge_project: cfoundry
|
430
430
|
rubygems_version: 1.8.25
|