summaryrefslogtreecommitdiff
path: root/test/test_timetrackr.rb
diff options
context:
space:
mode:
authorfelix <felix@seconddrawer.com.au>2011-05-17 03:05:50 +0000
committerfelix <felix@seconddrawer.com.au>2011-05-17 03:05:50 +0000
commitbf075fccc131d1cbda02328241251fb7b680cb58 (patch)
treedd790851e1b678c73a1b76447ce31d121efa8040 /test/test_timetrackr.rb
parentb9127b0e4ac187074a5c99fa4d29dc6ac726e3ff (diff)
downloadtimetrackr-bf075fccc131d1cbda02328241251fb7b680cb58.tar.gz
timetrackr-bf075fccc131d1cbda02328241251fb7b680cb58.tar.bz2
sqlite tests
Diffstat (limited to 'test/test_timetrackr.rb')
-rw-r--r--test/test_timetrackr.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/test_timetrackr.rb b/test/test_timetrackr.rb
index 0c8a526..07589a4 100644
--- a/test/test_timetrackr.rb
+++ b/test/test_timetrackr.rb
@@ -50,4 +50,46 @@ class TestTimetrackr < Test::Unit::TestCase
end
end
+
+ context 'an Sqlite based tracker' do
+ setup do
+ @config = {:path => '/tmp/timetracker.test'}
+ @t = TimeTrackr.create('sqlite',@config)
+ end
+
+ def teardown
+ File.unlink(@config[:path]) rescue nil
+ end
+
+ should 'initialise a log file' do
+ assert File.exist?(@config[:path])
+ end
+
+ context 'with empty db' do
+ setup do
+ File.open(@config[:path]) do |fh|
+ @db = YAML.load(fh)
+ end
+ end
+
+ should 'not fail on current command' do
+ assert_nothing_raised Exception do
+ @t.current
+ end
+ end
+
+ should 'not fail on tasks command' do
+ assert_nothing_raised Exception do
+ @t.tasks
+ end
+ end
+
+ should 'not fail on close command' do
+ assert_nothing_raised Exception do
+ @t.close
+ end
+ end
+
+ end
+ end
end