Skip to content

Commit

Permalink
Add new unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbata committed Oct 4, 2020
1 parent 9f94d7f commit 6fc8f47
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/test_todo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ def test_start
assert_equal(" 1: \e[32m[>]\e[0m Buy Milk\n", $stdout.string)
end

def test_reset
read ['start', '1']
$stdout = StringIO.new
read ['reset', '1']
assert_match(
/{"state":"new","title":"Buy Milk","modified":"\d{4}-\d{2}-\d{2}"}\n/,
File.read(@todo_file)
)
assert_equal(" 1: \e[37m[ ]\e[0m Buy Milk\n", $stdout.string)
end

def test_start_not_existing_todo
$stdout = StringIO.new
read ['start', '2']
Expand Down

0 comments on commit 6fc8f47

Please sign in to comment.