Skip to content

Instantly share code, notes, and snippets.

@thejohnnybot
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save thejohnnybot/b36ddf0b9ac7c3a1460a to your computer and use it in GitHub Desktop.

Select an option

Save thejohnnybot/b36ddf0b9ac7c3a1460a to your computer and use it in GitHub Desktop.
Elixir test case
defmodule Bond.DataTest do
use ExUnit.Case, async: true
@quotes_fixture_path "test/fixtures/quotes.json"
setup_all do
{:ok, pid} = :cberl.start_link(
:bond_test,
5,
"localhost:8091" |> String.to_char_list,
"username" |> String.to_char_list,
"password" |> String.to_char_list,
"bond_test" |> String.to_char_list,
Bond.Transcoder
)
Process.unlink(pid)
File.read!(@quotes_fixture_path)
|> Poison.decode!
|> Enum.map(fn (data) ->
id = Map.get(data, "id")
quote_data = Map.delete(data, "id")
:cberl.set(:bond_test, id, 0, quote_data)
end)
on_exit fn ->
:cberl.flush(:bond_test, "bond_test")
Process.exit(pid, :shutdown)
end
:ok
end
test "to be 45 documents" do
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment