mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add specs of snippets from docs
This commit is contained in:
parent
0322d5bd28
commit
5c24d606dd
7 changed files with 382 additions and 0 deletions
34
spec/docs/structure_spec.cr
Normal file
34
spec/docs/structure_spec.cr
Normal file
|
@ -0,0 +1,34 @@
|
|||
require "../spec_helper"
|
||||
|
||||
Spectator.describe String do
|
||||
let(normal_string) { "foobar" }
|
||||
let(empty_string) { "" }
|
||||
|
||||
describe "#empty?" do
|
||||
subject { string.empty? }
|
||||
|
||||
context "when empty" do
|
||||
let(string) { empty_string }
|
||||
|
||||
it "is true" do
|
||||
is_expected.to be_true
|
||||
end
|
||||
end
|
||||
|
||||
context "when not empty" do
|
||||
let(string) { normal_string }
|
||||
|
||||
it "is false" do
|
||||
is_expected.to be_false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Spectator.describe Bytes do
|
||||
it "stores an array of bytes" do
|
||||
bytes = Bytes.new(32)
|
||||
bytes[0] = 42
|
||||
expect(bytes[0]).to eq(42)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue