cf 5.2.1.rc4 → 5.2.1.rc5

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,7 +28,7 @@ if ENV["CF_V2_RUN_INTEGRATION"]
28
28
  Interact::Progress::Dots.stop!
29
29
  end
30
30
 
31
- it "attempts to change already processed choices" do
31
+ it "excercises the app workflow" do
32
32
  BlueShell::Runner.run("#{cf_bin} app #{app}") do |runner|
33
33
  expect(runner).to say "Unknown app '#{app}'."
34
34
  end
@@ -141,6 +141,22 @@ if ENV["CF_V2_RUN_INTEGRATION"]
141
141
  expect(runner).to say "OK", 20
142
142
  end
143
143
 
144
+ BlueShell::Runner.run("#{cf_bin} set-env #{app} DEVELOP_ON_CLOUD_FOUNDRY all_day_erry_day") do |runner|
145
+ expect(runner).to say "OK"
146
+ end
147
+
148
+ BlueShell::Runner.run("#{cf_bin} env #{app}") do |runner|
149
+ expect(runner).to say "DEVELOP_ON_CLOUD_FOUNDRY: all_day_erry_day"
150
+ end
151
+
152
+ BlueShell::Runner.run("#{cf_bin} unset-env #{app} DEVELOP_ON_CLOUD_FOUNDRY") do |runner|
153
+ expect(runner).to say "OK"
154
+ end
155
+
156
+ BlueShell::Runner.run("#{cf_bin} env #{app}") do |runner|
157
+ expect(runner).not_to say "DEVELOP_ON_CLOUD_FOUNDRY"
158
+ end
159
+
144
160
  BlueShell::Runner.run("#{cf_bin} delete #{app}") do |runner|
145
161
  expect(runner).to say "Really delete #{app}?>"
146
162
  runner.send_keys "y"
@@ -58,6 +58,11 @@ class FakeCloudController < Sinatra::Base
58
58
  204
59
59
  end
60
60
 
61
+ put '/v2/service_brokers/:guid' do
62
+ self.class.requests << request
63
+ 201
64
+ end
65
+
61
66
  get '/responsive' do
62
67
  200
63
68
  end
@@ -148,4 +153,13 @@ http://127.0.0.1:8181:
148
153
  expect(last_request).to be_delete
149
154
  expect(last_request.path).to eq('/v2/service_brokers/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa')
150
155
  end
156
+
157
+ it "allows an admin user to update a service broker" do
158
+ BlueShell::Runner.run("env HOME=#{@homedir} #{cf_bin} update-service-broker my-custom-service --name cf-othersql --url http://other.example.com/ --token othertoken") do |runner|
159
+ expect(runner).to say "Updating service broker my-custom-service... OK"
160
+ end
161
+
162
+ expect(last_request).to be_put
163
+ expect(last_request.path).to eq('/v2/service_brokers/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa')
164
+ end
151
165
  end
data/spec/spec_helper.rb CHANGED
@@ -11,6 +11,8 @@ require "ostruct"
11
11
  require "fakefs/safe"
12
12
  require "blue-shell"
13
13
 
14
+ Dir.glob("support/mock_commands/*").each { |f| require f }
15
+
14
16
  TRAVIS_BUILD_ID = ENV["TRAVIS_BUILD_ID"]
15
17
 
16
18
  OriginalFile = File
@@ -47,6 +47,28 @@ module CliHelper
47
47
  $stdin = $real_stdin
48
48
  end
49
49
 
50
+ def capture_exceptional_output
51
+ $real_stdout = $stdout
52
+ $real_stderr = $stderr
53
+ $real_stdin = $stdin
54
+ $stdout = @stdout = StringIO.new
55
+ $stderr = @stderr = StringIO.new
56
+ $stdin = @stdin = StringIO.new
57
+ begin
58
+ @status = yield
59
+ rescue => e
60
+ @stderr.write(e.message)
61
+ end
62
+ @stdout.rewind
63
+ @stderr.rewind
64
+ @status
65
+ ensure
66
+ $stdout = $real_stdout
67
+ $stderr = $real_stderr
68
+ $stdin = $real_stdin
69
+ end
70
+
71
+
50
72
  def output
51
73
  @output ||= BlueShell::BufferedReaderExpector.new(stdout)
52
74
  end
@@ -0,0 +1,16 @@
1
+ class MockRestartCommand
2
+ attr_reader :restarted_apps
3
+ attr_accessor :input
4
+
5
+ def initialize
6
+ @restarted_apps = []
7
+ end
8
+
9
+ def restart
10
+ @restarted_apps = input[:apps]
11
+ end
12
+
13
+ def run(_)
14
+ restart
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ class MockStartCommand
2
+ attr_reader :started_apps
3
+ attr_accessor :input
4
+
5
+ def initialize
6
+ @started_apps = []
7
+ end
8
+
9
+ def start
10
+ raise 'If you wanna test using :all, you implement it!' if input[:all]
11
+ @started_apps = input[:apps]
12
+ end
13
+
14
+ def run(_)
15
+ start
16
+ end
17
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.1.rc4
4
+ version: 5.2.1.rc5
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,24 +10,8 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-08-21 00:00:00.000000000 Z
13
+ date: 2013-08-22 00:00:00.000000000 Z
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: activesupport
17
- requirement: !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ! '>='
21
- - !ruby/object:Gem::Version
22
- version: 3.2.13
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ! '>='
29
- - !ruby/object:Gem::Version
30
- version: 3.2.13
31
15
  - !ruby/object:Gem::Dependency
32
16
  name: addressable
33
17
  requirement: !ruby/object:Gem::Requirement
@@ -356,6 +340,7 @@ files:
356
340
  - lib/admin/service_broker/add.rb
357
341
  - lib/admin/service_broker/remove.rb
358
342
  - lib/admin/service_broker/service_brokers.rb
343
+ - lib/admin/service_broker/update.rb
359
344
  - lib/admin/set_quota.rb
360
345
  - lib/cf/cli/app/app.rb
361
346
  - lib/cf/cli/app/apps.rb
@@ -471,6 +456,7 @@ files:
471
456
  - spec/admin/service_broker/add_spec.rb
472
457
  - spec/admin/service_broker/remove_spec.rb
473
458
  - spec/admin/service_broker/service_brokers_spec.rb
459
+ - spec/admin/service_broker/update_spec.rb
474
460
  - spec/admin/set_quota_spec.rb
475
461
  - spec/assets/env/env_test.rb
476
462
  - spec/assets/env/Gemfile
@@ -480,6 +466,7 @@ files:
480
466
  - spec/assets/hello-sinatra/Gemfile
481
467
  - spec/assets/hello-sinatra/Gemfile.lock
482
468
  - spec/assets/hello-sinatra/main.rb
469
+ - spec/assets/hello-sinatra/manifest.yml
483
470
  - spec/assets/rails328_ruby187_app/app/assets/images/rails.png
484
471
  - spec/assets/rails328_ruby187_app/app/assets/javascripts/application.js
485
472
  - spec/assets/rails328_ruby187_app/app/assets/stylesheets/application.css
@@ -530,6 +517,7 @@ files:
530
517
  - spec/assets/rails328_ruby187_app/test/test_helper.rb
531
518
  - spec/cf/cli/app/base_spec.rb
532
519
  - spec/cf/cli/app/delete_spec.rb
520
+ - spec/cf/cli/app/env_spec.rb
533
521
  - spec/cf/cli/app/events_spec.rb
534
522
  - spec/cf/cli/app/help_spec.rb
535
523
  - spec/cf/cli/app/instances_spec.rb
@@ -584,7 +572,6 @@ files:
584
572
  - spec/cf/cli/user/passwd_spec.rb
585
573
  - spec/cf/cli/user/register_spec.rb
586
574
  - spec/cf/cli_spec.rb
587
- - spec/cf/object_extensions_spec.rb
588
575
  - spec/console/console_spec.rb
589
576
  - spec/factories/cfoundry/v2/apps_factory.rb
590
577
  - spec/factories/cfoundry/v2/clients_factory.rb
