Reorganize some specs

This commit is contained in:
Michael Miller 2021-10-09 13:39:44 -06:00
parent 36354082c7
commit 9d4a5886e5
No known key found for this signature in database
GPG key ID: F9A0C5C65B162436
5 changed files with 3 additions and 3 deletions

View file

@ -0,0 +1,32 @@
require "../spec_helper"
Spectator.describe Spectator do
let(current_example) { ::Spectator::Example.current }
subject(location) { current_example.location }
context "line numbers" do
it "contains starting line of spec" do
expect(location.line).to eq(__LINE__ - 1)
end
it "contains ending line of spec" do
expect(location.end_line).to eq(__LINE__ + 1)
end
it "handles multiple lines and examples" do
# Offset is important.
expect(location.line).to eq(__LINE__ - 2)
# This line fails, refer to https://github.com/crystal-lang/crystal/issues/10562
# expect(location.end_line).to eq(__LINE__ + 2)
# Offset is still important.
end
end
context "file names" do
subject { location.file }
it "match source code" do
is_expected.to eq(__FILE__)
end
end
end