From 0e3581420a697c40ae91c2ad92884cd8e1eebe03 Mon Sep 17 00:00:00 2001 From: Zack Hobson Date: Sun, 22 Dec 2013 17:07:49 -0800 Subject: remove xml processing code --- test/day_entry_test.rb | 32 ------------------------- test/task_test.rb | 63 +++++++++----------------------------------------- 2 files changed, 11 insertions(+), 84 deletions(-) (limited to 'test') diff --git a/test/day_entry_test.rb b/test/day_entry_test.rb index 581b22b..1df4cba 100644 --- a/test/day_entry_test.rb +++ b/test/day_entry_test.rb @@ -19,38 +19,6 @@ class DayEntryTest < HCl::TestCase assert_equal "Taco Town - Pizza Taco - Preparation (1:12)", entry.to_s end - def test_from_xml - entries = HCl::DayEntry.from_xml(<<-EOD) - - Wed, 18 Oct 2006 - - - 195168 - Iridesco - Harvest - Backend Programming - 2.06 - Test api support - - Wed, 18 Oct 2006 09:53:06 -0000 - - Wed, 18 Oct 2006 09:53:06 -0000 - - - - EOD - assert_equal 1, entries.size - { - :project => 'Harvest', - :client => 'Iridesco', - :task => 'Backend Programming', - :notes => 'Test api support', - :hours => '2.06', - }.each do |method, value| - assert_equal value, entries.first.send(method) - end - end - def test_append_note entry = HCl::DayEntry.new(:id => '1', :notes => 'yourmom.', :hours => '1.0') HCl::DayEntry.stubs(:post) diff --git a/test/task_test.rb b/test/task_test.rb index f5c30b8..bbdce89 100644 --- a/test/task_test.rb +++ b/test/task_test.rb @@ -1,61 +1,20 @@ class TaskTest < HCl::TestCase - DAILY_ENTRY = %{ - Wed, 18 Oct 2006 - - - 195168 - Iridesco - Harvest - Backend Programming - 2.06 - Test api support - - Wed, 18 Oct 2006 09:53:06 -0000 - - Wed, 18 Oct 2006 09:53:06 -0000 - - - } - - def test_add_task - task = HCl::Task.new(id:456, project:HCl::Project.new(id:123)) - Date.expects(:today).returns('now') - HCl::Task.expects(:post).with('daily/add', <<-EOT).returns(DAILY_ENTRY) - - hi world - 0.5 - 123 - 456 - now - - EOT - task.add note:'hi world', starting_time:0.5 - end def test_cache_file assert_equal "#{HCl::App::HCL_DIR}/cache/tasks.yml", HCl::Task.cache_file end - def test_cache_tasks - HCl::Task.cache_tasks(REXML::Document.new(<<-EOD)) - - - - Click and Type - - 3 - AFS - - - Security support - 14 - true - - - - - - EOD + def test_cache_tasks_hash + HCl::Task.cache_tasks_hash({ projects: [{ + name: "Click and Type", + id: 3, + client: "AFS", + tasks: [{ + name: "Security support", + id: 14, + billable: true + }] + }]}) assert_equal 1, HCl::Task.all.size assert_equal 'Security support', HCl::Task.all.first.name end -- cgit v1.2.3