Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ExUnit.configure(exclude: [real_data: true])
ExUnit.configure(exclude: [:real_data])
ExUnit.start()
12 changes: 9 additions & 3 deletions test/worldly/country_test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
defmodule Worldly.CountryTest do
use ExUnit.Case

setup context do
if context[:real_data] do
Application.put_env(:worldly, :data_path, context[:real_data])
on_exit fn -> Application.put_env(:worldly, :data_path, "priv/test_data") end
end
:ok
end

test "all/0" do
assert Worldly.Country.all == [
country_andorra,
Expand All @@ -24,11 +32,9 @@ defmodule Worldly.CountryTest do
assert Worldly.Country.with_code("ALBA") == []
end

@tag :real_data
@tag real_data: "priv/data"
test "real paths working" do
Application.put_env(:worldly, :data_path, "priv/data")
assert Worldly.Country.with_code("AL") == [country_albania]
Application.put_env(:worldly, :data_path, "priv/test_data")
end

defp country_andorra do
Expand Down