diff options
| author | Zack Hobson | 2013-12-09 17:50:03 -0800 | 
|---|---|---|
| committer | Zack Hobson | 2013-12-09 17:50:03 -0800 | 
| commit | 5aec7e62d93f7a6583380d1dec998f0358161484 (patch) | |
| tree | e5a9e0af9dc243eb10a4849a834fd361740c4f5f /test | |
| parent | b62f8c76961c9fdfc9b9fb1f21ac60d4726505b0 (diff) | |
| download | hcl-5aec7e62d93f7a6583380d1dec998f0358161484.tar.bz2 | |
app: coverage game!
Diffstat (limited to 'test')
| -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 | 
