From ffca0316a45706dadb09de55f16f620d36d723a3 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sun, 17 Feb 2019 12:32:15 -0700 Subject: [PATCH] Add spec for source class --- spec/source_spec.cr | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 spec/source_spec.cr diff --git a/spec/source_spec.cr b/spec/source_spec.cr new file mode 100644 index 0000000..847f259 --- /dev/null +++ b/spec/source_spec.cr @@ -0,0 +1,28 @@ +require "./spec_helper" + +describe Spectator::Source do + describe "#file" do + it "is the expected value" do + file = __FILE__ + source = Spectator::Source.new(file, __LINE__) + source.file.should eq(file) + end + end + + describe "#line" do + it "is the expected value" do + line = __LINE__ + source = Spectator::Source.new(__FILE__, line) + source.line.should eq(line) + end + end + + describe "#to_s" do + it "is formatted correctly" do + file = __FILE__ + line = __LINE__ + source = Spectator::Source.new(file, line) + source.to_s.should eq("#{file}:#{line}") + end + end +end