Skip to content

Commit

Permalink
Disable the prefix by default in testing helpers
Browse files Browse the repository at this point in the history
A prefix is only necessary when it's not the standard "public" prefix,
which is rarely the case in testing helpers.

Closes #992
  • Loading branch information
sorentwo committed Nov 27, 2023
1 parent e012748 commit 20b38cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/oban.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defmodule Oban do
| {:notifier, module() | {module(), Keyword.t()}}
| {:peer, false | module() | {module(), Keyword.t()}}
| {:plugins, false | [module() | {module() | Keyword.t()}]}
| {:prefix, String.t()}
| {:prefix, false | String.t()}
| {:queues, false | [{queue_name(), pos_integer() | Keyword.t()}]}
| {:repo, module()}
| {:shutdown_grace_period, timeout()}
Expand Down
12 changes: 6 additions & 6 deletions lib/oban/testing.ex
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ defmodule Oban.Testing do

alias Oban.{Config, Job, Queue.Executor, Repo, Worker}

@type perform_opts ::
Job.option()
| {:log, Logger.level()}
| {:prefix, binary()}
| {:repo, module()}
@type perform_opts :: Job.option() | Oban.option()

@conf_keys []
|> Config.new()
Expand All @@ -120,7 +116,11 @@ defmodule Oban.Testing do

@doc false
defmacro __using__(repo_opts) do
_repo = Keyword.fetch!(repo_opts, :repo)
repo_opts = Keyword.put_new(repo_opts, :prefix, false)

unless Keyword.has_key?(repo_opts, :repo) do
raise ArgumentError, "testing requires a :repo option to be set"
end

quote do
alias Oban.Testing
Expand Down
2 changes: 1 addition & 1 deletion test/oban/testing_test.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Oban.TestingTest do
use Oban.Case, async: true

use Oban.Testing, repo: Oban.Test.Repo, prefix: "public", log: false
use Oban.Testing, repo: Oban.Test.Repo, log: false

alias Oban.{TelemetryHandler, Testing}

Expand Down

0 comments on commit 20b38cb

Please sign in to comment.