mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix types of arguments given to common object methods
This commit is contained in:
parent
0fb7be6722
commit
0b6e44c227
3 changed files with 17 additions and 11 deletions
|
@ -142,6 +142,7 @@ Spectator.describe Spectator::Double do
|
|||
end
|
||||
|
||||
it "responds with defined messages" do
|
||||
hasher = Crystal::Hasher.new
|
||||
aggregate_failures do
|
||||
expect(dbl.!=(42)).to eq("!=")
|
||||
expect(dbl.!~(42)).to eq("!~")
|
||||
|
@ -150,9 +151,9 @@ Spectator.describe Spectator::Double do
|
|||
expect(dbl.=~(42)).to eq("=~")
|
||||
expect(dbl.class).to eq("class")
|
||||
expect(dbl.dup).to eq("dup")
|
||||
expect(dbl.hash(42)).to eq("hash")
|
||||
expect(dbl.hash(hasher)).to eq("hash")
|
||||
expect(dbl.hash).to eq("hash")
|
||||
expect(dbl.in?(42)).to eq(true)
|
||||
expect(dbl.in?([42])).to eq(true)
|
||||
expect(dbl.in?(1, 2, 3)).to eq(true)
|
||||
expect(dbl.inspect).to eq("inspect")
|
||||
expect(dbl.itself).to eq("itself")
|
||||
|
@ -181,6 +182,7 @@ Spectator.describe Spectator::Double do
|
|||
it "raises with undefined messages" do
|
||||
io = IO::Memory.new
|
||||
pp = PrettyPrint.new(io)
|
||||
hasher = Crystal::Hasher.new
|
||||
aggregate_failures do
|
||||
expect { dbl.!=(42) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.!~(42) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
|
@ -189,9 +191,9 @@ Spectator.describe Spectator::Double do
|
|||
expect { dbl.=~(42) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.class }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.dup }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.hash(42) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.hash(hasher) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.hash }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.in?(42) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.in?([42]) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.in?(1, 2, 3) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.inspect }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.itself }.to raise_error(Spectator::UnexpectedMessage)
|
||||
|
|
|
@ -86,6 +86,7 @@ Spectator.describe Spectator::LazyDouble do
|
|||
end
|
||||
|
||||
it "responds with defined messages" do
|
||||
hasher = Crystal::Hasher.new
|
||||
aggregate_failures do
|
||||
expect(dbl.!=(42)).to eq("!=")
|
||||
expect(dbl.!~(42)).to eq("!~")
|
||||
|
@ -94,9 +95,9 @@ Spectator.describe Spectator::LazyDouble do
|
|||
expect(dbl.=~(42)).to eq("=~")
|
||||
expect(dbl.class).to eq("class")
|
||||
expect(dbl.dup).to eq("dup")
|
||||
expect(dbl.hash(42)).to eq("hash")
|
||||
expect(dbl.hash(hasher)).to eq("hash")
|
||||
expect(dbl.hash).to eq("hash")
|
||||
expect(dbl.in?(42)).to eq(true)
|
||||
expect(dbl.in?([42])).to eq(true)
|
||||
expect(dbl.in?(1, 2, 3)).to eq(true)
|
||||
expect(dbl.inspect).to eq("inspect")
|
||||
expect(dbl.itself).to eq("itself")
|
||||
|
@ -125,6 +126,7 @@ Spectator.describe Spectator::LazyDouble do
|
|||
it "raises with undefined messages" do
|
||||
io = IO::Memory.new
|
||||
pp = PrettyPrint.new(io)
|
||||
hasher = Crystal::Hasher.new
|
||||
aggregate_failures do
|
||||
expect { dbl.!=(42) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.!~(42) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
|
@ -133,9 +135,9 @@ Spectator.describe Spectator::LazyDouble do
|
|||
expect { dbl.=~(42) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.class }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.dup }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.hash(42) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.hash(hasher) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.hash }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.in?(42) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.in?([42]) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.in?(1, 2, 3) }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.inspect }.to raise_error(Spectator::UnexpectedMessage)
|
||||
expect { dbl.itself }.to raise_error(Spectator::UnexpectedMessage)
|
||||
|
|
|
@ -124,6 +124,7 @@ Spectator.describe Spectator::NullDouble do
|
|||
end
|
||||
|
||||
it "responds with defined messages" do
|
||||
hasher = Crystal::Hasher.new
|
||||
aggregate_failures do
|
||||
expect(dbl.!=(42)).to eq("!=")
|
||||
expect(dbl.!~(42)).to eq("!~")
|
||||
|
@ -132,9 +133,9 @@ Spectator.describe Spectator::NullDouble do
|
|||
expect(dbl.=~(42)).to eq("=~")
|
||||
expect(dbl.class).to eq("class")
|
||||
expect(dbl.dup).to eq("dup")
|
||||
expect(dbl.hash(42)).to eq("hash")
|
||||
expect(dbl.hash(hasher)).to eq("hash")
|
||||
expect(dbl.hash).to eq("hash")
|
||||
expect(dbl.in?(42)).to eq(true)
|
||||
expect(dbl.in?([42])).to eq(true)
|
||||
expect(dbl.in?(1, 2, 3)).to eq(true)
|
||||
expect(dbl.inspect).to eq("inspect")
|
||||
expect(dbl.itself).to eq("itself")
|
||||
|
@ -161,6 +162,7 @@ Spectator.describe Spectator::NullDouble do
|
|||
subject(dbl) { EmptyDouble.new }
|
||||
|
||||
it "returns self with undefined messages" do
|
||||
hasher = Crystal::Hasher.new
|
||||
aggregate_failures do
|
||||
# Methods that would cause type cast errors are omitted from this list.
|
||||
expect_null_double(dbl, dbl.!=(42))
|
||||
|
@ -170,7 +172,7 @@ Spectator.describe Spectator::NullDouble do
|
|||
expect_null_double(dbl, dbl.=~(42))
|
||||
expect_null_double(dbl, dbl.class)
|
||||
expect_null_double(dbl, dbl.dup)
|
||||
expect_null_double(dbl, dbl.hash(42))
|
||||
expect_null_double(dbl, dbl.hash(hasher))
|
||||
expect_null_double(dbl, dbl.hash)
|
||||
expect_null_double(dbl, dbl.itself)
|
||||
expect_null_double(dbl, dbl.not_nil!)
|
||||
|
|
Loading…
Reference in a new issue