boydm / phoenix_integration

Lightweight server side integration test tools for Phoenix
Apache License 2.0
219 stars 26 forks source link

Fail with expected error when RegExp doesn't match #57

Closed adz closed 3 years ago

adz commented 3 years ago

Running test without change to lib shows the error:

  1) test assert_response :html fails if missing content for regexp (PhoenixIntegration.AssertionsTest)
     test/assertions_test.exs:241
     Expected exception PhoenixIntegration.Assertions.ResponseError but got Protocol.UndefinedError (protocol String.Chars not implemented for ~r/invalid content/ of type Regex (a struct). This protocol is implemented for the following type(s): Floki.Selector.AttributeSelector, Floki.Selector.Functional, Floki.Selector, Floki.Selector.PseudoClass, Floki.Selector.Combinator, Integer, NaiveDateTime, Time, Date, URI, BitString, DateTime, Version.Requirement, Version, List, Atom, Float)
     code: assert_raise PhoenixIntegration.Assertions.ResponseError, fn ->
     stacktrace:
       (elixir 1.11.3) lib/string/chars.ex:3: String.Chars.impl_for!/1
       (elixir 1.11.3) lib/string/chars.ex:22: String.Chars.to_string/1
       (phoenix_integration 0.9.1) lib/phoenix_integration/assertions.ex:437: PhoenixIntegration.Assertions.assert_body/3
       (elixir 1.11.3) lib/enum.ex:798: Enum."-each/2-lists^foreach/1-0-"/2
       (elixir 1.11.3) lib/enum.ex:798: Enum.each/2
       (phoenix_integration 0.9.1) lib/phoenix_integration/assertions.ex:81: PhoenixIntegration.Assertions.assert_response/2
       test/assertions_test.exs:244: (test)
boydm commented 3 years ago

I'm deep in Scenic issues. Will look at this soon

boydm commented 3 years ago

Thank you! This is now merged.

boydm commented 3 years ago

Now pushed to hex as 0.9.2

adz commented 3 years ago

Excellent. Thanks!

On Sun, 3 Oct 2021, 6:28 am Boyd Multerer, @.***> wrote:

Now pushed to hex as 0.9.2

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/boydm/phoenix_integration/pull/57#issuecomment-932812757, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAKBDJQFXQJWDVTXHLQBSLUE5P75ANCNFSM5CHBWNSQ .