diff options
| author | Zack Hobson | 2013-12-27 13:34:14 -0800 |
|---|---|---|
| committer | Zack Hobson | 2013-12-27 13:34:14 -0800 |
| commit | 4e6cf745e5d8426f1470c26f705bacbad1514e91 (patch) | |
| tree | 2e6d7b2882e6a6208ed47de848ee641dd80ad227 /test | |
| parent | 8e2e788909c6a634976c80eeb75c79af8f8ab734 (diff) | |
| download | hcl-4e6cf745e5d8426f1470c26f705bacbad1514e91.tar.bz2 | |
non-global API for net access
Diffstat (limited to 'test')
| -rw-r--r-- | test/command_test.rb | 8 | ||||
| -rw-r--r-- | test/day_entry_test.rb | 14 |
2 files changed, 11 insertions, 11 deletions
diff --git a/test/command_test.rb b/test/command_test.rb index a0cdca1..2e2812f 100644 --- a/test/command_test.rb +++ b/test/command_test.rb @@ -91,15 +91,15 @@ class CommandTest < HCl::TestCase def test_resume_with_task_alias entry = stub expects(:get_task_ids).with('mytask',[]).returns(%w[ 456 789 ]) - HCl::DayEntry.expects(:last_by_task).with('456', '789').returns(entry) - entry.expects(:toggle) + HCl::DayEntry.expects(:last_by_task).with(http, '456', '789').returns(entry) + entry.expects(:toggle).with(http) resume 'mytask' end def test_cancel entry = stub - HCl::DayEntry.expects(:with_timer).returns(entry) - entry.expects(:cancel).returns(true) + HCl::DayEntry.expects(:with_timer).with(http).returns(entry) + entry.expects(:cancel).with(http).returns(true) cancel end diff --git a/test/day_entry_test.rb b/test/day_entry_test.rb index a685bc0..fd8543a 100644 --- a/test/day_entry_test.rb +++ b/test/day_entry_test.rb @@ -4,22 +4,22 @@ class DayEntryTest < HCl::TestCase def test_project_info register_uri(:get, '/daily', {projects:[], day_entries:[{project_id:123}]}) register_uri(:get, '/projects/123', {project:{name:'fun times'}}) - assert_equal 'fun times', HCl::DayEntry.today.first.project_info.name + assert_equal 'fun times', HCl::DayEntry.today(http).first.project_info(http).name end def test_all_today_empty register_uri(:get, '/daily', {projects:[],day_entries:[]}) - assert HCl::DayEntry.today.empty? + assert HCl::DayEntry.today(http).empty? end def test_all_today register_uri(:get, '/daily', {projects:[], day_entries:[{id:1,note:'hi'}]}) - assert_equal 'hi', HCl::DayEntry.today.first.note + assert_equal 'hi', HCl::DayEntry.today(http).first.note end def test_all_with_date register_uri(:get, '/daily/013/2013', {projects:[], day_entries:[{id:1,note:'hi'}]}) - assert_equal 'hi', HCl::DayEntry.daily(Date.civil(2013,1,13)).first.note + assert_equal 'hi', HCl::DayEntry.daily(http,Date.civil(2013,1,13)).first.note end def test_toggle @@ -36,7 +36,7 @@ class DayEntryTest < HCl::TestCase def test_cancel_failure entry = HCl::DayEntry.new(id:123) - HCl::Net.expects(:delete).raises(HCl::HarvestMiddleware::Failure) + http.expects(:delete).raises(HCl::HarvestMiddleware::Failure) assert !entry.cancel(http) end @@ -48,14 +48,14 @@ class DayEntryTest < HCl::TestCase def test_append_note entry = HCl::DayEntry.new(:id => '1', :notes => 'yourmom.', :hours => '1.0') - HCl::Net.stubs(:post) + http.stubs(:post) entry.append_note(http, 'hi world') assert_equal "yourmom.\nhi world", entry.notes end def test_append_note_to_empty entry = HCl::DayEntry.new(:id => '1', :notes => nil, :hours => '1.0') - HCl::Net.stubs(:post) + http.stubs(:post) entry.append_note(http, 'hi world') assert_equal 'hi world', entry.notes end |
