Closed olivermt closed 2 years ago
It looks like a nice addition. I think we have two options:
1- Add an extra option to samples
. Something like:
samples stringify_keys: true do
:name | :country | :city
"Christian" | "United States" | "New York City"
"Peter" | "Austria" | "Vienna"
end
2- Let define the first row as strings:
samples do
"name" | "country" | "city"
"Christian" | "United States" | "New York City"
"Peter" | "Austria" | "Vienna"
end
Still not sure which one would be better. I'll take a look at it.
I think the first one is better in terms of backwards compability at least.
Second is best for consistency though, and I am not sure how it would not be backwards incompatible either?
I am voting for (2) for consistency as
samples do
%{} | "name" | "country" | "city"
user1 | "Christian" | "United States" | "New York City"
user2 | "Ingrid" | "Austria" | "Salzburg"
end
already returns string keys
[
%{"city" => "New York City", "country" => "United States", "name" => "Christian"},
%{"city" => "Salzburg", "country" => "Austria", "name" => "Ingrid"}
]
I made a PR for those who want to test: https://github.com/msaraiva/exsamples/pull/5
Fixed in #5.
I am using this stuff to functionally test api endpoints, and keys there are always strings and not atoms.
Right now I have to Enum.into every sample I use.