Rename ScrobbleRules.Worker to Worker.ApplyScrobbleRules

This commit is contained in:
Claudio Ortolina
2025-07-07 20:14:32 +01:00
parent 81a16e409a
commit f37719f272
3 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ config :music_library, Oban,
{Oban.Plugins.Cron, {Oban.Plugins.Cron,
crontab: [ crontab: [
# every 30 minutes # every 30 minutes
{"*/30 * * * *", MusicLibrary.ScrobbleRules.Worker} {"*/30 * * * *", MusicLibrary.Worker.ApplyScrobbleRules}
]} ]}
] ]
@@ -1,4 +1,4 @@
defmodule MusicLibrary.ScrobbleRules.Worker do defmodule MusicLibrary.Worker.ApplyScrobbleRules do
@moduledoc """ @moduledoc """
Oban worker that periodically applies all enabled scrobble rules. Oban worker that periodically applies all enabled scrobble rules.
@@ -1,9 +1,9 @@
defmodule MusicLibrary.ScrobbleRules.WorkerTest do defmodule MusicLibrary.Worker.ApplyScrobbleRulesTest do
use MusicLibrary.DataCase use MusicLibrary.DataCase
alias LastFm.Track alias LastFm.Track
alias MusicLibrary.ScrobbleRules alias MusicLibrary.ScrobbleRules
alias MusicLibrary.ScrobbleRules.Worker alias MusicLibrary.Worker.ApplyScrobbleRules
describe "perform/1" do describe "perform/1" do
test "successfully applies all enabled rules" do test "successfully applies all enabled rules" do
@@ -61,7 +61,7 @@ defmodule MusicLibrary.ScrobbleRules.WorkerTest do
|> Repo.insert!() |> Repo.insert!()
# Execute the worker # Execute the worker
assert :ok = Worker.perform(%Oban.Job{args: %{}}) assert :ok = ApplyScrobbleRules.perform(%Oban.Job{args: %{}})
# Verify rules were applied # Verify rules were applied
updated_track1 = Repo.get_by(Track, musicbrainz_id: "track-mbid-1") updated_track1 = Repo.get_by(Track, musicbrainz_id: "track-mbid-1")
@@ -78,12 +78,12 @@ defmodule MusicLibrary.ScrobbleRules.WorkerTest do
test "handles errors gracefully" do test "handles errors gracefully" do
# Since we can't easily mock here, let's test with no rules # Since we can't easily mock here, let's test with no rules
# which should still return :ok # which should still return :ok
assert :ok = Worker.perform(%Oban.Job{args: %{}}) assert :ok = ApplyScrobbleRules.perform(%Oban.Job{args: %{}})
end end
test "handles empty rules list" do test "handles empty rules list" do
# No rules exist # No rules exist
assert :ok = Worker.perform(%Oban.Job{args: %{}}) assert :ok = ApplyScrobbleRules.perform(%Oban.Job{args: %{}})
end end
end end
end end