Fluffy.Request (Fluffy v0.2.0)

Copy Markdown View Source

Assertions for request results captured by Fluffy.Event.request/3.

Pass the capture key as the first argument and execute the returned assertion with Fluffy.expect/2. Capture waits for the event; assertions inspect its retained result. Options follow Fluffy.Expect.

Summary

Assertions

Expects the captured request headers to include every supplied key/value pair. Additional headers are allowed.

Expects the captured request's method to equal the supplied value.

Expects the captured request's page to equal the supplied value.

Expects the captured request's post data to equal the supplied value.

Expects the captured request's resource type to equal the supplied value.

Expects the captured request URL to match a string, regex, or structured components.

Assertions

to_have_headers(key, expected, options \\ [])

@spec to_have_headers(term(), map(), [Fluffy.Expect.option()]) :: Fluffy.Expect.t()

Expects the captured request headers to include every supplied key/value pair. Additional headers are allowed.

to_have_method(key, expected, options \\ [])

@spec to_have_method(term(), String.t(), [Fluffy.Expect.option()]) ::
  Fluffy.Expect.t()

Expects the captured request's method to equal the supplied value.

to_have_page(key, expected, options \\ [])

@spec to_have_page(term(), term(), [Fluffy.Expect.option()]) :: Fluffy.Expect.t()

Expects the captured request's page to equal the supplied value.

to_have_post_data(key, expected, options \\ [])

@spec to_have_post_data(term(), String.t(), [Fluffy.Expect.option()]) ::
  Fluffy.Expect.t()

Expects the captured request's post data to equal the supplied value.

to_have_resource_type(key, expected, options \\ [])

@spec to_have_resource_type(term(), String.t(), [Fluffy.Expect.option()]) ::
  Fluffy.Expect.t()

Expects the captured request's resource type to equal the supplied value.

to_have_url(key, expected, options \\ [])

Expects the captured request URL to match a string, regex, or structured components.

Strings match exactly and regexes match against the complete captured URL. Relative strings are not resolved. Structured keywords use the same path, query, and fragment rules as Fluffy.Page.to_have_url/2.