1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

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_24.gemfile
- gemfiles/mongoid_30.gemfile - gemfiles/mongoid_30.gemfile
- gemfiles/mongoid_31.gemfile - gemfiles/mongoid_31.gemfile
- gemfiles/mongoid_40.gemfile
- gemfiles/sinatra_13.gemfile - gemfiles/sinatra_13.gemfile
- gemfiles/sinatra_14.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 end
Mongoid.configure do |config| Mongoid.configure do |config|
if Mongoid::VERSION =~ /^3/ if Mongoid::VERSION > '3.0.0'
config.sessions = {:default => {:hosts => ['localhost:27017'], :database => 'kaminari_test'}} config.sessions = {:default => {:hosts => ['localhost:27017'], :database => 'kaminari_test'}}
else else
config.master = Mongo::Connection.new.db('kaminari_test') config.master = Mongo::Connection.new.db('kaminari_test')

View file

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

View file

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