Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
amatalai committed Sep 13, 2017
1 parent 8f80d0a commit f88cc4f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/mockery/history.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Mockery.History do
It's disabled by default.
It can be enabled/disabled globally by following config
config Mockery, history: true
config :mockery, history: true
Or for single test process
Expand Down
2 changes: 1 addition & 1 deletion lib/mockery/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Mockery.Utils do

@application Mockery.of(Application)
def history_enabled? do
Process.get(Mockery.History, @application.get_env(Mockery, :history, false))
Process.get(Mockery.History, @application.get_env(:mockery, :history, false))
end

# removes unnecessary `Elixir.` prefix from module names
Expand Down
6 changes: 3 additions & 3 deletions test/mockery/utils_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ defmodule Mockery.UtilsTest do

test "history_enabled?/0 returns false by default" do
refute Utils.history_enabled?
assert_called Application, :get_env, [Mockery, :history, _], 1
assert_called Application, :get_env, [:mockery, :history, _], 1
end

test "history_enabled?/0 changed by global config" do
mock Application, :get_env, true

assert Utils.history_enabled?
assert_called Application, :get_env, [Mockery, :history, _], 1
assert_called Application, :get_env, [:mockery, :history, _], 1
end

test "history_enabled?/0 global config ignored when process config present" do
mock Application, :get_env, true
enable_history(false)

refute Utils.history_enabled?
assert_called Application, :get_env, [Mockery, :history, _], 1
assert_called Application, :get_env, [:mockery, :history, _], 1
end
end

0 comments on commit f88cc4f

Please sign in to comment.