spec/shelly/cli/runner_spec.rb in shelly-0.0.41 vs spec/shelly/cli/runner_spec.rb in shelly-0.0.42
- old
+ new
@@ -50,11 +50,20 @@
}.should raise_error(RuntimeError)
end
end
context "without --debug option (normal mode)" do
- it "should rescue exception and display generic error message" do
+ it "should caught exception and display generic error message" do
Shelly::CLI::Main.stub(:start).and_raise(RuntimeError.new)
+ runner = Shelly::CLI::Runner.new(%w(version))
+ $stdout.should_receive(:puts).with("Unknown error, to see debug information run command with --debug")
+ lambda {
+ runner.start
+ }.should raise_error(SystemExit)
+ end
+
+ it "should caught exception thrown by API Client" do
+ Shelly::CLI::Main.stub(:start).and_raise(Shelly::Client::APIError.new(401))
runner = Shelly::CLI::Runner.new(%w(version))
$stdout.should_receive(:puts).with("Unknown error, to see debug information run command with --debug")
lambda {
runner.start
}.should raise_error(SystemExit)