Skip to content
This repository was archived by the owner on Jan 5, 2022. It is now read-only.

Implement option to add custom fixture file extension#56

Merged
fartek merged 1 commit intomasterfrom
allow-custom-fixture-extension
Sep 16, 2019
Merged

Implement option to add custom fixture file extension#56
fartek merged 1 commit intomasterfrom
allow-custom-fixture-extension

Conversation

@fartek
Copy link
Copy Markdown
Contributor

@fartek fartek commented Sep 16, 2019

🎩 Problem

No way to load fixtures that are not .json files (such as .tsv files).

📌 Solution

Add option for this.

👻 GIF

@fartek fartek requested a review from a team September 16, 2019 11:43
Comment thread lib/fixture/fixture.ex
file = location <> fixture <> ".json"
@spec load!(String.t(), String.t(), String.t()) :: String.t()
def load!(fixture, location \\ @fixture_location, file_extension \\ ".json") do
file = location <> fixture <> file_extension
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since load has nothing to do with json, I would prefer moving this to load_json! https://github.com/digitalorigin/pg-elixir-tools/pull/56/files#diff-0dbd60fba723e3e21c6dff1ddf34eeb4R11

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe for another PR @hylkealons ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since it's directly related, I'd do it here: but up to @fartek

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why I would leave the default .json here is because maybe some modules in some projects are depending on this default functionality. This is a suggestion to break the current API, which I don't wanna do (in this PR).

Copy link
Copy Markdown
Contributor

@hylkealons hylkealons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice suggestion 👏

@fartek fartek merged commit bcf1a83 into master Sep 16, 2019
@fartek fartek deleted the allow-custom-fixture-extension branch September 16, 2019 13:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants