cfoundry 1.5.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/lib/cfoundry/test_support.rb +2 -2
  2. data/lib/cfoundry/v2/app.rb +3 -6
  3. data/lib/cfoundry/v2/model.rb +1 -0
  4. data/lib/cfoundry/version.rb +1 -1
  5. data/spec/cfoundry/client_spec.rb +1 -1
  6. data/spec/cfoundry/rest_client_spec.rb +1 -1
  7. data/spec/cfoundry/trace_helpers_spec.rb +6 -6
  8. data/spec/cfoundry/upload_helpers_spec.rb +125 -137
  9. data/spec/cfoundry/v2/app_event_spec.rb +63 -59
  10. data/spec/cfoundry/v2/app_spec.rb +195 -188
  11. data/spec/cfoundry/v2/client_spec.rb +60 -56
  12. data/spec/cfoundry/v2/domain_spec.rb +9 -6
  13. data/spec/cfoundry/v2/model_magic/model_magic/attribute_spec.rb +89 -88
  14. data/spec/cfoundry/v2/model_magic/model_magic/has_summary_spec.rb +12 -13
  15. data/spec/cfoundry/v2/model_magic/model_magic/to_many_spec.rb +46 -52
  16. data/spec/cfoundry/v2/model_magic/model_magic/to_one_spec.rb +96 -87
  17. data/spec/cfoundry/v2/model_spec.rb +236 -241
  18. data/spec/cfoundry/v2/organization_spec.rb +20 -22
  19. data/spec/cfoundry/v2/quota_definition_spec.rb +45 -47
  20. data/spec/cfoundry/v2/route_spec.rb +28 -25
  21. data/spec/cfoundry/v2/space_spec.rb +9 -11
  22. data/spec/cfoundry/validator_spec.rb +69 -67
  23. data/spec/factories/app_events_factory.rb +7 -0
  24. data/spec/factories/apps_factory.rb +11 -0
  25. data/spec/factories/clients_factory.rb +5 -0
  26. data/spec/factories/domains_factory.rb +7 -0
  27. data/spec/factories/organizations_factory.rb +11 -0
  28. data/spec/factories/quota_definitions_factory.rb +8 -0
  29. data/spec/factories/routes_factory.rb +10 -0
  30. data/spec/factories/spaces_factory.rb +10 -0
  31. data/spec/factories/users_factory.rb +10 -0
  32. data/spec/spec_helper.rb +5 -4
  33. data/spec/support/factory_girl.rb +6 -0
  34. data/spec/support/shared_examples/model_summary_examples.rb +7 -7
  35. data/spec/support/test_model_builder.rb +10 -0
  36. metadata +83 -71
  37. data/spec/fakes/app_fake.rb +0 -5
  38. data/spec/fakes/domain_fake.rb +0 -5
  39. data/spec/fakes/framework_fake.rb +0 -5
  40. data/spec/fakes/organization_fake.rb +0 -5
  41. data/spec/fakes/route_fake.rb +0 -5
  42. data/spec/fakes/runtime_fake.rb +0 -5
  43. data/spec/fakes/service_fake.rb +0 -5
  44. data/spec/fakes/service_instance_fake.rb +0 -5
  45. data/spec/fakes/service_plan_fake.rb +0 -5
  46. data/spec/fakes/space_fake.rb +0 -5
  47. data/spec/fakes/user_fake.rb +0 -5
  48. data/spec/support/fake_helper.rb +0 -248
  49. data/spec/support/randoms.rb +0 -3
@@ -0,0 +1,8 @@
1
+ FactoryGirl.define do
2
+ factory :quota_definition, :class => CFoundry::V2::QuotaDefinition do
3
+ sequence(:name) { |n| "quota-definition-name-#{n}" }
4
+ sequence(:guid) { |n| "quota-definition-guid-#{n}" }
5
+
6
+ initialize_with { new(guid, build(:client)) }
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ FactoryGirl.define do
2
+ factory :route, :class => CFoundry::V2::Route do
3
+ sequence(:guid) { |n| "route-guid-#{n}" }
4
+ ignore do
5
+ client { FactoryGirl.build(:client) }
6
+ end
7
+
8
+ initialize_with { new(guid, client) }
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ FactoryGirl.define do
2
+ factory :space, :class => CFoundry::V2::Space do
3
+ sequence(:guid) { |n| "space-guid-#{n}" }
4
+ ignore do
5
+ client { FactoryGirl.build(:client) }
6
+ end
7
+
8
+ initialize_with { new(guid, client) }
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ FactoryGirl.define do
2
+ factory :user, :class => CFoundry::V2::User do
3
+ sequence(:guid) { |n| "user-guid-#{n}" }
4
+ ignore do
5
+ client { FactoryGirl.build(:client) }
6
+ end
7
+
8
+ initialize_with { new(guid, client) }
9
+ end
10
+ end
data/spec/spec_helper.rb CHANGED
@@ -10,11 +10,12 @@ require "active_support/core_ext"
10
10
  require "cc_api_stub"
11
11
  require "shoulda/matchers/integrations/rspec" # requiring all of shoulda matchers makes test unit run
12
12
 
13
- Dir[File.expand_path('../{support,fakes}/**/*.rb', __FILE__)].each do |file|
14
- require file
15
- end
13
+ require "support/shared_examples/cc_api_stub_request_examples"
14
+ require "support/shared_examples/client_login_examples"
15
+ require "support/shared_examples/model_summary_examples"
16
+ require "support/factory_girl"
17
+ require "support/test_model_builder"
16
18
 
17
19
  RSpec.configure do |c|
18
- c.include Fake::FakeMethods
19
20
  c.mock_with :rr
20
21
  end
@@ -0,0 +1,6 @@
1
+ require "factory_girl"
2
+
3
+ RSpec.configure do |config|
4
+ config.include FactoryGirl::Syntax::Methods
5
+ FactoryGirl.find_definitions
6
+ end
@@ -1,17 +1,17 @@
1
1
  require "multi_json"
2
2
 
3
- shared_examples_for 'a summarizeable model' do
4
- describe '#summary' do
3
+ shared_examples_for "a summarizeable model" do
4
+ describe "#summary" do
5
5
  let(:summary_endpoint) {
6
6
  [ client.target,
7
7
  "v2",
8
- mymodel.plural_object_name,
9
- myobject.guid,
8
+ subject.class.plural_object_name,
9
+ subject.guid,
10
10
  "summary"
11
11
  ].join("/")
12
12
  }
13
13
 
14
- it 'returns the summary endpoint payload' do
14
+ it "returns the summary endpoint payload" do
15
15
  req = stub_request(:get, summary_endpoint).to_return :status => 200,
16
16
  :body => MultiJson.encode(summary_attributes)
17
17
 
@@ -20,8 +20,8 @@ shared_examples_for 'a summarizeable model' do
20
20
  end
21
21
  end
22
22
 
23
- describe '#summarize!' do
24
- it 'defines basic attributes via #summary' do
23
+ describe "#summarize!" do
24
+ it "defines basic attributes via #summary" do
25
25
  stub(subject).summary { summary_attributes }
26
26
 
27
27
  subject.summarize!
@@ -0,0 +1,10 @@
1
+ class TestModel < CFoundry::V2::Model
2
+ end
3
+
4
+ class TestModelBuilder
5
+ def self.build(guid, client, manifest=nil, &init)
6
+ klass = TestModel.new(guid, client, manifest)
7
+ klass.class_eval(&init) if init
8
+ klass
9
+ end
10
+ end
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: 1.5.3
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,16 +10,16 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-31 00:00:00.000000000 Z
13
+ date: 2013-06-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: multipart-post
16
+ name: activemodel
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: '1.1'
22
+ version: 3.2.13
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,15 +27,15 @@ dependencies:
27
27
  requirements:
28
28
  - - ~>
29
29
  - !ruby/object:Gem::Version
30
- version: '1.1'
30
+ version: 3.2.13
31
31
  - !ruby/object:Gem::Dependency
32
- name: multi_json
32
+ name: cf-uaa-lib
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  none: false
35
35
  requirements:
36
36
  - - ~>
37
37
  - !ruby/object:Gem::Version
38
- version: '1.7'
38
+ version: 1.3.10
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,15 +43,15 @@ dependencies:
43
43
  requirements:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
- version: '1.7'
46
+ version: 1.3.10
47
47
  - !ruby/object:Gem::Dependency
48
- name: rubyzip
48
+ name: multi_json
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '0.9'
54
+ version: '1.7'
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
@@ -59,15 +59,15 @@ dependencies:
59
59
  requirements:
60
60
  - - ~>
61
61
  - !ruby/object:Gem::Version
62
- version: '0.9'
62
+ version: '1.7'
63
63
  - !ruby/object:Gem::Dependency
64
- name: cf-uaa-lib
64
+ name: multipart-post
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements:
68
68
  - - ~>
69
69
  - !ruby/object:Gem::Version
70
- version: 1.3.10
70
+ version: '1.1'
71
71
  type: :runtime
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -75,15 +75,15 @@ dependencies:
75
75
  requirements:
76
76
  - - ~>
77
77
  - !ruby/object:Gem::Version
78
- version: 1.3.10
78
+ version: '1.1'
79
79
  - !ruby/object:Gem::Dependency
80
- name: activemodel
80
+ name: rubyzip
81
81
  requirement: !ruby/object:Gem::Requirement
82
82
  none: false
83
83
  requirements:
84
84
  - - ~>
85
85
  - !ruby/object:Gem::Version
86
- version: 3.2.13
86
+ version: '0.9'
87
87
  type: :runtime
88
88
  prerelease: false
89
89
  version_requirements: !ruby/object:Gem::Requirement
@@ -91,15 +91,15 @@ dependencies:
91
91
  requirements:
92
92
  - - ~>
93
93
  - !ruby/object:Gem::Version
94
- version: 3.2.13
94
+ version: '0.9'
95
95
  - !ruby/object:Gem::Dependency
96
- name: rake
96
+ name: factory_girl
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  none: false
99
99
  requirements:
100
100
  - - ! '>='
101
101
  - !ruby/object:Gem::Version
102
- version: '0.9'
102
+ version: '0'
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
@@ -107,31 +107,31 @@ dependencies:
107
107
  requirements:
108
108
  - - ! '>='
109
109
  - !ruby/object:Gem::Version
110
- version: '0.9'
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rspec
112
+ name: gem-release
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
116
- - - ~>
116
+ - - ! '>='
117
117
  - !ruby/object:Gem::Version
118
- version: '2.11'
118
+ version: '0'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  none: false
123
123
  requirements:
124
- - - ~>
124
+ - - ! '>='
125
125
  - !ruby/object:Gem::Version
126
- version: '2.11'
126
+ version: '0'
127
127
  - !ruby/object:Gem::Dependency
128
- name: webmock
128
+ name: json_pure
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  none: false
131
131
  requirements:
132
132
  - - ~>
133
133
  - !ruby/object:Gem::Version
134
- version: '1.9'
134
+ version: '1.8'
135
135
  type: :development
136
136
  prerelease: false
137
137
  version_requirements: !ruby/object:Gem::Requirement
@@ -139,47 +139,47 @@ dependencies:
139
139
  requirements:
140
140
  - - ~>
141
141
  - !ruby/object:Gem::Version
142
- version: '1.9'
142
+ version: '1.8'
143
143
  - !ruby/object:Gem::Dependency
144
- name: rr
144
+ name: rake
145
145
  requirement: !ruby/object:Gem::Requirement
146
146
  none: false
147
147
  requirements:
148
- - - ~>
148
+ - - ! '>='
149
149
  - !ruby/object:Gem::Version
150
- version: '1.0'
150
+ version: '0.9'
151
151
  type: :development
152
152
  prerelease: false
153
153
  version_requirements: !ruby/object:Gem::Requirement
154
154
  none: false
155
155
  requirements:
156
- - - ~>
156
+ - - ! '>='
157
157
  - !ruby/object:Gem::Version
158
- version: '1.0'
158
+ version: '0.9'
159
159
  - !ruby/object:Gem::Dependency
160
- name: gem-release
160
+ name: rspec
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  none: false
163
163
  requirements:
164
- - - ! '>='
164
+ - - ~>
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
166
+ version: '2.11'
167
167
  type: :development
168
168
  prerelease: false
169
169
  version_requirements: !ruby/object:Gem::Requirement
170
170
  none: false
171
171
  requirements:
172
- - - ! '>='
172
+ - - ~>
173
173
  - !ruby/object:Gem::Version
174
- version: '0'
174
+ version: '2.11'
175
175
  - !ruby/object:Gem::Dependency
176
- name: timecop
176
+ name: rr
177
177
  requirement: !ruby/object:Gem::Requirement
178
178
  none: false
179
179
  requirements:
180
180
  - - ~>
181
181
  - !ruby/object:Gem::Version
182
- version: 0.6.1
182
+ version: '1.0'
183
183
  type: :development
184
184
  prerelease: false
185
185
  version_requirements: !ruby/object:Gem::Requirement
@@ -187,7 +187,7 @@ dependencies:
187
187
  requirements:
188
188
  - - ~>
189
189
  - !ruby/object:Gem::Version
190
- version: 0.6.1
190
+ version: '1.0'
191
191
  - !ruby/object:Gem::Dependency
192
192
  name: shoulda-matchers
193
193
  requirement: !ruby/object:Gem::Requirement
@@ -205,13 +205,13 @@ dependencies:
205
205
  - !ruby/object:Gem::Version
206
206
  version: 1.5.6
207
207
  - !ruby/object:Gem::Dependency
208
- name: json_pure
208
+ name: timecop
209
209
  requirement: !ruby/object:Gem::Requirement
210
210
  none: false
211
211
  requirements:
212
212
  - - ~>
213
213
  - !ruby/object:Gem::Version
214
- version: '1.8'
214
+ version: 0.6.1
215
215
  type: :development
216
216
  prerelease: false
217
217
  version_requirements: !ruby/object:Gem::Requirement
@@ -219,7 +219,23 @@ dependencies:
219
219
  requirements:
220
220
  - - ~>
221
221
  - !ruby/object:Gem::Version
222
- version: '1.8'
222
+ version: 0.6.1
223
+ - !ruby/object:Gem::Dependency
224
+ name: webmock
225
+ requirement: !ruby/object:Gem::Requirement
226
+ none: false
227
+ requirements:
228
+ - - ~>
229
+ - !ruby/object:Gem::Version
230
+ version: '1.9'
231
+ type: :development
232
+ prerelease: false
233
+ version_requirements: !ruby/object:Gem::Requirement
234
+ none: false
235
+ requirements:
236
+ - - ~>
237
+ - !ruby/object:Gem::Version
238
+ version: '1.9'
223
239
  description:
224
240
  email:
225
241
  - vcap-dev@googlegroups.com
@@ -322,17 +338,15 @@ files:
322
338
  - spec/cfoundry/v2/route_spec.rb
323
339
  - spec/cfoundry/v2/space_spec.rb
324
340
  - spec/cfoundry/validator_spec.rb
325
- - spec/fakes/app_fake.rb
326
- - spec/fakes/domain_fake.rb
327
- - spec/fakes/framework_fake.rb
328
- - spec/fakes/organization_fake.rb
329
- - spec/fakes/route_fake.rb
330
- - spec/fakes/runtime_fake.rb
331
- - spec/fakes/service_fake.rb
332
- - spec/fakes/service_instance_fake.rb
333
- - spec/fakes/service_plan_fake.rb
334
- - spec/fakes/space_fake.rb
335
- - spec/fakes/user_fake.rb
341
+ - spec/factories/app_events_factory.rb
342
+ - spec/factories/apps_factory.rb
343
+ - spec/factories/clients_factory.rb
344
+ - spec/factories/domains_factory.rb
345
+ - spec/factories/organizations_factory.rb
346
+ - spec/factories/quota_definitions_factory.rb
347
+ - spec/factories/routes_factory.rb
348
+ - spec/factories/spaces_factory.rb
349
+ - spec/factories/users_factory.rb
336
350
  - spec/fixtures/apps/with_cfignore/ambiguous_ignored
337
351
  - spec/fixtures/apps/with_cfignore/ignored_dir/file_in_ignored_dir.txt
338
352
  - spec/fixtures/apps/with_cfignore/ignored_file.txt
@@ -380,11 +394,11 @@ files:
380
394
  - spec/fixtures/fake_cc_user_organizations.json
381
395
  - spec/fixtures/fake_cc_user_with_managers.json
382
396
  - spec/spec_helper.rb
383
- - spec/support/fake_helper.rb
384
- - spec/support/randoms.rb
397
+ - spec/support/factory_girl.rb
385
398
  - spec/support/shared_examples/cc_api_stub_request_examples.rb
386
399
  - spec/support/shared_examples/client_login_examples.rb
387
400
  - spec/support/shared_examples/model_summary_examples.rb
401
+ - spec/support/test_model_builder.rb
388
402
  homepage: http://github.com/cloudfoundry/cfoundry
389
403
  licenses: []
390
404
  post_install_message:
@@ -399,7 +413,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
399
413
  version: '0'
400
414
  segments:
401
415
  - 0
402
- hash: 3706658870936601653
416
+ hash: -1645166221720147184
403
417
  required_rubygems_version: !ruby/object:Gem::Requirement
404
418
  none: false
405
419
  requirements:
@@ -449,17 +463,15 @@ test_files:
449
463
  - spec/cfoundry/v2/route_spec.rb
450
464
  - spec/cfoundry/v2/space_spec.rb
451
465
  - spec/cfoundry/validator_spec.rb
452
- - spec/fakes/app_fake.rb
453
- - spec/fakes/domain_fake.rb
454
- - spec/fakes/framework_fake.rb
455
- - spec/fakes/organization_fake.rb
456
- - spec/fakes/route_fake.rb
457
- - spec/fakes/runtime_fake.rb
458
- - spec/fakes/service_fake.rb
459
- - spec/fakes/service_instance_fake.rb
460
- - spec/fakes/service_plan_fake.rb
461
- - spec/fakes/space_fake.rb
462
- - spec/fakes/user_fake.rb
466
+ - spec/factories/app_events_factory.rb
467
+ - spec/factories/apps_factory.rb
468
+ - spec/factories/clients_factory.rb
469
+ - spec/factories/domains_factory.rb
470
+ - spec/factories/organizations_factory.rb
471
+ - spec/factories/quota_definitions_factory.rb
472
+ - spec/factories/routes_factory.rb
473
+ - spec/factories/spaces_factory.rb
474
+ - spec/factories/users_factory.rb
463
475
  - spec/fixtures/apps/with_cfignore/ambiguous_ignored
464
476
  - spec/fixtures/apps/with_cfignore/ignored_dir/file_in_ignored_dir.txt
465
477
  - spec/fixtures/apps/with_cfignore/ignored_file.txt
@@ -507,8 +519,8 @@ test_files:
507
519
  - spec/fixtures/fake_cc_user_organizations.json
508
520
  - spec/fixtures/fake_cc_user_with_managers.json
509
521
  - spec/spec_helper.rb
510
- - spec/support/fake_helper.rb
511
- - spec/support/randoms.rb
522
+ - spec/support/factory_girl.rb
512
523
  - spec/support/shared_examples/cc_api_stub_request_examples.rb
513
524
  - spec/support/shared_examples/client_login_examples.rb
514
525
  - spec/support/shared_examples/model_summary_examples.rb
526
+ - spec/support/test_model_builder.rb