diff options
Diffstat (limited to 'test/app_test.rb')
| -rw-r--r-- | test/app_test.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/app_test.rb b/test/app_test.rb index cbee636..28acba9 100644 --- a/test/app_test.rb +++ b/test/app_test.rb @@ -7,11 +7,22 @@ class AppTest < Test::Unit::TestCase end def test_command_show - HCl::DayEntry.expects(:all).returns([HCl::DayEntry.new({ + HCl::DayEntry.expects(:all).returns [HCl::DayEntry.new( hours:'2.06', notes: 'hi world', project: 'App' - })]) + )] HCl::App.command 'show' end + + def test_command_retry_on_throttle + app = HCl::App.new + throttled = states('throttled').starts_as(false) + app.expects(:show). + raises(HCl::TimesheetResource::ThrottleFailure, stub(headers:{'Retry-After' => 42})). + then(throttled.is(true)) + app.expects(:sleep).with(47).when(throttled.is(true)) + app.expects(:show).when(throttled.is(true)) + app.process_args('show').run + end end |
