diff options
| author | Zack Hobson | 2013-12-26 17:11:34 -0800 | 
|---|---|---|
| committer | Zack Hobson | 2013-12-26 17:11:34 -0800 | 
| commit | 087da79f8c4135acc19a71822295c328c0d57a5a (patch) | |
| tree | fcc625a0f38ea992be92288996a24ab10274f8ba /test/task_test.rb | |
| parent | ee5c39963760ba3883189266aa4544ef0e838129 (diff) | |
| download | hcl-087da79f8c4135acc19a71822295c328c0d57a5a.tar.bz2 | |
test_helper: fakeweb test helper
Diffstat (limited to 'test/task_test.rb')
| -rw-r--r-- | test/task_test.rb | 20 | 
1 files changed, 8 insertions, 12 deletions
| diff --git a/test/task_test.rb b/test/task_test.rb index 47393e8..3deb620 100644 --- a/test/task_test.rb +++ b/test/task_test.rb @@ -21,30 +21,26 @@ class TaskTest < HCl::TestCase    def test_add      task = HCl::Task.new(id:1, project:HCl::Project.new({id:2})) -    FakeWeb.register_uri(:post, %r{/daily/add$}, -                         body: Yajl::Encoder.encode(note:'good stuff', -                                hours:0.2, project_id:2, task_id:1, spent_at: Date.today)) +    register_uri(:post, '/daily/add', { +      note:'good stuff', hours:0.2, project_id:2, task_id:1, spent_at: Date.today})      entry = task.add(note:'good stuff', starting_time:0.2)      assert_equal 'good stuff', entry.note    end    def test_start_running      task = HCl::Task.new(id:1, project:HCl::Project.new({id:2})) -    FakeWeb.register_uri(:post, %r{/daily/add$}, -                         body: Yajl::Encoder.encode(note:'good stuff', -                                timer_started_at:DateTime.now, -                                hours:0.2, project_id:2, task_id:1, spent_at: Date.today)) +    register_uri(:post, '/daily/add', { +      note:'good stuff', timer_started_at:DateTime.now, +      hours:0.2, project_id:2, task_id:1, spent_at: Date.today})      entry = task.start(note:'good stuff', starting_time:0.2)      assert_equal 'good stuff', entry.note    end    def test_start_then_toggle      task = HCl::Task.new(id:1, project:HCl::Project.new({id:2})) -    FakeWeb.register_uri(:post, %r{/daily/add$}, -                         body: Yajl::Encoder.encode(id:123, note:'woot')) -    FakeWeb.register_uri(:get, %r{/daily/timer/123$}, -                         body: Yajl::Encoder.encode(note:'good stuff', -                                hours:0.2, project_id:2, task_id:1, spent_at: Date.today)) +    register_uri(:post, '/daily/add', {id:123, note:'woot'}) +    register_uri(:get, '/daily/timer/123', {note:'good stuff', hours:0.2, +                                            project_id:2, task_id:1, spent_at: Date.today})      entry = task.start(note:'good stuff', starting_time:0.2)      assert_equal 'good stuff', entry.note    end | 
