cf 0.6.1.rc4 → 0.6.1.rc5

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,6 @@ require "spec_helper"
2
2
 
3
3
  if ENV['CF_V2_RUN_INTEGRATION']
4
4
  describe 'A user logs in and switches spaces, after a different user has logged in', :ruby19 => true do
5
- include ConsoleAppSpeckerMatchers
6
5
 
7
6
  let(:target) { ENV['CF_V2_TEST_TARGET'] }
8
7
  let(:username) { ENV['CF_V2_TEST_USER'] }
@@ -16,13 +15,13 @@ if ENV['CF_V2_RUN_INTEGRATION']
16
15
  before do
17
16
  Interact::Progress::Dots.start!
18
17
 
19
- run("#{cf_bin} target #{target}") do |runner|
18
+ BlueShell::Runner.run("#{cf_bin} target #{target}") do |runner|
20
19
  expect(runner).to say "Setting target"
21
20
  expect(runner).to say target
22
21
  runner.wait_for_exit
23
22
  end
24
23
 
25
- run("#{cf_bin} logout") do |runner|
24
+ BlueShell::Runner.run("#{cf_bin} logout") do |runner|
26
25
  runner.wait_for_exit
27
26
  end
28
27
  end
@@ -33,7 +32,7 @@ if ENV['CF_V2_RUN_INTEGRATION']
33
32
 
34
33
  context "when a different user is already logged in" do
35
34
  before do
36
- run("#{cf_bin} login #{username} --password #{password}") do |runner|
35
+ BlueShell::Runner.run("#{cf_bin} login #{username} --password #{password}") do |runner|
37
36
  expect(runner).to say "Authenticating... OK"
38
37
 
39
38
  expect(runner).to say(
@@ -57,7 +56,7 @@ if ENV['CF_V2_RUN_INTEGRATION']
57
56
  end
58
57
 
59
58
  it "can switch spaces on login" do
60
- run("#{cf_bin} login #{second_username} --password #{second_password} --organization #{second_organization} --space #{second_space}") do |runner|
59
+ BlueShell::Runner.run("#{cf_bin} login #{second_username} --password #{second_password} --organization #{second_organization} --space #{second_space}") do |runner|
61
60
  expect(runner).to say "Authenticating... OK"
62
61
  expect(runner).to say "Switching to organization #{second_organization}... OK"
63
62
  expect(runner).to say "Switching to space #{second_space}... OK"
@@ -3,7 +3,6 @@ require "webmock/rspec"
3
3
 
4
4
  if ENV['CF_V2_RUN_INTEGRATION']
5
5
  describe 'A new user tries to use CF against v2', :ruby19 => true do
6
- include ConsoleAppSpeckerMatchers
7
6
  include CF::Interactive
8
7
 
9
8
  let(:target) { ENV['CF_V2_TEST_TARGET'] }
@@ -28,15 +27,15 @@ if ENV['CF_V2_RUN_INTEGRATION']
28
27
  end
29
28
 
30
29
  it 'pushes a simple sinatra app using defaults as much as possible' do
31
- run("#{cf_bin} logout") do |runner|
30
+ BlueShell::Runner.run("#{cf_bin} logout") do |runner|
32
31
  runner.wait_for_exit
33
32
  end
34
33
 
35
- run("#{cf_bin} target http://#{target}") do |runner|
34
+ BlueShell::Runner.run("#{cf_bin} target http://#{target}") do |runner|
36
35
  expect(runner).to say %r{Setting target to http://#{target}... OK}
37
36
  end
38
37
 
39
- run("#{cf_bin} login") do |runner|
38
+ BlueShell::Runner.run("#{cf_bin} login") do |runner|
40
39
  expect(runner).to say %r{target: https?://#{target}}
41
40
 
42
41
  expect(runner).to say "Email>"
@@ -64,12 +63,12 @@ if ENV['CF_V2_RUN_INTEGRATION']
64
63
  )
65
64
  end
66
65
 
67
- run("#{cf_bin} app #{app}") do |runner|
66
+ BlueShell::Runner.run("#{cf_bin} app #{app}") do |runner|
68
67
  expect(runner).to say "Unknown app '#{app}'."
69
68
  end
70
69
 
71
70
  Dir.chdir("#{SPEC_ROOT}/assets/hello-sinatra") do
72
- run("#{cf_bin} push") do |runner|
71
+ BlueShell::Runner.run("#{cf_bin} push") do |runner|
73
72
  expect(runner).to say "Name>"
74
73
  runner.send_keys app
75
74
 
@@ -129,7 +128,7 @@ if ENV['CF_V2_RUN_INTEGRATION']
129
128
  end
130
129
  end
131
130
 
132
- run("#{cf_bin} services") do |runner|
131
+ BlueShell::Runner.run("#{cf_bin} services") do |runner|
133
132
  expect(runner).to say /name\s+service\s+provider\s+version\s+plan\s+bound apps/
134
133
  expect(runner).to say /mysql-.+?\s+ # name
135
134
  mysql\s+ # service
@@ -140,7 +139,7 @@ if ENV['CF_V2_RUN_INTEGRATION']
140
139
  /x
141
140
  end
142
141
 
143
- run("#{cf_bin} delete #{app}") do |runner|
142
+ BlueShell::Runner.run("#{cf_bin} delete #{app}") do |runner|
144
143
  expect(runner).to say "Really delete #{app}?>"
145
144
  runner.send_keys "y"
146
145
  expect(runner).to say "Deleting #{app}... OK"
@@ -2,7 +2,6 @@ require "spec_helper"
2
2
 
3
3
  if ENV['CF_V2_RUN_INTEGRATION']
4
4
  describe 'A new user tries to use CF against v2 production', :ruby19 => true do
5
- include ConsoleAppSpeckerMatchers
6
5
 
7
6
  let(:target) { ENV['CF_V2_TEST_TARGET'] }
8
7
  let(:username) { ENV['CF_V2_TEST_USER'] }
@@ -20,12 +19,12 @@ if ENV['CF_V2_RUN_INTEGRATION']
20
19
  end
21
20
 
22
21
  it "can switch targets, even if a target is invalid" do
23
- run("#{cf_bin} target invalid-target") do |runner|
22
+ BlueShell::Runner.run("#{cf_bin} target invalid-target") do |runner|
24
23
  expect(runner).to say "Target refused"
25
24
  runner.wait_for_exit
26
25
  end
27
26
 
28
- run("#{cf_bin} target #{target}") do |runner|
27
+ BlueShell::Runner.run("#{cf_bin} target #{target}") do |runner|
29
28
  expect(runner).to say "Setting target"
30
29
  expect(runner).to say target
31
30
  runner.wait_for_exit
@@ -33,11 +32,10 @@ if ENV['CF_V2_RUN_INTEGRATION']
33
32
  end
34
33
 
35
34
  it "can switch organizations and spaces" do
36
- run("#{cf_bin} logout") do |runner|
37
- runner.wait_for_exit
38
- end
35
+ BlueShell::Runner.run("#{cf_bin} target #{target}")
36
+ BlueShell::Runner.run("#{cf_bin} logout")
39
37
 
40
- run("#{cf_bin} login") do |runner|
38
+ BlueShell::Runner.run("#{cf_bin} login") do |runner|
41
39
  expect(runner).to say "Email>"
42
40
  runner.send_keys username
43
41
 
@@ -47,7 +45,7 @@ if ENV['CF_V2_RUN_INTEGRATION']
47
45
  expect(runner).to say "Authenticating... OK"
48
46
  end
49
47
 
50
- run("#{cf_bin} target -o #{organization}") do |runner|
48
+ BlueShell::Runner.run("#{cf_bin} target -o #{organization}") do |runner|
51
49
  expect(runner).to say("Switching to organization #{organization}")
52
50
 
53
51
  expect(runner).to say("Space>")
@@ -56,12 +54,12 @@ if ENV['CF_V2_RUN_INTEGRATION']
56
54
  runner.wait_for_exit
57
55
  end
58
56
 
59
- run("#{cf_bin} target -s #{space}") do |runner|
57
+ BlueShell::Runner.run("#{cf_bin} target -s #{space}") do |runner|
60
58
  expect(runner).to say("Switching to space #{space}")
61
59
  runner.wait_for_exit
62
60
  end
63
61
 
64
- run("#{cf_bin} target -s #{space2}") do |runner|
62
+ BlueShell::Runner.run("#{cf_bin} target -s #{space2}") do |runner|
65
63
  expect(runner).to say("Switching to space #{space2}")
66
64
  runner.wait_for_exit
67
65
  end
@@ -8,6 +8,7 @@ require "cf/test_support"
8
8
  require "webmock"
9
9
  require "ostruct"
10
10
  require "fakefs/safe"
11
+ require "blue-shell"
11
12
 
12
13
  INTEGRATE_WITH = ENV["INTEGRATE_WITH"] || "default"
13
14
  TRAVIS_BUILD_ID = ENV["TRAVIS_BUILD_ID"]
@@ -35,7 +36,7 @@ end
35
36
 
36
37
  RSpec.configure do |c|
37
38
  c.include Fake::FakeMethods
38
- c.include ConsoleAppSpeckerMatchers
39
+ c.include BlueShell::Matchers
39
40
 
40
41
  c.mock_with :rr
41
42
 
@@ -64,9 +65,3 @@ def name_list(xs)
64
65
  xs.collect(&:name).join(", ")
65
66
  end
66
67
  end
67
-
68
- def run(command)
69
- SpeckerRunner.new(command) do |runner|
70
- yield runner
71
- end
72
- end
@@ -52,11 +52,11 @@ module CliHelper
52
52
  end
53
53
 
54
54
  def output
55
- @output ||= TrackingExpector.new(stdout)
55
+ @output ||= BlueShell::BufferedReaderExpector.new(stdout)
56
56
  end
57
57
 
58
58
  def error_output
59
- @error_output ||= TrackingExpector.new(stderr)
59
+ @error_output ||= BlueShell::BufferedReaderExpector.new(stderr)
60
60
  end
61
61
 
62
62
  def mock_invoke(*args)
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: 0.6.1.rc4
4
+ version: 0.6.1.rc5
5
5
  prerelease: 6
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-04-05 00:00:00.000000000 Z
13
+ date: 2013-04-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json_pure
@@ -168,6 +168,22 @@ dependencies:
168
168
  - - ~>
169
169
  - !ruby/object:Gem::Version
170
170
  version: '2.11'
171
+ - !ruby/object:Gem::Dependency
172
+ name: blue-shell
173
+ requirement: !ruby/object:Gem::Requirement
174
+ none: false
175
+ requirements:
176
+ - - ! '>='
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
179
+ type: :development
180
+ prerelease: false
181
+ version_requirements: !ruby/object:Gem::Requirement
182
+ none: false
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
171
187
  - !ruby/object:Gem::Dependency
172
188
  name: webmock
173
189
  requirement: !ruby/object:Gem::Requirement
@@ -293,8 +309,6 @@ files:
293
309
  - spec/assets/hello-sinatra/Gemfile
294
310
  - spec/assets/hello-sinatra/Gemfile.lock
295
311
  - spec/assets/hello-sinatra/main.rb
296
- - spec/assets/specker_runner/specker_runner_input.rb
297
- - spec/assets/specker_runner/specker_runner_pause.rb
298
312
  - spec/cf/cli/app/base_spec.rb
299
313
  - spec/cf/cli/app/delete_spec.rb
300
314
  - spec/cf/cli/app/instances_spec.rb
@@ -319,8 +333,10 @@ files:
319
333
  - spec/cf/cli/service/service_spec.rb
320
334
  - spec/cf/cli/service/services_spec.rb
321
335
  - spec/cf/cli/service/unbind_spec.rb
336
+ - spec/cf/cli/space/base_spec.rb
322
337
  - spec/cf/cli/space/create_spec.rb
323
338
  - spec/cf/cli/space/rename_spec.rb
339
+ - spec/cf/cli/space/space_spec.rb
324
340
  - spec/cf/cli/space/spaces_spec.rb
325
341
  - spec/cf/cli/space/switch_space_spec.rb
326
342
  - spec/cf/cli/start/info_spec.rb
@@ -331,8 +347,6 @@ files:
331
347
  - spec/cf/cli/user/passwd_spec.rb
332
348
  - spec/cf/cli/user/register_spec.rb
333
349
  - spec/cf/cli_spec.rb
334
- - spec/console_app_specker/console_app_specker_matchers_spec.rb
335
- - spec/console_app_specker/specker_runner_spec.rb
336
350
  - spec/features/account_lifecycle_spec.rb
337
351
  - spec/features/login_spec.rb
338
352
  - spec/features/push_flow_spec.rb
@@ -340,14 +354,10 @@ files:
340
354
  - spec/spec_helper.rb
341
355
  - spec/support/cli_helper.rb
342
356
  - spec/support/config_helper.rb
343
- - spec/support/console_app_specker_matchers.rb
344
357
  - spec/support/fake_home_dir.rb
345
358
  - spec/support/interact_helper.rb
346
359
  - spec/support/shared_examples/errors.rb
347
360
  - spec/support/shared_examples/input.rb
348
- - spec/support/shared_examples/populate_organization.rb
349
- - spec/support/specker_runner.rb
350
- - spec/support/tracking_expector.rb
351
361
  - bin/cf
352
362
  homepage: http://github.com/cloudfoundry/cf
353
363
  licenses: []
@@ -363,7 +373,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
363
373
  version: '0'
364
374
  segments:
365
375
  - 0
366
- hash: -2266107112903724844
376
+ hash: 544715593409945959
367
377
  required_rubygems_version: !ruby/object:Gem::Requirement
368
378
  none: false
369
379
  requirements:
@@ -382,8 +392,6 @@ test_files:
382
392
  - spec/assets/hello-sinatra/Gemfile
383
393
  - spec/assets/hello-sinatra/Gemfile.lock
384
394
  - spec/assets/hello-sinatra/main.rb
385
- - spec/assets/specker_runner/specker_runner_input.rb
386
- - spec/assets/specker_runner/specker_runner_pause.rb
387
395
  - spec/cf/cli/app/base_spec.rb
388
396
  - spec/cf/cli/app/delete_spec.rb
389
397
  - spec/cf/cli/app/instances_spec.rb
@@ -408,8 +416,10 @@ test_files:
408
416
  - spec/cf/cli/service/service_spec.rb
409
417
  - spec/cf/cli/service/services_spec.rb
410
418
  - spec/cf/cli/service/unbind_spec.rb
419
+ - spec/cf/cli/space/base_spec.rb
411
420
  - spec/cf/cli/space/create_spec.rb
412
421
  - spec/cf/cli/space/rename_spec.rb
422
+ - spec/cf/cli/space/space_spec.rb
413
423
  - spec/cf/cli/space/spaces_spec.rb
414
424
  - spec/cf/cli/space/switch_space_spec.rb
415
425
  - spec/cf/cli/start/info_spec.rb
@@ -420,8 +430,6 @@ test_files:
420
430
  - spec/cf/cli/user/passwd_spec.rb
421
431
  - spec/cf/cli/user/register_spec.rb
422
432
  - spec/cf/cli_spec.rb
423
- - spec/console_app_specker/console_app_specker_matchers_spec.rb
424
- - spec/console_app_specker/specker_runner_spec.rb
425
433
  - spec/features/account_lifecycle_spec.rb
426
434
  - spec/features/login_spec.rb
427
435
  - spec/features/push_flow_spec.rb
@@ -429,11 +437,7 @@ test_files:
429
437
  - spec/spec_helper.rb
430
438
  - spec/support/cli_helper.rb
431
439
  - spec/support/config_helper.rb
432
- - spec/support/console_app_specker_matchers.rb
433
440
  - spec/support/fake_home_dir.rb
434
441
  - spec/support/interact_helper.rb
435
442
  - spec/support/shared_examples/errors.rb
436
443
  - spec/support/shared_examples/input.rb
437
- - spec/support/shared_examples/populate_organization.rb
438
- - spec/support/specker_runner.rb
439
- - spec/support/tracking_expector.rb
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $stdout.sync = true
4
- print "started"
5
- typed = gets
6
- print "received #{typed}"
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- print "started"
4
- sleep 0.5
5
- print " finished"
@@ -1,173 +0,0 @@
1
- require 'spec_helper'
2
- include ConsoleAppSpeckerMatchers
3
-
4
- describe ConsoleAppSpeckerMatchers, :ruby19 => true do
5
- describe "#say" do
6
- it "returns an ExpectOutputMatcher" do
7
- say("").should be_a(ExpectOutputMatcher)
8
- end
9
-
10
- context "with an explicit timeout" do
11
- it "returns an ExpectOutputMatcher" do
12
- matcher = say("", 30)
13
- matcher.should be_a(ExpectOutputMatcher)
14
- matcher.timeout.should == 30
15
- end
16
- end
17
- end
18
-
19
- describe "#have_exited_with" do
20
- it "returns an ExitCodeMatcher" do
21
- have_exited_with(1).should be_a(ExitCodeMatcher)
22
- end
23
-
24
- it "has synonyms" do
25
- exit_with(1).should be_a(ExitCodeMatcher)
26
- end
27
- end
28
- end
29
-
30
- describe ExpectOutputMatcher, :ruby19 => true do
31
- let(:expected_output) { "expected_output" }
32
- let(:timeout) { 1 }
33
-
34
- subject { ExpectOutputMatcher.new(expected_output, timeout) }
35
-
36
- describe "#matches?" do
37
- context "with something that isn't a runner" do
38
- it "raises an exception" do
39
- expect {
40
- subject.matches?("c'est ne pas une specker runner")
41
- }.to raise_exception(InvalidInputError)
42
- end
43
- end
44
-
45
- context "with a valid runner" do
46
- context "when the expected output is in the process output" do
47
- it "finds the expected output" do
48
- run("echo -n expected_output") do |runner|
49
- subject.matches?(runner).should be_true
50
- end
51
- end
52
- end
53
-
54
- context "when the expected output is not in the process output" do
55
- let(:runner) { SpeckerRunner.new('echo -n not_what_we_were_expecting') }
56
-
57
- it "does not find the expected output" do
58
- run("echo -n not_what_we_were_expecting") do |runner|
59
- subject.matches?(runner).should be_false
60
- end
61
- end
62
- end
63
- end
64
- end
65
-
66
- context "failure messages" do
67
- it "has a correct failure message" do
68
- run("echo -n actual_output") do |runner|
69
- subject.matches?(runner)
70
- subject.failure_message.should == "expected 'expected_output' to be printed, but it wasn't. full output:\nactual_output"
71
- end
72
- end
73
-
74
- it "has a correct negative failure message" do
75
- run("echo -n actual_output") do |runner|
76
- subject.matches?(runner)
77
- subject.negative_failure_message.should == "expected 'expected_output' to not be printed, but it was. full output:\nactual_output"
78
- end
79
- end
80
-
81
- context "when expecting branching output" do
82
- let(:expected_output) { {
83
- "expected_output" => proc {},
84
- "other_expected_output" => proc {}
85
- } }
86
-
87
- it "has a correct failure message" do
88
- run("echo -n actual_output") do |runner|
89
- subject.matches?(runner)
90
- subject.failure_message.should == "expected one of 'expected_output', 'other_expected_output' to be printed, but it wasn't. full output:\nactual_output"
91
- end
92
- end
93
-
94
- it "has a correct negative failure message" do
95
- run("echo -n expected_output") do |runner|
96
- subject.matches?(runner)
97
- subject.negative_failure_message.should == "expected 'expected_output' to not be printed, but it was. full output:\nexpected_output"
98
- end
99
- end
100
- end
101
- end
102
- end
103
-
104
- describe ExitCodeMatcher, :ruby19 => true do
105
- let(:expected_code) { 0 }
106
-
107
- subject { ExitCodeMatcher.new(expected_code) }
108
-
109
- describe "#matches?" do
110
- context "with something that isn't a runner" do
111
- it "raises an exception" do
112
- expect {
113
- subject.matches?("c'est ne pas une specker runner")
114
- }.to raise_exception(InvalidInputError)
115
- end
116
- end
117
-
118
- context "with a valid runner" do
119
- context "and the command exited with the expected exit code" do
120
- it "returns true" do
121
- run("true") do |runner|
122
- subject.matches?(runner).should be_true
123
- end
124
- end
125
- end
126
-
127
- context "and the command exits with a different exit code" do
128
- it "returns false" do
129
- run("false") do |runner|
130
- subject.matches?(runner).should be_false
131
- end
132
- end
133
- end
134
-
135
- context "and the command runs for a while" do
136
- it "waits for it to exit" do
137
- run("sleep 0.5") do |runner|
138
- subject.matches?(runner).should be_true
139
- end
140
- end
141
- end
142
- end
143
- end
144
-
145
- context "failure messages" do
146
- context "with a command that's exited" do
147
- it "has a correct failure message" do
148
- run("false") do |runner|
149
- subject.matches?(runner)
150
- runner.wait_for_exit
151
- subject.failure_message.should == "expected process to exit with status 0, but it exited with status 1"
152
- end
153
- end
154
-
155
- it "has a correct negative failure message" do
156
- run("false") do |runner|
157
- subject.matches?(runner)
158
- runner.wait_for_exit
159
- subject.negative_failure_message.should == "expected process to not exit with status 0, but it did"
160
- end
161
- end
162
- end
163
-
164
- context "with a command that's still running" do
165
- it "waits for it to exit" do
166
- run("ruby -e 'sleep 1; exit 1'") do |runner|
167
- subject.matches?(runner)
168
- subject.failure_message.should == "expected process to exit with status 0, but it exited with status 1"
169
- end
170
- end
171
- end
172
- end
173
- end