mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add should
keywords to examples
Allows short-hand like: it { should be_empty }
This commit is contained in:
parent
8381c08b05
commit
b1984b343a
2 changed files with 19 additions and 4 deletions
|
@ -11,8 +11,7 @@ Spectator.describe "One-liner syntax" do
|
|||
# subject.should be_empty
|
||||
# end
|
||||
|
||||
# TODO: Define `should` method on example to be `is_expected`.
|
||||
# it { should be_empty }
|
||||
it { should be_empty }
|
||||
# or
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
@ -22,8 +21,8 @@ Spectator.describe "One-liner syntax" do
|
|||
describe Array(Int32) do
|
||||
describe "with 3 items" do
|
||||
subject { [1, 2, 3] }
|
||||
# TODO: Define `should_not` method on example to be `is_expected.not_to`.
|
||||
# it { should_not be_empty }
|
||||
|
||||
it { should_not be_empty }
|
||||
# or
|
||||
it { is_expected.not_to be_empty }
|
||||
end
|
||||
|
|
|
@ -184,6 +184,22 @@ module Spectator
|
|||
is_expected.to_not eq({{expected}})
|
||||
end
|
||||
|
||||
macro should(matcher)
|
||||
is_expected.to({{matcher}})
|
||||
end
|
||||
|
||||
macro should_not(matcher)
|
||||
is_expected.to_not({{matcher}})
|
||||
end
|
||||
|
||||
macro should_eventuall(matcher)
|
||||
is_expected.to_eventually({{matcher}})
|
||||
end
|
||||
|
||||
macro should_never(matcher)
|
||||
is_expected.to_never({{matcher}})
|
||||
end
|
||||
|
||||
# Immediately fail the current test.
|
||||
# A reason can be passed,
|
||||
# which is reported in the output.
|
||||
|
|
Loading…
Reference in a new issue