summaryrefslogtreecommitdiffstats
path: root/test/task_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/task_test.rb')
-rw-r--r--test/task_test.rb20
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