Joined October 2015
·

Rob Heckart

Maryland
·
·

I'm also an Elixir newb. I'm trying to use this inside of a test case in Phoenix, but I'm getting the same error as @rosscdh. It seems like no matter where I put the require and/or import, the error is the same. My code in the test is:

defmodule Jiranomohub.OrganizationApiControllerTest do
use Jiranomohub.ConnCase

alias Poison.Encoder
alias Jiranomohub.Organization

require Poison.Encoder
import Poison.Encoder

@validattrs %{domain: "test.com", email: "est.tester@test.com"} #, lastused: Ecto.DateTime.utc, uniquecode: Ecto.UUID.generate(), isactive: :true }
@invalid_attrs %{domain: "", email: ""}

setup do
conn = conn()
{:ok, conn: conn}
end

test "/api call gets organization", %{conn: conn} do

org = 
  %Organization{domain: "test.com", email: "test.tester@test.com"}
  |> Repo.insert
  |> List.wrap

org_as_json = Poison.encode!(org)

conn = get conn, organization_api_path(conn, :show, org_as_json)
# response = conn(:get, "/api/organizations") |> send_request


assert html_response(conn, 200) =~ org_as_json
# assert response.status == 200
# assert response.resp_body == org_as_json

end
end

Achievements
1 Karma
0 Total ProTip Views