README.md in email_spec-2.0.0 vs README.md in email_spec-2.1.0

- old
+ new

@@ -1,14 +1,13 @@ [![Build Status](https://secure.travis-ci.org/email-spec/email-spec.png)](http://travis-ci.org/email-spec/email-spec) ## Email Spec -A collection of matchers for RSpec, MiniTest and Cucumber steps to make testing emails go smoothly. +A collection of matchers for `RSpec`, `MiniTest` and `Cucumber` steps to make testing emails go smoothly. -This library works with ActionMailer and Pony. When using it with ActionMailer it works with -ActiveRecord Mailer, and action_mailer_cache_delivery. +This library works with `ActionMailer` and `Pony`. When using it with ActionMailer it works with ActiveRecord Mailer, and [action_mailer_cache_delivery](https://rubygems.org/gems/action_mailer_cache_delivery). If you are testing emails in conjunction with an automated browser solution, like Selenium, you will want to use [action_mailer_cache_delivery](http://rubygems.org/gems/action_mailer_cache_delivery) in your test environment. (This is because your test process and server processes are distinct and therefore need an intermediate store for the emails.) ActiveRecord Mailer will also work but @@ -31,24 +30,21 @@ # Make sure this require is after you require cucumber/rails/world. require 'email_spec' # add this line if you use spork require 'email_spec/cucumber' ``` -This will load all the helpers that the steps rely on. -It will also add a Before hook for Cucumber so that emails are cleared at the start of each scenario. +This will load all the helpers that the steps rely on. It will also add a `Before` hook for `Cucumber` so that emails are cleared at the start of each scenario. Then: ```bash rails generate email_spec:steps ``` -This will give you a bunch of steps to get started with in step_definitions/email_steps.rb +This will give you a bunch of steps to get started with in `step_definitions/email_steps.rb` -By default, the generated file will look for email to example@example.com. You can either change this -by editing the current_email_address method in email_steps.rb, or by simply specifying the target -email in your features: +By default, the generated file will look for email to example@example.com. You can either change this by editing the `current_email_address` method in `email_steps.rb`, or by simply specifying the target email in your features: ```gherkin Scenario: A new person signs up Given I am at "/" When I fill in "Email" with "quentin@example.com" @@ -60,32 +56,15 @@ First you need to require email_spec in your spec_helper.rb: ```ruby require "email_spec" +require "email_spec/rspec" ``` -You will then need to include EmailSpec::Helpers and EmailSpec::Matchers in your example groups. -If you want to have access to the helpers and matchers in all of your examples you can do the following in your spec_helper.rb: +This will load all the helpers that the scenarios can count on. It will also add a `before(:each)` hook so that emails are cleared at the start of each scenario. -```ruby -RSpec.configure do |config| - config.include(EmailSpec::Helpers) - config.include(EmailSpec::Matchers) -end -``` - -Otherwise, you will need to include them in the example groups you wish to use them: - -```ruby -describe "Signup Email" do - include EmailSpec::Helpers - include EmailSpec::Matchers - ... -end -``` - ### MiniTest First you need to require minitest-matchers and email_spec in your test_helper.rb: ```ruby @@ -221,11 +200,11 @@ email = UserMailer.create_signup("jojo@yahoo.com", "Jojo Binks") expect(email).to reply_to("support@myapp.com") ``` -##### deliver_to(*email_addresses) +##### deliver_to(\*email_addresses) alias: `be_delivered_to` This checks that the To header's email addresses (the bob@example.com of "Bob Saget <bob@example.com>") are set to the addresses. @@ -245,22 +224,22 @@ email = UserMailer.create_signup("jojo@yahoo.com", "Jojo Binks") expect(email).to deliver_from("sally@yahoo.com") ``` -##### bcc_to(*email_addresses) +##### bcc_to(\*email_addresses) This checks that the BCC header's email addresses (the bob@example.com of "Bob Saget <bob@example.com>") are set to the addresses. ```ruby email = UserMailer.create_signup("jojo@yahoo.com", "Jojo Binks") expect(email).to bcc_to("sue@yahoo.com", "bill@yahoo.com") ``` -##### cc_to(*email_addresses) +##### cc_to(\*email_addresses) This checks that the CC header's email addresses (the bob@example.com of "Bob Saget <bob@example.com>") are set to the addresses. ```ruby @@ -336,11 +315,10 @@ ```ruby email = UserMailer.create_signup "jojo@yahoo.com", "Jojo Binks" assert_must deliver_to("jojo@yahoo.com"), email ``` - ## Original Authors Ben Mabey, Aaron Gibralter, Mischa Fierer -Please see History.txt for upcoming changesets and other contributors. +Please see [Changelog.md](Changelog.md) for upcoming changes and other contributors.