spec/shelly/cli/main_spec.rb in shelly-0.0.58 vs spec/shelly/cli/main_spec.rb in shelly-0.0.59
- old
+ new
@@ -34,10 +34,11 @@
shelly ip # List cloud's IP addresses
shelly list # List available clouds
shelly login [EMAIL] # Log into Shelly Cloud
shelly logout # Logout from Shelly Cloud
shelly logs # Show latest application logs
+ shelly open # Open application page in browser
shelly rake TASK # Run rake task
shelly redeploy # Redeploy application
shelly register [EMAIL] # Register new account
shelly setup # Set up clouds
shelly start # Start the cloud
@@ -738,11 +739,12 @@
end
describe "#ip" do
before do
- File.open("Cloudfile", 'w') {|f| f.write("foo-production:\n") }
+ File.open("Cloudfile", 'w') { |f| f.write("foo-production:\n") }
+ @app = Shelly::App.new("foo-staging")
@main.stub(:logged_in?).and_return(true)
end
it "should ensure user has logged in" do
hooks(@main, :ip).should include(:logged_in?)
@@ -1247,8 +1249,33 @@
@client.should_receive(:redeploy).with("foo-production").and_raise(exception)
lambda {
invoke(@main, :redeploy)
}.should raise_error(Shelly::Client::ConflictException)
end
+ end
+ end
+
+ describe "#open" do
+ before do
+ @user = Shelly::User.new
+ @client.stub(:token).and_return("abc")
+ @app = Shelly::App.new("foo-production")
+ @app.stub(:open)
+ Shelly::App.stub(:new).and_return(@app)
+ FileUtils.mkdir_p("/projects/foo")
+ Dir.chdir("/projects/foo")
+ File.open("Cloudfile", 'w') { |f| f.write("foo-production:\n") }
+ end
+
+ # multiple_clouds is tested in main_spec.rb in describe "#start" block
+ it "should ensure multiple_clouds check" do
+ @client.stub(:open)
+ @main.should_receive(:multiple_clouds).and_return(@app)
+ invoke(@main, :open)
+ end
+
+ it "should open app" do
+ @app.should_receive(:open)
+ invoke(@main, :open)
end
end
end