Add tests for mongoid 4 beta 1

This commit is contained in:
Arthur Neves 2014-02-02 14:23:46 -05:00
parent c347875085
commit 03a4518635
5 changed files with 21 additions and 2 deletions

View File

@ -21,6 +21,7 @@ gemfile:
- gemfiles/mongoid_24.gemfile
- gemfiles/mongoid_30.gemfile
- gemfiles/mongoid_31.gemfile
- gemfiles/mongoid_40.gemfile
- gemfiles/sinatra_13.gemfile
- gemfiles/sinatra_14.gemfile

View File

@ -0,0 +1,14 @@
source 'https://rubygems.org'
gem 'railties', '~> 4.0'
gem "mongoid", "~> 4.0.0.beta1"
gem 'rspec-rails', '>= 2.0'
platforms :rbx do
gem 'rubysl', '~> 2.0'
gem 'racc'
gem 'rubysl-test-unit'
gem 'rubinius-developer_tools'
end
gemspec :path => '../'

View File

@ -8,7 +8,7 @@ if RUBY_VERSION >= '1.9.2'
end
Mongoid.configure do |config|
if Mongoid::VERSION =~ /^3/
if Mongoid::VERSION > '3.0.0'
config.sessions = {:default => {:hosts => ['localhost:27017'], :database => 'kaminari_test'}}
else
config.master = Mongo::Connection.new.db('kaminari_test')

View File

@ -1,5 +1,9 @@
class User
include ::Mongoid::Document
if Mongoid::VERSION > '4.0.0'
include Mongoid::Attributes::Dynamic
end
field :name, :type => String
field :age, :type => Integer
end

View File

@ -98,7 +98,7 @@ if defined? Mongoid
end
shared_examples 'complete valid pagination' do
if Mongoid::VERSION =~ /^3/
if Mongoid::VERSION > '3.0.0'
its(:selector) { should == {'salary' => 1} }
else
its(:selector) { should == {:salary => 1} }