mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix sample iteration with single block arg (not tuple)
This commit is contained in:
parent
4e7318b964
commit
92e839415d
3 changed files with 43 additions and 3 deletions
30
spec/issues/github_issue_41_spec.cr
Normal file
30
spec/issues/github_issue_41_spec.cr
Normal file
|
@ -0,0 +1,30 @@
|
|||
require "../spec_helper"
|
||||
|
||||
Spectator.describe "GitHub Issue #41" do
|
||||
sample [1, 2, 3] do |i|
|
||||
it "is itself" do
|
||||
expect(i).to eq i
|
||||
end
|
||||
end
|
||||
|
||||
def self.an_array
|
||||
[1, 2, 3]
|
||||
end
|
||||
|
||||
sample an_array do |i|
|
||||
it "is itself" do
|
||||
expect(i).to eq(i)
|
||||
end
|
||||
end
|
||||
|
||||
# NOTE: NamedTuple does not work, must be Enumerable(T) for `sample`.
|
||||
def self.a_hash
|
||||
{:a => "a", :b => "b", :c => "c"}
|
||||
end
|
||||
|
||||
sample a_hash do |k, v|
|
||||
it "works on hashes" do
|
||||
expect(v).to eq(k.to_s)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue