pact alternatives and similar packages
Based on the "Miscellaneous" category.
Alternatively, view pact alternatives based on common mentions on social networks and blogs.
-
ex_rated
ExRated, the Elixir OTP GenServer with the naughty name that allows you to rate-limit calls to any service that requires it. -
countriex
All sorts of useful information about every country. A pure elixir port of the ruby Countries gem -
gen_task
Generic Task behavior that helps encapsulate errors and recover from them in classic GenStage workers.
InfluxDB - Purpose built for real-time analytics at any scale.
Do you think we are missing an alternative of pact or a related project?
Popular Comparisons
README
Pact
Pact is a dependency registry for Elixir to make testing dependencies easier.
Why?
Because testing Elixir dependencies could be a lot better. Why clutter up your code injecting dependencies when a process can handle it for you?
- You can declare your modules instead of passing them around like state.
- You can replace dependencies in a block context for easy testing.
- It makes your code cleaner.
Usage
In your application code:
defmodule MyApp.Pact do
use Pact
register "http", HTTPoison
end
MyApp.Pact.start_link
defmodule MyApp.Users do
def all do
MyApp.Pact.get("http").get!("http://foobar.com/api/users")
end
end
In your tests:
defmodule MyApp.UserTest do
use ExUnit.Case
require MyApp.Pact
test "requests the corrent endpoint" do
fakeHTTP = MyApp.Pact.generate :http do
def get!(url) do
send self(), {:called, url}
end
end
MyApp.Pact.replace "http", fakeHTTP do
MyApp.Users.all
end
assert_receive {:called, "http://foobar.com/api/users"}
end
end
You can find more information in the documentation.
Disclaimer
Pact is very much an experiment at this point to see if it's viable. If you use Pact please get in touch with me to let me know how it worked out for you or how you think it could improve. If you have ideas feel free to open an issue or create a pull request.