module Avram::Expectations

Defined in:

avram/expectations.cr
avram/expectations/have_custom_error_expectation.cr
avram/expectations/have_error_expectation.cr

Instance Method Summary

Instance Method Detail

def have_error(name : Symbol, message = nil) #

Tests that an operation has a custom error

CreateUser.create(params) do |operation, user|
  user.should be_nil

  operation.should have_error(:roles)
  operation.should have_error(:roles, "is empty")
  operation.should have_error(:roles, /\sempty/)
end

[View source]
def have_error(message = nil) #

Tests that an operation or attribute has an error

CreateReceipt.create(params) do |operation, receipt|
  receipt.should be_nil

  operation.should have_error
  operation.should have_error("is required")
  operation.should have_error(/\srequired/)

  operation.user_id.should have_error
  operation.user_id.should have_error("is required")
  operation.user_id.should have_error(/\srequired/)
end

[View source]