mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix namespaces
This commit is contained in:
parent
99d8f2a845
commit
7e3b3cd999
3 changed files with 7 additions and 7 deletions
|
@ -70,11 +70,11 @@ module Spectator::DSL
|
||||||
# The raw block can't be used because it's not clear to the user.
|
# The raw block can't be used because it's not clear to the user.
|
||||||
{% method_name = block.body.id.split('.')[1..-1].join('.') %}
|
{% method_name = block.body.id.split('.')[1..-1].join('.') %}
|
||||||
%partial = %proc.partial(subject)
|
%partial = %proc.partial(subject)
|
||||||
test_block = ::Spectator::Expectations::TestBlock.new({{"#" + method_name}}, %partial)
|
test_block = ::Spectator::TestBlock.new({{"#" + method_name}}, %partial)
|
||||||
{% else %}
|
{% else %}
|
||||||
# In this case, it looks like the short-hand method syntax wasn't used.
|
# In this case, it looks like the short-hand method syntax wasn't used.
|
||||||
# Just drop in the proc as-is.
|
# Just drop in the proc as-is.
|
||||||
test_block = ::Spectator::Expectations::TestBlock.new({{"`" + block.body.stringify + "`"}}, %proc)
|
test_block = ::Spectator::TestBlock.new({{"`" + block.body.stringify + "`"}}, %proc)
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
||||||
source = ::Spectator::Source.new({{_source_file}}, {{_source_line}})
|
source = ::Spectator::Source.new({{_source_file}}, {{_source_line}})
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Object
|
||||||
# However, since this isn't a macro and we can't "look behind" this method call
|
# However, since this isn't a macro and we can't "look behind" this method call
|
||||||
# to see what it was invoked on, the argument is an empty string.
|
# to see what it was invoked on, the argument is an empty string.
|
||||||
# Additionally, the source file and line can't be obtained.
|
# Additionally, the source file and line can't be obtained.
|
||||||
actual = ::Spectator::Expectations::TestValue.new(self)
|
actual = ::Spectator::TestValue.new(self)
|
||||||
source = ::Spectator::Source.new(__FILE__, __LINE__)
|
source = ::Spectator::Source.new(__FILE__, __LINE__)
|
||||||
::Spectator::Expectations::ExpectationPartial.new(actual, source).to(matcher)
|
::Spectator::Expectations::ExpectationPartial.new(actual, source).to(matcher)
|
||||||
end
|
end
|
||||||
|
@ -29,7 +29,7 @@ class Object
|
||||||
# Works the same as `#should` except the condition is inverted.
|
# Works the same as `#should` except the condition is inverted.
|
||||||
# When `#should` succeeds, this method will fail, and vice-versa.
|
# When `#should` succeeds, this method will fail, and vice-versa.
|
||||||
def should_not(matcher : ::Spectator::Matchers::Matcher)
|
def should_not(matcher : ::Spectator::Matchers::Matcher)
|
||||||
actual = ::Spectator::Expectations::TestValue.new(self)
|
actual = ::Spectator::TestValue.new(self)
|
||||||
source = ::Spectator::Source.new(__FILE__, __LINE__)
|
source = ::Spectator::Source.new(__FILE__, __LINE__)
|
||||||
::Spectator::Expectations::ExpectationPartial.new(actual, source).to_not(matcher)
|
::Spectator::Expectations::ExpectationPartial.new(actual, source).to_not(matcher)
|
||||||
end
|
end
|
||||||
|
@ -39,7 +39,7 @@ struct Proc(*T, R)
|
||||||
# Extension method to create an expectation for a block of code (proc).
|
# Extension method to create an expectation for a block of code (proc).
|
||||||
# Depending on the matcher, the proc may be executed multiple times.
|
# Depending on the matcher, the proc may be executed multiple times.
|
||||||
def should(matcher : ::Spectator::Matchers::Matcher)
|
def should(matcher : ::Spectator::Matchers::Matcher)
|
||||||
actual = ::Spectator::Expectations::TestBlock.new(self)
|
actual = ::Spectator::TestBlock.new(self)
|
||||||
source = ::Spectator::Source.new(__FILE__, __LINE__)
|
source = ::Spectator::Source.new(__FILE__, __LINE__)
|
||||||
::Spectator::Expectations::ExpectationPartial.new(actual, source).to(matcher)
|
::Spectator::Expectations::ExpectationPartial.new(actual, source).to(matcher)
|
||||||
end
|
end
|
||||||
|
@ -47,7 +47,7 @@ struct Proc(*T, R)
|
||||||
# Works the same as `#should` except the condition is inverted.
|
# Works the same as `#should` except the condition is inverted.
|
||||||
# When `#should` succeeds, this method will fail, and vice-versa.
|
# When `#should` succeeds, this method will fail, and vice-versa.
|
||||||
def should_not(matcher : ::Spectator::Matchers::Matcher)
|
def should_not(matcher : ::Spectator::Matchers::Matcher)
|
||||||
actual = ::Spectator::Expectations::TestBlock.new(self)
|
actual = ::Spectator::TestBlock.new(self)
|
||||||
source = ::Spectator::Source.new(__FILE__, __LINE__)
|
source = ::Spectator::Source.new(__FILE__, __LINE__)
|
||||||
::Spectator::Expectations::BlockExpectationPartial.new(actual, source).to_not(matcher)
|
::Spectator::Expectations::BlockExpectationPartial.new(actual, source).to_not(matcher)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Spectator::Expectations
|
module Spectator
|
||||||
# Base type for capturing an expression from a test.
|
# Base type for capturing an expression from a test.
|
||||||
abstract struct TestExpression
|
abstract struct TestExpression
|
||||||
# User-friendly string displayed for the actual expression being tested.
|
# User-friendly string displayed for the actual expression being tested.
|
||||||
|
|
Loading…
Reference in a new issue