Skip to content

Commit

Permalink
Eager load ActionMailer::Base
Browse files Browse the repository at this point in the history
  • Loading branch information
bcardarella committed Jun 10, 2013
1 parent c1b0cfd commit 3a8b138
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Gemfile
@@ -1,6 +1,7 @@
source 'https://rubygems.org' source 'https://rubygems.org'


if RUBY_VERSION >= '1.9.2' && RUBY_ENGINE == 'ruby' if RUBY_VERSION >= '2.0'
gem 'debugger' gem 'byebug'
end end

gemspec gemspec
9 changes: 9 additions & 0 deletions lib/capybara-email.rb
@@ -1,5 +1,14 @@
require 'capybara' require 'capybara'
require 'mail' require 'mail'

if defined?(ActionMailer)
# Rails 4's ActionMailer::Base is autoloaded
# so in the test suite the Mail constant is not
# available untl ActionMailer::Base is eval'd
# So we must eager-load it
ActionMailer::Base
end

module Capybara module Capybara
autoload :Email, 'capybara/email' autoload :Email, 'capybara/email'
end end
5 changes: 3 additions & 2 deletions spec/spec_helper.rb
@@ -1,9 +1,10 @@
require 'rubygems' require 'rubygems'
require 'bundler/setup'

begin begin
require 'debugger' require 'byebug'
rescue LoadError rescue LoadError
end end
require 'bundler/setup'


RSpec.configure do |config| RSpec.configure do |config|
config.mock_with :mocha config.mock_with :mocha
Expand Down

0 comments on commit 3a8b138

Please sign in to comment.