Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Eager load ActionMailer::Base

  • Loading branch information...
commit 3a8b1381c24bf4cededb67ece654fd4d21fd8fd9 1 parent c1b0cfd
@bcardarella bcardarella authored
Showing with 15 additions and 4 deletions.
  1. +3 −2 Gemfile
  2. +9 −0 lib/capybara-email.rb
  3. +3 −2 spec/spec_helper.rb
View
5 Gemfile
@@ -1,6 +1,7 @@
source 'https://rubygems.org'
-if RUBY_VERSION >= '1.9.2' && RUBY_ENGINE == 'ruby'
- gem 'debugger'
+if RUBY_VERSION >= '2.0'
+ gem 'byebug'
end
+
gemspec
View
9 lib/capybara-email.rb
@@ -1,5 +1,14 @@
require 'capybara'
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
autoload :Email, 'capybara/email'
end
View
5 spec/spec_helper.rb
@@ -1,9 +1,10 @@
require 'rubygems'
+require 'bundler/setup'
+
begin
- require 'debugger'
+ require 'byebug'
rescue LoadError
end
-require 'bundler/setup'
RSpec.configure do |config|
config.mock_with :mocha
Please sign in to comment.
Something went wrong with that request. Please try again.