Add validation

This commit is contained in:
2019-11-06 21:05:46 +03:00
parent 81da30fb01
commit 0f01d2ad01
3 changed files with 31 additions and 1 deletions

View File

@ -74,5 +74,25 @@ module Dayoff::Test
expected = 8 * 3 - 10 * 2
expected.should eq span.total_hours
end
it "not start twice" do
prof = create_profile
start_time = t(3, 10, 0)
prof.start start_time
expect_raises(AlreadyStarted) do
prof.start start_time
end
end
it "not finish twice" do
prof = create_profile
start_time = t(3, 10, 0)
finish_time = t(3, 20, 0)
prof.start start_time
prof.finish finish_time
expect_raises(StartedRecordNotFound) do
prof.finish finish_time
end
end
end
end