Last active
August 29, 2015 14:07
-
-
Save thejohnnybot/b36ddf0b9ac7c3a1460a to your computer and use it in GitHub Desktop.
Elixir test case
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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