spec/features/space_spec.rb in cf-0.6.1.rc16 vs spec/features/space_spec.rb in cf-0.6.1.rc17
- old
+ new
@@ -39,65 +39,78 @@
expect(runner).to say("#{space}:\n")
expect(runner).to say("organization: #{organization}")
end
end
- it "can create, switch, rename, and delete spaces" do
- new_space = "test-space-#{rand(10000)}"
- new_space_two = "test-space-renamed-#{rand(10000)}"
- BlueShell::Runner.run("#{cf_bin} create-space #{new_space}") do |runner|
- expect(runner).to say("Creating space #{new_space}... OK")
- end
+ describe "needs cleanup after specs" do
+ let(:run_id) { TRAVIS_BUILD_ID.to_s + Time.new.to_f.to_s.gsub(".", "_") }
+ let(:app) { "hello-sinatra-recursive-#{run_id}" }
+ let(:new_space) { "test-space-#{rand(10000)}" }
+ let(:new_space_two) { "test-space-renamed-#{rand(10000)}" }
- BlueShell::Runner.run("#{cf_bin} switch-space #{new_space}") do |runner|
- expect(runner).to say("Switching to space #{new_space}... OK")
+ after do
+ begin
+ BlueShell::Runner.run("#{cf_bin} delete-space #{new_space} -r -f")
+ rescue
+ end
+ begin
+ BlueShell::Runner.run("#{cf_bin} delete-space #{new_space_two} -r -f")
+ rescue
+ end
end
- BlueShell::Runner.run("#{cf_bin} rename-space #{new_space} #{new_space_two}") do |runner|
- expect(runner).to say("Renaming to #{new_space_two}... OK")
- end
+ it "can create, switch, rename, and delete spaces" do
+ BlueShell::Runner.run("#{cf_bin} create-space #{new_space}") do |runner|
+ expect(runner).to say("Creating space #{new_space}... OK")
+ end
- BlueShell::Runner.run("#{cf_bin} delete-space #{new_space_two}") do |runner|
- expect(runner).to say("Really delete")
- runner.send_keys "y"
+ BlueShell::Runner.run("#{cf_bin} switch-space #{new_space}") do |runner|
+ expect(runner).to say("Switching to space #{new_space}... OK")
+ end
- expect(runner).to say("Deleting space #{new_space_two}... OK")
- end
- end
+ BlueShell::Runner.run("#{cf_bin} rename-space #{new_space} #{new_space_two}") do |runner|
+ expect(runner).to say("Renaming to #{new_space_two}... OK")
+ end
- it "shows all the spaces in the org" do
- BlueShell::Runner.run("#{cf_bin} spaces") do |runner|
- expect(runner).to say(space)
+ BlueShell::Runner.run("#{cf_bin} delete-space #{new_space_two}") do |runner|
+ expect(runner).to say("Really delete")
+ runner.send_keys "y"
+
+ expect(runner).to say("Deleting space #{new_space_two}... OK")
+ end
end
- end
- let(:run_id) { TRAVIS_BUILD_ID.to_s + Time.new.to_f.to_s.gsub(".", "_") }
- let(:app) { "hello-sinatra-recursive-#{run_id}" }
+ it "can create an app in a space, then delete it recursively" do
+ BlueShell::Runner.run("#{cf_bin} create-space #{new_space}") { |runner| runner.wait_for_exit(30) }
+ BlueShell::Runner.run("#{cf_bin} switch-space #{new_space}") { |runner| runner.wait_for_exit(30) }
- it "can create an app in a space, then delete it recursively" do
- new_space = "test-space-#{rand(10000)}"
- BlueShell::Runner.run("#{cf_bin} create-space #{new_space}") { |runner| runner.wait_for_exit(30) }
- BlueShell::Runner.run("#{cf_bin} switch-space #{new_space}") { |runner| runner.wait_for_exit(30) }
+ push_app("hello-sinatra", app)
- push_app("hello-sinatra", app)
+ BlueShell::Runner.run("#{cf_bin} delete-space #{new_space} --force") do |runner|
+ expect(runner).to say("If you want to delete the space along with all dependent objects, rerun the command with the '--recursive' flag.")
+ runner.wait_for_exit(30)
+ end.should_not be_successful
- BlueShell::Runner.run("#{cf_bin} delete-space #{new_space} --force") do |runner|
- expect(runner).to say("If you want to delete the space along with all dependent objects, rerun the command with the '--recursive' flag.")
- runner.wait_for_exit(30)
- end.should_not be_successful
+ BlueShell::Runner.run("#{cf_bin} spaces") do |runner|
+ expect(runner).to say(new_space)
+ expect(runner).to say(app)
+ end
- BlueShell::Runner.run("#{cf_bin} spaces") do |runner|
- expect(runner).to say(new_space)
- expect(runner).to say(app)
- end
+ BlueShell::Runner.run("#{cf_bin} delete-space #{new_space} --recursive --force") do |runner|
+ expect(runner).to say("Deleting space #{new_space}... OK")
+ end
- BlueShell::Runner.run("#{cf_bin} delete-space #{new_space} --recursive --force") do |runner|
- expect(runner).to say("Deleting space #{new_space}... OK")
+ BlueShell::Runner.run("#{cf_bin} spaces") do |runner|
+ expect(runner).to_not say(new_space)
+ expect(runner).to_not say(app)
+ end
end
+ end
+ it "shows all the spaces in the org" do
BlueShell::Runner.run("#{cf_bin} spaces") do |runner|
- expect(runner).to_not say(new_space)
- expect(runner).to_not say(app)
+ expect(runner).to say(space)
end
end
+
end
end