Permalink
Browse files

Add Mongoid 3 compatibility

  • Loading branch information...
laserlemon committed Aug 15, 2012
1 parent 930e1e0 commit d4f2583d4985ab767f261046396d65f504d0c2e4
Showing with 25 additions and 2 deletions.
  1. +7 −0 .travis.yml
  2. +11 −0 gemfiles/mongoid/3-0.gemfile
  3. +1 −1 periscope-mongoid.gemspec
  4. +6 −1 spec/support/adapters/mongoid/connection.rb
View
@@ -17,6 +17,13 @@ gemfile:
- gemfiles/mongoid/2-2.gemfile
- gemfiles/mongoid/2-3.gemfile
- gemfiles/mongoid/2-4.gemfile
+ - gemfiles/mongoid/3-0.gemfile
- gemfiles/data_mapper/1-0.gemfile
- gemfiles/data_mapper/1-1.gemfile
- gemfiles/data_mapper/1-2.gemfile
+matrix:
+ exclude:
+ - rvm: 1.8.7
+ gemfile: gemfiles/mongoid/3-0.gemfile
+ - rvm: 1.9.2
+ gemfile: gemfiles/mongoid/3-0.gemfile
@@ -0,0 +1,11 @@
+source 'https://rubygems.org'
+
+if RUBY_VERSION == '1.8.7'
+ gem 'factory_girl', '~> 2.0'
+end
+
+gem 'mongoid', '~> 3.0.0'
+
+gemspec :name => 'periscope-mongoid', :path => '../../'
+
+gem 'rake', '~> 0.9.0'
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
gem.summary = gem.description
gem.homepage = 'https://github.com/laserlemon/periscope'
- gem.add_dependency 'mongoid', '~> 2.0'
+ gem.add_dependency 'mongoid', '>= 2', '< 4'
gem.add_dependency 'periscope', '~> 1.0'
gem.add_development_dependency 'database_cleaner', '~> 0.8'
@@ -1,3 +1,8 @@
require 'mongoid'
+require 'mongoid/version'
-Mongoid.master = Mongo::Connection.new.db('periscope_test')
+if Mongoid::VERSION >= '3'
+ Mongoid.connect_to('periscope_test')
+else
+ Mongoid.master = Mongo::Connection.new.db('periscope_test')
+end

0 comments on commit d4f2583

Please sign in to comment.