Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix upstream warnings under Elixir 1.16 #215

Merged
merged 3 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ config :exvcr, [
strict_mode: false
]

if Mix.env == :test, do: import_config "test.exs"
if Mix.env() == :test, do: import_config "test.exs"
2 changes: 1 addition & 1 deletion lib/exvcr/adapter/hackney.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule ExVCR.Adapter.Hackney do

defmacro __using__(_opts) do
quote do
Store.start
Store.start()
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/exvcr/checker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defmodule ExVCR.Checker do
def add_server_count(recorder), do: add_count(recorder, :server)

defp add_count(recorder, type) do
if ExVCR.Checker.get != [] do
if ExVCR.Checker.get() != [] do
ExVCR.Checker.append({type, ExVCR.Recorder.get_file_path(recorder)})
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/exvcr/iex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule ExVCR.IEx do
"""
defmacro print(options \\ [], test) do
adapter = options[:adapter] || ExVCR.Adapter.IBrowse
method_name = :"ExVCR.IEx.Sample#{ExVCR.Util.uniq_id}"
method_name = :"ExVCR.IEx.Sample#{ExVCR.Util.uniq_id()}"

quote do
defmodule unquote(method_name) do
Expand Down
12 changes: 6 additions & 6 deletions lib/exvcr/mock.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule ExVCR.Mock do

quote do
import ExVCR.Mock
:application.start(unquote(adapter).module_name)
:application.start(unquote(adapter).module_name())
use unquote(adapter)

def adapter_method() do
Expand All @@ -36,7 +36,7 @@ defmodule ExVCR.Mock do
"""
defmacro use_cassette(:stub, options, test) do
quote do
stub_fixture = "stub_fixture_#{ExVCR.Util.uniq_id}"
stub_fixture = "stub_fixture_#{ExVCR.Util.uniq_id()}"
stub = prepare_stub_records(unquote(options), adapter_method())
recorder = Recorder.start([fixture: stub_fixture, stub: stub, adapter: adapter_method()])

Expand All @@ -45,7 +45,7 @@ defmodule ExVCR.Mock do
[do: return_value] = unquote(test)
return_value
after
module_name = adapter_method().module_name
module_name = adapter_method().module_name()
unload(module_name)
ExVCR.MockLock.release_lock()
end
Expand Down Expand Up @@ -88,7 +88,7 @@ defmodule ExVCR.Mock do
quote do
recorder_result = Recorder.save(unquote(recorder))

module_name = adapter_method().module_name
module_name = adapter_method().module_name()
unload(module_name)
ExVCR.MockLock.release_lock()

Expand All @@ -101,7 +101,7 @@ defmodule ExVCR.Mock do
if ExVCR.Application.global_mock_enabled?() do
ExVCR.Actor.CurrentRecorder.set(recorder)
else
module_name = adapter.module_name
module_name = adapter.module_name()
target_methods = adapter.target_methods(recorder)
Enum.each(target_methods, fn({function, callback}) ->
:meck.expect(module_name, function, callback)
Expand All @@ -125,7 +125,7 @@ defmodule ExVCR.Mock do
def mock_methods(recorder, adapter) do
parent_pid = self()
Task.async(fn ->
ExVCR.MockLock.ensure_started
ExVCR.MockLock.ensure_started()
ExVCR.MockLock.request_lock(self(), parent_pid)
receive do
:lock_granted ->
Expand Down
2 changes: 1 addition & 1 deletion lib/exvcr/mock_lock.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule ExVCR.MockLock do

def ensure_started do
unless Process.whereis(:mock_lock) do
__MODULE__.start
__MODULE__.start()
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/exvcr/setting.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ defmodule ExVCR.Setting do
defp setup do
if :ets.info(table()) == :undefined do
:ets.new(table(), [:set, :public, :named_table])
ExVCR.ConfigLoader.load_defaults
ExVCR.ConfigLoader.load_defaults()
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/exvcr/util.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule ExVCR.Util do
Returns uniq_id string based on current timestamp (ex. 1407237617115869)
"""
def uniq_id do
:os.timestamp |> Tuple.to_list |> Enum.join("")
:os.timestamp() |> Tuple.to_list |> Enum.join("")
end

@doc """
Expand Down
4 changes: 2 additions & 2 deletions lib/mix/tasks.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule Mix.Tasks.Vcr do
def run(args) do
{options, _, _} = OptionParser.parse(args, aliases: [d: :dir, c: :custom, h: :help], switches: [dir: :string, custom: :string, help: :boolean])
if options[:help] do
ExVCR.Task.Util.print_help_message
ExVCR.Task.Util.print_help_message()
else
ExVCR.Task.Util.parse_basic_options(options) |> ExVCR.Task.Runner.show_vcr_cassettes
end
Expand Down Expand Up @@ -63,7 +63,7 @@ defmodule Mix.Tasks.Vcr do
Mix.env(:test)
Mix.Task.run("test")
System.at_exit(fn(_) ->
ExVCR.Task.Runner.check_cassettes(ExVCR.Checker.get)
ExVCR.Task.Runner.check_cassettes(ExVCR.Checker.get())
end)
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/adapter_hackney_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule ExVCR.Adapter.HackneyTest do

setup_all do
HttpServer.start(path: "/server", port: @port, response: "test_response")
{:ok, _} = HTTPoison.start
{:ok, _} = HTTPoison.start()
on_exit fn ->
HttpServer.stop(@port)
end
Expand Down
4 changes: 2 additions & 2 deletions test/config_loader_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ defmodule ExVCR.ConfigLoaderTest do
ExVCR.Config.response_headers_blacklist(["Content-Type", "Accept"])

# Load default values (defined in config/config.exs)
ExVCR.ConfigLoader.load_defaults
ExVCR.ConfigLoader.load_defaults()

# Verify against default values
assert ExVCR.Setting.get(:cassette_library_dir) == "fixture/vcr_cassettes"
Expand All @@ -48,7 +48,7 @@ defmodule ExVCR.ConfigLoaderTest do
Application.delete_env(:exvcr, :response_headers_blacklist)

# Load default values
ExVCR.ConfigLoader.load_defaults
ExVCR.ConfigLoader.load_defaults()

# Verify against default values
assert ExVCR.Setting.get(:cassette_library_dir) == "fixture/vcr_cassettes"
Expand Down
2 changes: 1 addition & 1 deletion test/handler_options_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule ExVCR.Adapter.HandlerOptionsTest do
@url "http://localhost:#{@port}/server"

setup_all do
HTTPotion.start
HTTPotion.start()
on_exit fn ->
HttpServer.stop(@port)
end
Expand Down
2 changes: 1 addition & 1 deletion test/iex_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule ExVCR.IExTest do
@port 34005

setup_all do
:ibrowse.start
:ibrowse.start()
HttpServer.start(path: "/server", port: @port, response: "test_response")
on_exit fn ->
HttpServer.stop(@port)
Expand Down
2 changes: 1 addition & 1 deletion test/ignore_localhost_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule ExVCR.IgnoreLocalhostTest do
@url "http://localhost:#{@port}/server"

setup_all do
HTTPotion.start
HTTPotion.start()
on_exit fn ->
HttpServer.stop(@port)
end
Expand Down
2 changes: 1 addition & 1 deletion test/ignore_urls_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule ExVCR.IgnoreUrlsTest do
]

setup_all do
HTTPotion.start
HTTPotion.start()
on_exit fn ->
HttpServer.stop(@port)
end
Expand Down
2 changes: 1 addition & 1 deletion test/strict_mode_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule ExVCR.StrictModeTest do
:ok
end

HTTPotion.start
HTTPotion.start()
HttpServer.start(@http_server_opts)
:ok
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ExUnit.start
ExUnit.start()
Application.ensure_all_started(:http_server)
Application.ensure_all_started(:telemetry)
Finch.start_link(name: ExVCRFinch)