mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add comparison tests from RSpec docs
This commit is contained in:
parent
71740113d5
commit
7f8d9d5ef3
1 changed files with 47 additions and 0 deletions
47
spec/rspec/expectations/comparison_matchers_spec.cr
Normal file
47
spec/rspec/expectations/comparison_matchers_spec.cr
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
require "../../spec_helper"
|
||||||
|
|
||||||
|
# Examples taken from:
|
||||||
|
# https://relishapp.com/rspec/rspec-expectations/v/3-8/docs/built-in-matchers/comparison-matchers
|
||||||
|
# and modified to fit Spectator and Crystal.
|
||||||
|
Spectator.describe "Comparison matchers" do
|
||||||
|
context "numeric operator matchers" do
|
||||||
|
describe 18 do
|
||||||
|
it { is_expected.to be < 20 }
|
||||||
|
it { is_expected.to be > 15 }
|
||||||
|
it { is_expected.to be <= 19 }
|
||||||
|
it { is_expected.to be >= 17 }
|
||||||
|
|
||||||
|
# deliberate failures
|
||||||
|
# TODO: Add support for expected failures.
|
||||||
|
xit { is_expected.to be < 15 }
|
||||||
|
xit { is_expected.to be > 20 }
|
||||||
|
xit { is_expected.to be <= 17 }
|
||||||
|
xit { is_expected.to be >= 19 }
|
||||||
|
# it { is_expected.to be < 'a' } # Removed because Crystal doesn't support Int32#<(Char)
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'a' do
|
||||||
|
it { is_expected.to be < 'b' }
|
||||||
|
|
||||||
|
# deliberate failures
|
||||||
|
# TODO: Add support for expected failures.
|
||||||
|
# it { is_expected.to be < 18 } # Removed because Crystal doesn't support Char#<(Int32)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "string operator matchers" do
|
||||||
|
describe "Strawberry" do
|
||||||
|
it { is_expected.to be < "Tomato" }
|
||||||
|
it { is_expected.to be > "Apple" }
|
||||||
|
it { is_expected.to be <= "Turnip" }
|
||||||
|
it { is_expected.to be >= "Banana" }
|
||||||
|
|
||||||
|
# deliberate failures
|
||||||
|
# TODO: Add support for expected failures.
|
||||||
|
xit { is_expected.to be < "Cranberry" }
|
||||||
|
xit { is_expected.to be > "Zuchini" }
|
||||||
|
xit { is_expected.to be <= "Potato" }
|
||||||
|
xit { is_expected.to be >= "Tomato" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue