spec/features/switching_targets_spec.rb in cf-0.6.1.rc5 vs spec/features/switching_targets_spec.rb in cf-0.6.1.rc6
- old
+ new
@@ -7,16 +7,21 @@
let(:username) { ENV['CF_V2_TEST_USER'] }
let(:password) { ENV['CF_V2_TEST_PASSWORD'] }
let(:space) { ENV['CF_V2_TEST_SPACE'] }
let(:space2) { "#{ENV['CF_V2_TEST_SPACE']}-2"}
let(:organization) { ENV['CF_V2_TEST_ORGANIZATION'] }
+ let(:organization_two) { ENV['CF_V2_TEST_ORGANIZATION_TWO'] }
+ let(:created_space_1) { "space-#{rand(10000)}"}
+ let(:created_space_2) { "space-#{rand(10000)}"}
+
before do
Interact::Progress::Dots.start!
end
after do
+ logout
Interact::Progress::Dots.stop!
end
it "can switch targets, even if a target is invalid" do
BlueShell::Runner.run("#{cf_bin} target invalid-target") do |runner|
@@ -29,40 +34,32 @@
expect(runner).to say target
runner.wait_for_exit
end
end
- it "can switch organizations and spaces" do
- BlueShell::Runner.run("#{cf_bin} target #{target}")
- BlueShell::Runner.run("#{cf_bin} logout")
+ context "with created spaces in the second org" do
+ it "can switch organizations and spaces" do
+ login
- BlueShell::Runner.run("#{cf_bin} login") do |runner|
- expect(runner).to say "Email>"
- runner.send_keys username
+ BlueShell::Runner.run("#{cf_bin} target -o #{organization_two}") do |runner|
+ expect(runner).to say("Switching to organization #{organization_two}")
+ expect(runner).to say("Space>")
+ runner.send_keys space2
- expect(runner).to say "Password>"
- runner.send_keys password
+ expect(runner).to say(/Switching to space #{space2}/)
- expect(runner).to say "Authenticating... OK"
- end
+ runner.wait_for_exit
+ end
- BlueShell::Runner.run("#{cf_bin} target -o #{organization}") do |runner|
- expect(runner).to say("Switching to organization #{organization}")
+ BlueShell::Runner.run("#{cf_bin} target -s #{space}") do |runner|
+ expect(runner).to say("Switching to space #{space}")
+ runner.wait_for_exit
+ end
- expect(runner).to say("Space>")
- runner.send_keys space2
-
- runner.wait_for_exit
- end
-
- BlueShell::Runner.run("#{cf_bin} target -s #{space}") do |runner|
- expect(runner).to say("Switching to space #{space}")
- runner.wait_for_exit
- end
-
- BlueShell::Runner.run("#{cf_bin} target -s #{space2}") do |runner|
- expect(runner).to say("Switching to space #{space2}")
- runner.wait_for_exit
+ BlueShell::Runner.run("#{cf_bin} target -s #{space2}") do |runner|
+ expect(runner).to say("Switching to space #{space2}")
+ runner.wait_for_exit
+ end
end
end
end
else
$stderr.puts 'Skipping v2 integration specs; please provide necessary environment variables'