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

ExVCR and Pavlov function adapter_method/0 undefined #33

Open
C404 opened this Issue Dec 6, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@C404
Copy link

C404 commented Dec 6, 2015

Hi,

I tried to use ExVCR with Pavlov.
Both works separately but together i always get something like function adapter_method/0 undefined

Here is a code example:

defmodule MyModuleTest do
  use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
  use Pavlov.Case, async: true
  import Pavlov.Syntax.Expect

  describe « .something" do
    context "given valid params » do
      it "returns response body » do
        use_cassette "sucess » do
          response = MyModule.test
          expect response |> not_to_eq %{}
        end
      end
    end
  end
end

Any idea what i'm missing ?

@C404 C404 changed the title ExVCR and Pavlov unused import Pavlov.Syntax.Expect ExVCR and Pavlov function adapter_method/0 undefined Dec 6, 2015

@parroty

This comment has been minimized.

Copy link
Owner

parroty commented Dec 7, 2015

Thanks for the report, I could simulate the error you indicated.
It seems the Pavlov is defining different sub-module for each of the describe or context. Then, ExVCR is failing to call the adapter method in MyModuleTest (defined by use ExVCR.Mock) as use_cassette is in the different module defined by Pavlov.

The following change would be one option to avoid the error. For better/alternative solution, I may need to investigate a little more.

defmodule MyModuleTest do
  use Pavlov.Case, async: true
  import Pavlov.Syntax.Expect

  describe "something" do
    context "given valid params" do
      use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
      it "returns response body" do
        use_cassette "success" do
          response = MyModule.test
          expect response |> not_to_eq %{}
        end
      end
    end
  end
end
@C404

This comment has been minimized.

Copy link

C404 commented Dec 7, 2015

Thanks for your answer and the workaround.
It isn't the best alternative yet but it'll do the trick for the time being ;)

Gonna have a look as well if i find anything that could help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment