Skip to content

Instantly share code, notes, and snippets.

View leobessa's full-sized avatar

Leonardo Bessa leobessa

View GitHub Profile
@doc """
Asserts that the given changeset is invalid, and that when the
assertion_expression is applied to the error_message it results in a truthy
value.
"""
defmacro assert_invalid(changeset, field, assertion_expression) when is_atom(field) do
expr = Macro.to_string(assertion_expression)
quote do
error_messages = unquote(changeset)
def use_selenium_driver driver
$__capybara_selenium_driver_name = driver
end
def selenium_driver
$__capybara_selenium_driver_name || :firefox
end
def (Capybara::Driver::Selenium).driver
unless @driver