spec/config/environment.rb in pry-rails-0.3.6 vs spec/config/environment.rb in pry-rails-0.3.7
- old
+ new
@@ -2,10 +2,15 @@
require 'rails/all'
require 'active_support/core_ext'
require 'pry-rails'
+begin
+ require 'mongoid'
+rescue LoadError # Mongoid doesn't support Rails 3.0
+end
+
# Initialize our test app
class TestApp < Rails::Application
config.active_support.deprecation = :log
config.eager_load = false
@@ -56,13 +61,11 @@
class Pokemon < ActiveRecord::Base
belongs_to :hacker
has_many :beers, :through => :hacker
end
-begin
- require 'mongoid'
-
+if defined?(Mongoid)
class Artist
include Mongoid::Document
field :name, :type => String
embeds_one :beer
@@ -73,7 +76,6 @@
include Mongoid::Document
field :name, :type => String
embedded_in :artist
end
-rescue LoadError # Mongoid doesn't support Rails 3.0
end