Skip to content

Commit

Permalink
Merge pull request #126 from bastos/cleaning-test-warnings
Browse files Browse the repository at this point in the history
Cleaning up parentheses warnings in Elixir 1.4
  • Loading branch information
edgurgel authored Jun 9, 2017
2 parents e41e285 + ab33c02 commit 2a86c08
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 93 deletions.
2 changes: 1 addition & 1 deletion lib/verk/workers_manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ defmodule Verk.WorkersManager do
:ok ->
{:noreply, state, 0}
:more ->
send self, :enqueue_inprogress
send self(), :enqueue_inprogress
{:noreply, state}
end
end
Expand Down
46 changes: 23 additions & 23 deletions test/dead_set_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Verk.DeadSetTest do
setup do
{ :ok, redis } = Confex.get(:verk, :redis_url) |> Redix.start_link
Redix.command!(redis, ~w(DEL dead))
on_exit fn -> unload end
on_exit fn -> unload() end
{ :ok, %{ redis: redis } }
end

Expand All @@ -19,7 +19,7 @@ defmodule Verk.DeadSetTest do

assert add(job, failed_at, redis) == :ok

assert Redix.command!(redis, ["ZRANGE", key, 0, -1, "WITHSCORES"]) == [payload, to_string(failed_at)]
assert Redix.command!(redis, ["ZRANGE", key(), 0, -1, "WITHSCORES"]) == [payload, to_string(failed_at)]
end

test "replaces old jobs", %{ redis: redis } do
Expand All @@ -32,7 +32,7 @@ defmodule Verk.DeadSetTest do
assert add(job1, failed_at + 1, redis) == :ok
assert add(job2, failed_at + 2, redis) == :ok

assert Redix.command!(redis, ["ZRANGE", key, 0, 2, "WITHSCORES"])
assert Redix.command!(redis, ["ZRANGE", key(), 0, 2, "WITHSCORES"])
== [payload1, to_string(failed_at + 1), payload2, to_string(failed_at + 2)]
end
end
Expand All @@ -45,7 +45,7 @@ defmodule Verk.DeadSetTest do

assert add!(job, failed_at, redis) == nil

assert Redix.command!(redis, ["ZRANGE", key, 0, -1, "WITHSCORES"]) == [payload, to_string(failed_at)]
assert Redix.command!(redis, ["ZRANGE", key(), 0, -1, "WITHSCORES"]) == [payload, to_string(failed_at)]
end

test "replaces old jobs", %{ redis: redis } do
Expand All @@ -58,43 +58,43 @@ defmodule Verk.DeadSetTest do
assert add!(job1, failed_at + 1, redis) == nil
assert add!(job2, failed_at + 2, redis) == nil

assert Redix.command!(redis, ["ZRANGE", key, 0, 2, "WITHSCORES"])
assert Redix.command!(redis, ["ZRANGE", key(), 0, 2, "WITHSCORES"])
== [payload1, to_string(failed_at + 1), payload2, to_string(failed_at + 2)]
end
end

describe "count/0" do
test "count" do
expect(SortedSet, :count, [key, Verk.Redis], {:ok, 1})
expect(SortedSet, :count, [key(), Verk.Redis], {:ok, 1})

assert count == {:ok, 1}
assert count() == {:ok, 1}
assert validate SortedSet
end
end

describe "count!/0" do
test "count!" do
expect(SortedSet, :count!, [key, Verk.Redis], 1)
expect(SortedSet, :count!, [key(), Verk.Redis], 1)

assert count! == 1
assert count!() == 1
assert validate SortedSet
end
end

describe "clear/0" do
test "clear" do
expect(SortedSet, :clear, [key, Verk.Redis], :ok)
expect(SortedSet, :clear, [key(), Verk.Redis], :ok)

assert clear == :ok
assert clear() == :ok
assert validate SortedSet
end
end

describe "clear!/0" do
test "clear!" do
expect(SortedSet, :clear!, [key, Verk.Redis], nil)
expect(SortedSet, :clear!, [key(), Verk.Redis], nil)

assert clear! == nil
assert clear!() == nil
assert validate SortedSet
end
end
Expand All @@ -104,9 +104,9 @@ defmodule Verk.DeadSetTest do
job = %Verk.Job{class: "Class", args: []}
json = Poison.encode!(job)

expect(SortedSet, :range, [key, 0, -1, Verk.Redis], {:ok, [%{ job | original_json: json }]})
expect(SortedSet, :range, [key(), 0, -1, Verk.Redis], {:ok, [%{ job | original_json: json }]})

assert range == {:ok, [%{ job | original_json: json }]}
assert range() == {:ok, [%{ job | original_json: json }]}
assert validate SortedSet
end
end
Expand All @@ -116,7 +116,7 @@ defmodule Verk.DeadSetTest do
job = %Verk.Job{class: "Class", args: []}
json = Poison.encode!(job)

expect(SortedSet, :range, [key, 1, 2, Verk.Redis], {:ok, [%{ job | original_json: json }]})
expect(SortedSet, :range, [key(), 1, 2, Verk.Redis], {:ok, [%{ job | original_json: json }]})

assert range(1, 2) == {:ok, [%{ job | original_json: json }]}
assert validate SortedSet
Expand All @@ -128,9 +128,9 @@ defmodule Verk.DeadSetTest do
job = %Verk.Job{class: "Class", args: []}
json = Poison.encode!(job)

expect(SortedSet, :range!, [key, 0, -1, Verk.Redis], [%{ job | original_json: json }])
expect(SortedSet, :range!, [key(), 0, -1, Verk.Redis], [%{ job | original_json: json }])

assert range! == [%{ job | original_json: json }]
assert range!() == [%{ job | original_json: json }]
assert validate SortedSet
end
end
Expand All @@ -140,7 +140,7 @@ defmodule Verk.DeadSetTest do
job = %Verk.Job{class: "Class", args: []}
json = Poison.encode!(job)

expect(SortedSet, :range!, [key, 1, 2, Verk.Redis], [%{ job | original_json: json }])
expect(SortedSet, :range!, [key(), 1, 2, Verk.Redis], [%{ job | original_json: json }])

assert range!(1, 2) == [%{ job | original_json: json }]
assert validate SortedSet
Expand All @@ -153,15 +153,15 @@ defmodule Verk.DeadSetTest do
json = Poison.encode!(job)
job = %{ job | original_json: json }

expect(SortedSet, :delete_job, [key, json, Verk.Redis], :ok)
expect(SortedSet, :delete_job, [key(), json, Verk.Redis], :ok)

assert delete_job(job) == :ok
assert validate SortedSet
end

test "with original_json" do
json = %Verk.Job{class: "Class", args: []} |> Poison.encode!
expect(SortedSet, :delete_job, [key, json, Verk.Redis], :ok)
expect(SortedSet, :delete_job, [key(), json, Verk.Redis], :ok)

assert delete_job(json) == :ok
assert validate SortedSet
Expand All @@ -174,15 +174,15 @@ defmodule Verk.DeadSetTest do
json = Poison.encode!(job)
job = %{ job | original_json: json }

expect(SortedSet, :delete_job!, [key, json, Verk.Redis], nil)
expect(SortedSet, :delete_job!, [key(), json, Verk.Redis], nil)

assert delete_job!(job) == nil
assert validate SortedSet
end

test "with original_json" do
json = %Verk.Job{class: "Class", args: []} |> Poison.encode!
expect(SortedSet, :delete_job!, [key, json, Verk.Redis], :nil)
expect(SortedSet, :delete_job!, [key(), json, Verk.Redis], :nil)

assert delete_job!(json) == nil
assert validate SortedSet
Expand Down
2 changes: 1 addition & 1 deletion test/dsl_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule Verk.DslTest do

describe "bagify/1" do
test "with no error" do
assert bangify(ok) == nil
assert bangify(ok()) == nil
assert bangify(incr(2)) == 3
end

Expand Down
10 changes: 5 additions & 5 deletions test/log_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Verk.LogTest do

describe "start/2" do
test "logs start" do
worker = self
worker = self()
job = %Verk.Job{}

assert capture_log(fn -> Verk.Log.start(job, worker) end) =~ ~r/start/
Expand All @@ -15,7 +15,7 @@ defmodule Verk.LogTest do

describe "done/3" do
test "logs done with time in milliseconds" do
worker = self
worker = self()
job = %Verk.Job{}
start_time = Verk.Time.now

Expand All @@ -25,7 +25,7 @@ defmodule Verk.LogTest do
end

test "logs done with time in seconds" do
worker = self
worker = self()
job = %Verk.Job{}
start_time = Verk.Time.now
|> Verk.Time.shift(-2)
Expand All @@ -38,7 +38,7 @@ defmodule Verk.LogTest do

describe "fail/3" do
test "logs fail with time in milliseconds" do
worker = self
worker = self()
job = %Verk.Job{}
start_time = Verk.Time.now

Expand All @@ -48,7 +48,7 @@ defmodule Verk.LogTest do
end

test "logs fail with time in seconds" do
worker = self
worker = self()
job = %Verk.Job{}
start_time = Verk.Time.now
|> Time.shift(-2, :seconds)
Expand Down
2 changes: 1 addition & 1 deletion test/queue_manager_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Verk.QueueManagerTest do
@mrpop_script Verk.Scripts.sha("mrpop_lpush_src_dest")

setup do
on_exit fn -> unload end
on_exit fn -> unload() end
:ok
end

Expand Down
2 changes: 1 addition & 1 deletion test/queue_stats_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ defmodule Verk.QueueStatsTest do
handle_events([%Verk.Events.JobFinished{ job: %Verk.Job{ queue: "queue_1" } }], :from, :state)
handle_events([%Verk.Events.JobFailed{ job: %Verk.Job{ queue: "queue_1" } }], :from, :state)

assert all == [%{ queue: "queue_1", running_counter: 0, finished_counter: 1, failed_counter: 1 },
assert all() == [%{ queue: "queue_1", running_counter: 0, finished_counter: 1, failed_counter: 1 },
%{ queue: "queue_2", running_counter: 1, finished_counter: 0, failed_counter: 0 } ]
end

Expand Down
Loading

0 comments on commit 2a86c08

Please sign in to comment.