All Projects → contently → Action_mailer_matchers

contently / Action_mailer_matchers

Licence: mit
ActionMailerMatchers provides rspec matchers to test Rails' common ActionMailer functionality.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Action mailer matchers

Rspec Openapi
Generate OpenAPI schema from RSpec request specs
Stars: ✭ 129 (+158%)
Mutual labels:  rails, rspec
Limestone
Boilerplate Rails 6 SaaS application with Webpack, Stimulus and Docker integration.
Stars: ✭ 191 (+282%)
Mutual labels:  rails, rspec
Mumuki Laboratory
🔬 Where students practice and receive automated and human feedback
Stars: ✭ 131 (+162%)
Mutual labels:  rails, rspec
Ifme
Free, open source mental health communication web app to share experiences with loved ones
Stars: ✭ 1,147 (+2194%)
Mutual labels:  rails, rspec
Shoulda Matchers
Simple one-liner tests for common Rails functionality
Stars: ✭ 3,166 (+6232%)
Mutual labels:  rails, rspec
Lurker
📖 The ultimate tool for documenting and testing APIs in Rails
Stars: ✭ 120 (+140%)
Mutual labels:  rails, rspec
Expertiza
Expertiza is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.
Stars: ✭ 160 (+220%)
Mutual labels:  rails, rspec
Test Prof
Ruby Tests Profiling Toolbox
Stars: ✭ 1,193 (+2286%)
Mutual labels:  rails, rspec
Crystalball
Regression Test Selection library for your RSpec test suite
Stars: ✭ 259 (+418%)
Mutual labels:  rails, rspec
Apitome
Apitome: /iˈpitəmē/ An API documentation presentation layer for RSpec API Documentation output.
Stars: ✭ 244 (+388%)
Mutual labels:  rails, rspec
Rails new
A thoughtfully designed template for building modern Rails apps. Get started in minutes instead of hours 🔥🚀
Stars: ✭ 151 (+202%)
Mutual labels:  rails, rspec
Rails Api And Angularjs
Integration between rails and angularjs which includes rspec tests.
Stars: ✭ 22 (-56%)
Mutual labels:  rails, rspec
Action Cable Testing
Action Cable testing utils
Stars: ✭ 192 (+284%)
Mutual labels:  rails, rspec
Capybara error intel
🐛 Ruby gem for heuristic error messages in Capybara based Page Objects
Stars: ✭ 16 (-68%)
Mutual labels:  rails, rspec
Heavens door
Capybara test scenario recorder for Rails
Stars: ✭ 857 (+1614%)
Mutual labels:  rails, rspec
Drag and drop active storage
A demo drag and drop image upldate Ruby on Rails app using Stimulus.js, DropZone.js, and ActiveStorage
Stars: ✭ 46 (-8%)
Mutual labels:  rails
Monarchy
Hierarchical access management system with advanced roles inheritance. 🦋
Stars: ✭ 48 (-4%)
Mutual labels:  rails
Mina Unicorn
Unicorn tasks for Mina
Stars: ✭ 44 (-12%)
Mutual labels:  rails
Super
A simple, powerful, single dependency Rails admin framework
Stars: ✭ 43 (-14%)
Mutual labels:  rails
Vscode Ruby Test Adapter
A Ruby test adapter extension for the VS Code Test Explorer
Stars: ✭ 50 (+0%)
Mutual labels:  rspec

ActionMailerMatchers

ActionMailerMatchers provides RSpec matchers to test common ActionMailer functionality.

Installation

Add this line to your application's Gemfile:

group :test do
  gem 'action_mailer_matchers', '~> 1.0'
end

And then execute:

$ bundle install

Or install it yourself as:

$ gem install action_mailer_matchers

Include ActionMailerMatchers in your RSpec config by requiring it and including in your configuration block.

require "action_mailer_matchers"

...

RSpec.configure do |config|
  config.include ActionMailerMatchers
end

Usage

ActionMailer allows you to send emails in your Rails application, ActionMailerMatchers provides you with RSpec one-liners that help you to test this functionality.

It is typical to test that an email has been delivered by doing the following:

expect { some_action.execute }
 .to change { ActionMailer::Base.deliveries.count }.by(1)

However, this does not specify what email was sent and to where. ActionMailerMatchers solves this problem by providing the have_received_email matcher, which ensures that the passed email address or user (which must respond .email) was the email's "to" address. You may also use the optional subject and body arguments to check that content matches the email you were expecting to send.

expect(some_user).to have_received_email(subject: "My great subject")
expect("[email protected]").to have_received_email(body: "Wonderful email body")

You can also test that someone has not received an email.

expect(some_user).not_to have_received_email

Emails sent to users using bcc or cc can be tested using:

expect("[email protected]").to have_received_cc_email(body: "Wonderful email body")
expect("[email protected]").to have_received_bcc_email(body: "Wonderful email body")

Contributing

  1. Fork it ( https://github.com/contently/action_mailer_matchers/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].