@@ -626,6 +613,8 @@ files:
626
613
  - spec/support/features_helper.rb
627
614
  - spec/support/interact_helper.rb
628
615
  - spec/support/matchers.rb
616
+ - spec/support/mock_commands/mock_restart.rb
617
+ - spec/support/mock_commands/mock_start.rb
629
618
  - spec/support/shared_examples/errors.rb
630
619
  - spec/support/shared_examples/input.rb
631
620
  - spec/tunnel/plugin_spec.rb
@@ -646,7 +635,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
646
635
  version: '0'
647
636
  segments:
648
637
  - 0
649
- hash: -2008180272161412010
638
+ hash: -2638009255464879430
650
639
  required_rubygems_version: !ruby/object:Gem::Requirement
651
640
  none: false
652
641
  requirements:
@@ -665,6 +654,7 @@ test_files:
665
654
  - spec/admin/service_broker/add_spec.rb
666
655
  - spec/admin/service_broker/remove_spec.rb
667
656
  - spec/admin/service_broker/service_brokers_spec.rb
657
+ - spec/admin/service_broker/update_spec.rb
668
658
  - spec/admin/set_quota_spec.rb
669
659
  - spec/assets/env/env_test.rb
670
660
  - spec/assets/env/Gemfile
@@ -674,6 +664,7 @@ test_files:
674
664
  - spec/assets/hello-sinatra/Gemfile
675
665
  - spec/assets/hello-sinatra/Gemfile.lock
676
666
  - spec/assets/hello-sinatra/main.rb
667
+ - spec/assets/hello-sinatra/manifest.yml
677
668
  - spec/assets/rails328_ruby187_app/app/assets/images/rails.png
678
669
  - spec/assets/rails328_ruby187_app/app/assets/javascripts/application.js
679
670
  - spec/assets/rails328_ruby187_app/app/assets/stylesheets/application.css
@@ -724,6 +715,7 @@ test_files:
724
715
  - spec/assets/rails328_ruby187_app/test/test_helper.rb
725
716
  - spec/cf/cli/app/base_spec.rb
726
717
  - spec/cf/cli/app/delete_spec.rb
718
+ - spec/cf/cli/app/env_spec.rb
727
719
  - spec/cf/cli/app/events_spec.rb
728
720
  - spec/cf/cli/app/help_spec.rb
729
721
  - spec/cf/cli/app/instances_spec.rb
@@ -778,7 +770,6 @@ test_files:
778
770
  - spec/cf/cli/user/passwd_spec.rb
779
771
  - spec/cf/cli/user/register_spec.rb
780
772
  - spec/cf/cli_spec.rb
781
- - spec/cf/object_extensions_spec.rb
782
773
  - spec/console/console_spec.rb
783
774
  - spec/factories/cfoundry/v2/apps_factory.rb
784
775
  - spec/factories/cfoundry/v2/clients_factory.rb
@@ -820,6 +811,8 @@ test_files:
820
811
  - spec/support/features_helper.rb
821
812
  - spec/support/interact_helper.rb
822
813
  - spec/support/matchers.rb
814
+ - spec/support/mock_commands/mock_restart.rb
815
+ - spec/support/mock_commands/mock_start.rb
823
816
  - spec/support/shared_examples/errors.rb
824
817
  - spec/support/shared_examples/input.rb
825
818
  - spec/tunnel/plugin_spec.rb
@@ -1,24 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "#try" do
4
- it "calls through with arguments on non-nil objects" do
5
- "hi".try(:sub, 'i', 'o').should == "ho"
6
- end
7
-
8
- it "yields to a provided block" do
9
- hash = {key: "value"}
10
- retrieved_key = nil
11
- retrieved_value = nil
12
- hash.try(:each) do |k, v|
13
- retrieved_key = k
14
- retrieved_value = v
15
- end
16
-
17
- retrieved_key.should == :key
18
- retrieved_value.should == "value"
19
- end
20
-
21
- it "returns nil for nil" do
22
- nil.try(:sub, 'i', 'o').should == nil
23
- end
24
- end