spec/shelly/cli/main_spec.rb in shelly-0.4.37 vs spec/shelly/cli/main_spec.rb in shelly-0.4.38

- old
+ new

@@ -369,11 +369,11 @@ @main.options = {"code-name" => "foo", "databases" => ["postgresql"], "size" => "large"} invoke(@main, :add) end it "should use zone from option" do - @app.should_receive(:zone_name=).with('eu1') + @app.should_receive(:zone=).with('eu1') @main.options = {"zone" => "eu1"} fake_stdin(["mycodename", ""]) do invoke(@main, :add) end end @@ -581,9 +581,21 @@ @app.should_receive(:create).and_raise(exception) $stdout.should_receive(:puts).with(red "You have to be the owner of 'foobar' organization to add clouds") expect do fake_stdin(["foooo", "none"]) do + invoke(@main, :add) + end + end.to raise_error(SystemExit) + end + + it "should show conflict exception" do + exception = Shelly::Client::ConflictException.new({'error' => 'message'}) + @app.should_receive(:create).and_raise(exception) + $stdout.should_receive(:puts).with(red "message") + + expect do + fake_stdin(["foo", "none"]) do invoke(@main, :add) end end.to raise_error(SystemExit) end