Skip to content

Back port pull request #1388 from rspec/fix-regression-mailer-preview-path #1389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 5, 2015

Conversation

cupakromer
Copy link
Member

Just a sanity check on the rails versions.

This fixes the spec suite to expose issues with `ActionMailer` being
configured incorrectly when previews are not available.

This addresses several issues:

- The incorrect configuration options are only exposed once
  `ActionMailer::Base` is loaded; this forces the class to load in the
  mailer initializer and at the end of our script
- This adds specs specifically for the "development" environment which
  were missing before; it appeared that by not setting the environment
  it would default to "development" per the script, however, when the
  command shells out the `RAILS_ENV` is already set to "test" from rspec
  running.

  To be certain we cover the other possible edge cases we specifically
  add more tests for `ActionMailer` not being available, and for a
  custom configuration being set after `rspec-rails` is loaded.
- Despite us asking Rails to turn off eager loading in our custom
  script, several files were still getting eager loaded; this
  explicitly clears the eager load paths to stop this
- This fixes how the mailer script is shelled out in Ruby 1.8.7; now the
  environment variables are properly formatted and standard error is
  piped to standard out

Exposes the regression issue in #1386
The `preview_path` feature of `ActionMailer` was added in Rails 4.1.
Versions before that release are not able to handle that configuration.
The regression issue occurred in part to the spec suite overlooking
changes to the environment and how that affects the shelling out.

Additionally, the previous changes noted that the configuration for a
particular module always responds to a setting; even when it should not.
However, while this logic was noted for `show_previews`, a few lines
further down, that same logic was overlooked for `preview_path`.

It appears the only available methods for detecting `ActionMailer`, and
it's features, is tasting the top-level `config` in addition to checking
the Rails version string.
cupakromer added a commit that referenced this pull request Jun 5, 2015
Back port pull request #1388 from rspec/fix-regression-mailer-preview-path
@cupakromer cupakromer merged commit bc5a168 into 3-2-maintenance Jun 5, 2015
@cupakromer cupakromer deleted the backport-1388 branch June 5, 2015 23:20
@cupakromer
Copy link
Member Author

@myronmarston all merged and green

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant