git-timecost/spec/range_spec.cr

64 lines
1.4 KiB
Crystal

require "./spec_helper"
require "../src/timecost/range"
describe TimeCost::Range do
epsilon = 0.5
overlap_time = (epsilon / 2).hours
separate_time = (epsilon * 2).hours
author = TimeCost::Author.new(
name: "Jon Snow",
email: "jon.snow@example.com"
)
commit_base = TimeCost::Commit.new(
commit_hash: Random::Secure.base64(40),
author: author,
datetime: Time.utc,
)
commit_overlap_before = TimeCost::Commit.new(
commit_hash: Random::Secure.base64(40),
author: author,
datetime: Time.utc - overlap_time,
)
commit_overlap_after = TimeCost::Commit.new(
commit_hash: Random::Secure.base64(40),
author: author,
datetime: Time.utc + overlap_time,
)
commit_separate_before = TimeCost::Commit.new(
commit_hash: Random::Secure.base64(40),
author: author,
datetime: Time.utc - separate_time,
)
commit_separate_after = TimeCost::Commit.new(
commit_hash: Random::Secure.base64(40),
author: author,
datetime: Time.utc + separate_time,
)
rangeA = TimeCost::Range.new(
commit: commit_base,
epsilon: epsilon
)
describe ".new" do
it "can be created from " do
assert_instance_of TimeCost::Range, rangeA
end
end
describe ".overlap?" do
it "must respond to .overlap?" do
end
it "must return false when ranges are not overlapping" do
end
it "must return true when ranges are overlapping" do
end
end
end