@@ -43,28 +43,28 @@ defmodule Assertions.Absinthe do
4343 |> get_fields ( schema , nesting )
4444 end
4545
46- @ doc ~S """
46+ @ doc """
4747 Returns a document containing the fields in a type and any sub-types down to a limited depth of
4848 nesting (default `3`).
4949
5050 This is helpful for generating a document to use for testing your GraphQL API. This function
5151 will always return all fields in the given type, ensuring that there aren't any accidental
5252 fields with resolver functions that aren't tested in at least some fashion.
5353
54- ## Example
55-
56- #= > document_for(:user, 2)
57- " \ " "
58- name
59- age
60- posts {
61- title
62- subtitle
63- }
64- comments {
65- body
66- }
67- " \ " "
54+ ## Example
55+
56+ iex > document_for(:user, 2)
57+ \" ""
58+ name
59+ age
60+ posts {
61+ title
62+ subtitle
63+ }
64+ comments {
65+ body
66+ }
67+ \" ""
6868 """
6969 @ spec document_for ( module ( ) , atom ( ) , non_neg_integer ( ) , Keyword . t ( ) ) :: String . t ( )
7070 def document_for ( schema , type , nesting , overrides ) do
@@ -81,32 +81,32 @@ defmodule Assertions.Absinthe do
8181 This is helpful when you want to exhaustively test something by asserting equality on every
8282 field in the response.
8383
84- ## Example
84+ ## Example
8585
86- ## > query = "{ user { #\ {document_for(:user, 2} } }"
87- ## > expected = %{"user" => %{"name" => "Bob", "posts" => [%{"title" => "A post"}]}}
88- ## > assert_response_equals(query, expected)
86+ iex > query = "{ user { #{document_for(:user, 2) } } }"
87+ iex > expected = %{"user" => %{"name" => "Bob", "posts" => [%{"title" => "A post"}]}}
88+ iex > assert_response_equals(query, expected)
8989 """
9090 @ spec assert_response_equals ( module ( ) , String . t ( ) , map ( ) , Keyword . t ( ) ) :: :ok | no_return ( )
9191 def assert_response_equals ( schema , document , expected_response , options ) do
9292 ExUnit.Assertions . assert { :ok , % { data: response } } = Absinthe . run ( document , schema , options )
9393 Assertions . assert_maps_equal ( response , expected_response , Map . keys ( response ) )
9494 end
9595
96- @ doc """
96+ @ doc ~S """
9797 Assert that the response for sending `document` matches `expr`.
9898
9999 This is helpful when you want to test some but not all fields in the returned response, or
100100 would like to break up your assertions by binding variables in the body of the match and then
101101 making separate assertions further down in your test.
102102
103- ## Example
103+ ## Example
104104
105- ## > query = "{ user { #\ { document_for(:user, 2} } }"
106- ## > assert_response_matches(query) do
107- ##> %{"user" => %{"name" => "B" <> _, "posts" => posts}}
108- ##> end
109- ## > assert length(posts) == 1
105+ iex > query = "{ user { #{document_for(:user, 2) } } }"
106+ iex > assert_response_matches(query) do
107+ %{"user" => %{"name" => "B" <> _, "posts" => posts}}
108+ end
109+ iex > assert length(posts) == 1
110110 """
111111 @ spec assert_response_matches ( module ( ) , String . t ( ) , Keyword . t ( ) , Macro . expr ( ) ) ::
112112 :ok | no_return ( )
0 commit comments