Add tests for source file and line

This commit is contained in:
Michael Miller 2019-02-14 19:35:42 -07:00
parent 1507a447c8
commit 88c32b697b
2 changed files with 34 additions and 0 deletions

View file

@ -38,6 +38,24 @@ describe Spectator::Expectations::BlockExpectationPartial do
end
end
describe "#source_file" do
it "is the expected value" do
block = ->{ 42 }
file = __FILE__
partial = Spectator::Expectations::BlockExpectationPartial.new(block, file, __LINE__)
partial.source_file.should eq(file)
end
end
describe "#source_line" do
it "is the expected value" do
block = ->{ 42 }
line = __LINE__
partial = Spectator::Expectations::BlockExpectationPartial.new(block, __FILE__, line)
partial.source_line.should eq(line)
end
end
describe "#to" do
it "reports an expectation" do
spy = SpyExample.create do

View file

@ -38,6 +38,22 @@ describe Spectator::Expectations::ValueExpectationPartial do
end
end
describe "#source_file" do
it "is the expected value" do
file = __FILE__
partial = Spectator::Expectations::ValueExpectationPartial.new(42, file, __LINE__)
partial.source_file.should eq(file)
end
end
describe "#source_line" do
it "is the expected value" do
line = __LINE__
partial = Spectator::Expectations::ValueExpectationPartial.new(42, __FILE__, line)
partial.source_line.should eq(line)
end
end
describe "#to" do
it "reports an expectation" do
spy = SpyExample.create do