README.md in valid_email2-3.0.1 vs README.md in valid_email2-3.0.2
- old
+ new
@@ -96,14 +96,23 @@
If you are validating `mx` then your specs will fail without an internet connection.
It is a good idea to stub out that validation in your test environment.
Do so by adding this in your `spec_helper`:
```ruby
config.before(:each) do
- allow_any_instance_of(ValidEmail2::Address).to receive(:valid_mx?) { true }
+ allow_any_instance_of(ValidEmail2::Address).to receive(:valid_mx?).and_return(true)
end
```
+Validating `disposable` e-mails triggers a `mx` validation alongside checking if
+the domain is disposable. The above stub does not apply to the `disposable`
+validation and should therefore be individually stubbed with:
+```ruby
+config.before(:each) do
+ allow_any_instance_of(ValidEmail2::Address).to receive(:mx_server_is_in?).and_return(false)
+end
+```
+
## Requirements
This gem requires Rails 3.2 or 4.0 or higher. It is tested against both versions using:
* Ruby-2.3
* Ruby-2.4
@@ -115,9 +124,13 @@
In version v3.0.0 I decided to move __and__ rename the config files from the
vendor directory to the config directory. That means:
`vendor/blacklist.yml` -> `config/blacklisted_email_domains.yml`
`vendor/whitelist.yml` -> `config/whitelisted_email_domains.yml`
+
+The `disposable` validation has been improved with a `mx` check. Apply the
+stub, as noted in the Test environment section, if your tests have slowed
+down or if they do not work without an internet connection.
## Upgrading to v2.0.0
In version 1.0 of valid_email2 we only defined the `email` validator.
But since other gems also define a `email` validator this can cause some unintended