Truemail RSpec helpers

Maintainability Test Coverage CircleCI Gem Version Downloads Contributor Covenant

truemail-rspec gem helps you create Truemail::Configuration and Truemail::Validator instances for your RSpec environment.

Table of Contents

Requirements

Ruby MRI 2.5.0+

Features

  • Ability to create Truemail::Configuration instance with random or with predefined params
  • Ability to create Truemail::Validator instance with random or with predefined params

Installation

Add this line to your application's Gemfile:

group :development, :test do
  gem 'truemail-rspec', require: false
end

And add into your spec_helper.rb or rails_helper.rb:

require 'truemail/rspec'

RSpec.configure do |config|
  config.include Truemail::RSpec
end

And then execute:

$ bundle

Or install it yourself as:

$ gem install truemail-rspec

Usage

Create configuration instance

Allows to create configuration instance with random or with predefined params.

Configuration instance with default random params

create_configuration

# => returns Truemail::Configuration instance with
# random verifier_email and default Truemail::Configuration params

Configuration instance with predefined params

All Truemail::Configuration available params

create_configuration(verifier_email: '[email protected]', verifier_domain: 'other-domain.com')
# => returns Truemail::Configuration instance with custom settings

Create validator instance

Allows to create validator instance with default random or with predefined params.

create_servers_list

create_servers_list # => returns array with random ip addresses

create_validator DSL

create_validator(
  validation_type, # optional, type:Symbol, can be :regex, :mx or :smtp, by default creates :smtp validation
  email, # optional, type:String, by default random email
  mail_servers, # optional, type:Array(String), by default array with random ip addresses
  success: true, # optional, type:Bool, by default true
  configuration: create_configuration # optional, type:Truemail::Configuration, by default creates random configuration
)

# => returns Truemail::Validator instance follow passed params

Truemail family

All Truemail extensions: https://github.com/truemail-rb

Name Type Description
truemail ruby gem Configurable plain Ruby email validator, main core
truemail server ruby app Lightweight rack based web API wrapper for Truemail
truemail-rack-docker docker image Lightweight rack based web API dockerized image :whale: of Truemail server
truemail-ruby-client ruby gem Truemail web API client library for Ruby
truemail-crystal-client crystal shard Truemail web API client library for Crystal

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/truemail-rb/truemail-rspec. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct. Please check the open tikets. Be shure to follow Contributor Code of Conduct below and our Contributing Guidelines.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the truemail-rspec project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Credits

Versioning

truemail-rspec uses Semantic Versioning 2.0.0