Class: RSpec::Rails::Railtie
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Rails::Railtie
|
|
Instance Chain:
self,
Rails::Railtie
|
|
Inherits: |
Rails::Railtie
|
Defined in: | rspec-rails/lib/rspec-rails.rb |
Overview
Railtie
to hook into ::RSpec::Rails
.
Instance Method Summary
-
#config_default_preview_path(options)
private
See additional method definition at line 68.
- #config_preview_path?(options) ⇒ Boolean private
- #setup_preview_path(app) private
- #supports_action_mailer_previews?(config) ⇒ Boolean private
Instance Method Details
#config_default_preview_path(options) (private)
See additional method definition at line 68.
#config_preview_path?(options) ⇒ Boolean
(private)
# File 'rspec-rails/lib/rspec-rails.rb', line 57
def config_preview_path?( ) # We cannot use `respond_to?(:show_previews)` here as it will always # return `true`. if .show_previews.nil? .show_previews = ::Rails.env.development? else .show_previews end end
#setup_preview_path(app) (private)
[ GitHub ]# File 'rspec-rails/lib/rspec-rails.rb', line 50
def setup_preview_path(app) return unless supports_action_mailer_previews?(app.config) = app.config.action_mailer config_default_preview_path( ) if config_preview_path?( ) end
#supports_action_mailer_previews?(config) ⇒ Boolean
(private)
# File 'rspec-rails/lib/rspec-rails.rb', line 81
def supports_action_mailer_previews?(config) # These checks avoid loading `ActionMailer`. Using `defined?` has the # side-effect of the class getting loaded if it is available. This is # problematic because loading `ActionMailer::Base` will cause it to # read the config settings; this is the only time the config is read. # If the config is loaded now, any settings declared in a config block # in an initializer will be ignored. # # If the action mailer railtie has not been loaded then `config` will # not respond to the method. However, we cannot use # `config.action_mailer.respond_to?(:preview_path)` here as it will # always return `true`. config.respond_to?(:action_mailer) end