diff options
| -rw-r--r-- | test/app_test.rb | 21 | ||||
| -rw-r--r-- | test/test_helper.rb | 2 |
2 files changed, 20 insertions, 3 deletions
diff --git a/test/app_test.rb b/test/app_test.rb index 65e3982..3226534 100644 --- a/test/app_test.rb +++ b/test/app_test.rb @@ -30,18 +30,35 @@ class AppTest < Test::Unit::TestCase app.process_args('show').run end - def test_report_generic_failure + def test_generic_failure app = HCl::App.new app.expects(:show).raises(RuntimeError) app.expects(:exit).with(1) app.process_args('show').run end - def test_report_socket_error + def test_socket_error app = HCl::App.new app.expects(:show).raises(SocketError) app.expects(:exit).with(1) app.process_args('show').run end + def test_configure_on_auth_failure + app = HCl::App.new + configured = states('configured').starts_as(false) + app.expects(:show).raises(HCl::TimesheetResource::AuthFailure).when(configured.is(false)) + app.expects(:ask).returns('xxx').times(4).when(configured.is(false)) + app.expects(:write_config).then(configured.is(true)) + app.expects(:show).when(configured.is(true)) + app.process_args('show').run + end + + def test_api_failure + app = HCl::App.new + app.expects(:show).raises(HCl::TimesheetResource::Failure) + app.expects(:exit).with(1) + app.process_args('show').run + end + end diff --git a/test/test_helper.rb b/test/test_helper.rb index 784e4f2..2d7ec9f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -12,7 +12,7 @@ begin minimum_coverage case RUBY_ENGINE when "rbx" then 84 when "jruby" then 73 - else 74 + else 78 end end rescue LoadError => e |
