mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add RSpec match
matcher spec
This commit is contained in:
parent
f11b548f4e
commit
6a0a73ca76
1 changed files with 30 additions and 0 deletions
30
spec/rspec/expectations/match_matcher_spec.cr
Normal file
30
spec/rspec/expectations/match_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/match-matcher
|
||||||
|
# and modified to fit Spectator and Crystal.
|
||||||
|
Spectator.describe "`match` matcher" do
|
||||||
|
context "string usage" do
|
||||||
|
describe "a string" do
|
||||||
|
it { is_expected.to match(/str/) }
|
||||||
|
it { is_expected.not_to match(/foo/) }
|
||||||
|
|
||||||
|
# deliberate failures
|
||||||
|
# TODO: Add support for expected failures.
|
||||||
|
xit { is_expected.not_to match(/str/) }
|
||||||
|
xit { is_expected.to match(/foo/) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "regular expression usage" do
|
||||||
|
describe /foo/ do
|
||||||
|
it { is_expected.to match("food") }
|
||||||
|
it { is_expected.not_to match("drinks") }
|
||||||
|
|
||||||
|
# deliberate failures
|
||||||
|
# TODO: Add support for expected failures.
|
||||||
|
xit { is_expected.not_to match("food") }
|
||||||
|
xit { is_expected.to match("drinks") }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue