Skip to content

Commit

Permalink
Merge pull request #3 from feedbackfruits/master
Browse files Browse the repository at this point in the history
Add mongoid 6 support
  • Loading branch information
ElMassimo committed May 26, 2016
2 parents 9011459 + 4b34688 commit ed50460
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ bundler_args: --without development
rvm:
- 2.0.0
- 2.1.1
- 2.2
- 2.2.2

gemfile:
- Gemfile
- gemfiles/mongoid4.gemfile
- gemfiles/mongoid6.gemfile

env:
global:
Expand All @@ -19,6 +20,13 @@ env:
- MONGODB=2.4.14
- MONGODB=2.6.10

matrix:
exclude:
- rvm: 2.0.0
gemfile: gemfiles/mongoid6.gemfile
- rvm: 2.1.1
gemfile: gemfiles/mongoid6.gemfile

before_script:
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz -O /tmp/mongodb.tgz
- tar -xvf /tmp/mongodb.tgz
Expand Down
18 changes: 18 additions & 0 deletions gemfiles/mongoid6.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
source 'https://rubygems.org'

gemspec path: '..'

gem 'bundler'
gem 'rake'
gem 'pry'
gem 'mongoid', github: 'mongodb/mongoid', ref: '7c2ff52a0c5292b8e6bf3a9a29bbb19abae3dd5f'

group :test do
gem 'rspec-given', '~> 3.5'
gem 'codeclimate-test-reporter', require: nil
end

group :doc do
gem 'yard'
gem 'yard-tomdoc'
end
2 changes: 1 addition & 1 deletion mongoid_includes.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ Gem::Specification.new do |s|
s.files = Dir.glob('lib/**/*') + %w(CHANGELOG.md LICENSE.txt README.md Rakefile)
s.test_files = Dir.glob('spec/**/*')

s.add_runtime_dependency 'mongoid', ['>= 4.0.0', '< 6.0.0']
s.add_runtime_dependency 'mongoid', ['>= 4.0.0', '< 7.0.0']
end
7 changes: 6 additions & 1 deletion spec/support/models/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ class Game
field :name

belongs_to :person, index: true, validate: true
belongs_to :parent, class_name: "Game", foreign_key: "parent-id"

if Mongoid::VERSION >= "6.0.0"
belongs_to :parent, class_name: "Game", foreign_key: "parent-id", optional: true
else
belongs_to :parent, class_name: "Game", foreign_key: "parent-id"
end

accepts_nested_attributes_for :person

Expand Down

0 comments on commit ed50460

Please sign in to comment.