mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add RSpec cover
matcher spec
This commit is contained in:
parent
5673144527
commit
7868755eee
1 changed files with 30 additions and 0 deletions
30
spec/rspec/expectations/cover_matcher_spec.cr
Normal file
30
spec/rspec/expectations/cover_matcher_spec.cr
Normal file
|
@ -0,0 +1,30 @@
|
|||
require "../../spec_helper"
|
||||
|
||||
# Examples taken from:
|
||||
# https://relishapp.com/rspec/rspec-expectations/v/3-8/docs/built-in-matchers/cover-matcher
|
||||
# and modified to fit Spectator and Crystal.
|
||||
Spectator.describe "`cover` matcher" do
|
||||
context "range usage" do
|
||||
describe (1..10) do
|
||||
it { is_expected.to cover(4) }
|
||||
it { is_expected.to cover(6) }
|
||||
it { is_expected.to cover(8) }
|
||||
it { is_expected.to cover(4, 6) }
|
||||
it { is_expected.to cover(4, 6, 8) }
|
||||
it { is_expected.not_to cover(11) }
|
||||
it { is_expected.not_to cover(11, 12) }
|
||||
|
||||
# deliberate failures
|
||||
# TODO: Add support for expected failures.
|
||||
xit { is_expected.to cover(11) }
|
||||
xit { is_expected.not_to cover(4) }
|
||||
xit { is_expected.not_to cover(6) }
|
||||
xit { is_expected.not_to cover(8) }
|
||||
xit { is_expected.not_to cover(4, 6, 8) }
|
||||
|
||||
# both of these should fail since it covers 5 but not 11
|
||||
xit { is_expected.to cover(5, 11) }
|
||||
xit { is_expected.not_to cover(5, 11) }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue