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
32
spec/docs/subject_spec.cr
Normal file
32
spec/docs/subject_spec.cr
Normal file
|
@ -0,0 +1,32 @@
|
|||
require "../spec_helper"
|
||||
|
||||
Spectator.describe "subject" do
|
||||
subject(array1) { [1, 2, 3] }
|
||||
subject(array2) { [4, 5, 6] }
|
||||
|
||||
it "has different elements" do
|
||||
expect(array1).to_not eq(subject) # array2 would also work here.
|
||||
end
|
||||
|
||||
let(string) { "foobar" }
|
||||
|
||||
it "isn't empty" do
|
||||
expect(string.empty?).to be_false
|
||||
end
|
||||
|
||||
it "is six characters" do
|
||||
expect(string.size).to eq(6)
|
||||
end
|
||||
|
||||
let(array) { [0, 1, 2] }
|
||||
|
||||
it "modifies the array" do
|
||||
array[0] = 42
|
||||
expect(array).to eq([42, 1, 2])
|
||||
end
|
||||
|
||||
it "doesn't carry across tests" do
|
||||
array[1] = 777
|
||||
expect(array).to eq([0, 777, 2])
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue