Move more fixtures to compile time
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
defmodule Discogs.Fixtures.Artist do
|
||||
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures/discogs"])
|
||||
|
||||
def get_artist do
|
||||
Path.join([@fixtures_folder, "artist - steven wilson.json"])
|
||||
|> File.read!()
|
||||
|> JSON.decode!()
|
||||
end
|
||||
# Cache fixtures at compile time to avoid repeated file I/O
|
||||
@get_artist Path.join([@fixtures_folder, "artist - steven wilson.json"])
|
||||
|> File.read!()
|
||||
|> JSON.decode!()
|
||||
|
||||
def image_data do
|
||||
Path.join([@fixtures_folder, "steven wilson.jpeg"])
|
||||
|> File.read!()
|
||||
end
|
||||
@image_data Path.join([@fixtures_folder, "steven wilson.jpeg"])
|
||||
|> File.read!()
|
||||
|
||||
def get_artist, do: @get_artist
|
||||
|
||||
def image_data, do: @image_data
|
||||
|
||||
def image_width, do: 225
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user