mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add tests for equality matcher
This commit is contained in:
parent
681f978df0
commit
9f91e3a266
2 changed files with 96 additions and 0 deletions
32
spec/matchers/equality_matcher_spec.cr
Normal file
32
spec/matchers/equality_matcher_spec.cr
Normal file
|
@ -0,0 +1,32 @@
|
|||
require "../spec_helper"
|
||||
|
||||
Spectator.describe "eq matcher" do
|
||||
it "is true for equal values" do
|
||||
expect(42).to eq(42)
|
||||
end
|
||||
|
||||
it "is false for inequal values" do
|
||||
expect(42).to_not eq(24)
|
||||
end
|
||||
|
||||
it "is true for identical references" do
|
||||
string = "foobar"
|
||||
expect(string).to eq(string)
|
||||
end
|
||||
|
||||
it "is false for different references" do
|
||||
string1 = "foo"
|
||||
string2 = "bar"
|
||||
expect(string1).to_not eq(string2)
|
||||
end
|
||||
|
||||
double(:fake) do
|
||||
stub instance.==(other) { true }
|
||||
end
|
||||
|
||||
it "uses the == operator" do
|
||||
dbl = double(:fake)
|
||||
expect(42).to eq(dbl)
|
||||
expect(dbl).to have_received(:==).with(42).once
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue