Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ibrowse example is not working #77

Open
JonRCahill opened this issue Oct 15, 2016 · 4 comments
Open

ibrowse example is not working #77

JonRCahill opened this issue Oct 15, 2016 · 4 comments

Comments

@JonRCahill
Copy link

JonRCahill commented Oct 15, 2016

Hi I have tried to setup exvcr and use the example to ensure everything is working but I keep getting the following error:

** (ErlangError) erlang error: {:not_mocked, :ibrowse}
     stacktrace:
       src/meck_proc.erl:118: :meck_proc.set_expect/2
       src/meck.erl:234: :meck.expect/3
       (elixir) lib/enum.ex:651: Enum."-each/2-lists^foreach/1-0-"/2
       (elixir) lib/enum.ex:651: Enum.each/2
       test/lib/mail_chimp_test.exs:46: (test)

my code is as follows (the example provided by exvcr):

defmodule ExtraTurn.MailChimpTest do
  use ExUnit.Case, async: false
  use ExVCR.Mock

  setup_all do
    ExVCR.Config.cassette_library_dir("fixture/vcr_cassettes")
    :ok
  end

  test "example single request" do
    use_cassette "example_ibrowse" do
      :ibrowse.start
      {:ok, status_code, _headers, body} = :ibrowse.send_req('http://example.com', [], :get)
      assert status_code == '200'
      assert to_string(body) =~ ~r/Example Domain/
    end
  end

  test "httpotion" do
    use_cassette "example_httpotion" do
      HTTPotion.start
      assert HTTPotion.get("http://example.com", []).body =~ ~r/Example Domain/
    end
  end
end

I am using the latest elixir version, 1.3.4:

Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Elixir 1.3.4

and using Phoenix 1.2.1 (but I don't think that will affect anything).

I have tried using both the latest version on hex.pm and the latest github version.

Any help would be great!

@parroty
Copy link
Owner

parroty commented Jan 25, 2017

Sorry being late to respond.
Is it possible to post your mix.exs? (how deps defined?) The above mentioned code seems working in my environment with following deps definition and would like to isolate the condition.

defmodule SomeModule.Mixfile do
  use Mix.Project

...

  defp deps do
    [
      {:exvcr, "~> 0.8", only: :test},
      {:ibrowse, "~> 4.2"},
      {:httpotion, "~> 3.0"}
    ]
  end
end

@epergo
Copy link

epergo commented Apr 13, 2017

Hi!!
I had the same problem and was because I didn't know ibrowse is a mandatory dependency to have installed.

Thx @parroty !

@yordis
Copy link

yordis commented Mar 9, 2019

Same issue here, I had httpoison but I didn't have ibrowse as a deps. This is a little bit odd since httpoison uses ibrowse.

@DaniruKun
Copy link

Hmm I didn't have any problem using HTTPotion, just make sure that you have this block in your test module:

setup_all do
    HTTPoison.start()
    :ok
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants