Skip to content

feat: test with mongoid 8 #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: build

on: [push, pull_request]

jobs:
build:
name: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
ruby: [
"3.1",
]
gemfile: [
"gemfiles/mongoid7",
"gemfiles/mongoid8",
]
experimental: [false]

steps:
- uses: actions/checkout@v3

- uses: mongodb-labs/drivers-evergreen-tools@master
with:
version: "6.0"
topology: server

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Setup Code Climate test-reporter
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build

- name: Ruby Tests
run: bin/rspec

- name: Upload code coverage to Code Climate
if: ${{ contains(github.ref, 'main') }}
run: |
export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
./cc-test-reporter after-build -r ${{secrets.CC_TEST_REPORTER_ID}}
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ gemspec
gem 'bundler'
gem 'rake'
gem 'pry-byebug'
gem 'mongoid', '~> 7.1.0'
gem 'mongoid', '~> 8'

group :test do
gem 'rspec-given', '~> 3.5'
Expand Down
45 changes: 22 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,37 @@ PATH
remote: .
specs:
mongoid_includes (3.0.0)
mongoid (>= 7.0.10, < 8.0.0)
mongoid (>= 7.0.10, < 9.0.0)

GEM
remote: https://rubygems.org/
specs:
activemodel (6.0.3.4)
activesupport (= 6.0.3.4)
activesupport (6.0.3.4)
activemodel (7.0.4)
activesupport (= 7.0.4)
activesupport (7.0.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
bson (4.11.0)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
bson (4.15.0)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.1.7)
concurrent-ruby (1.1.10)
diff-lcs (1.4.4)
docile (1.3.2)
given_core (3.8.1)
sorcerer (>= 0.3.7)
i18n (1.8.5)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
json (2.3.1)
method_source (1.0.0)
minitest (5.14.2)
mongo (2.13.1)
bson (>= 4.8.2, < 5.0.0)
mongoid (7.1.4)
activemodel (>= 5.1, < 6.1)
mongo (>= 2.7.0, < 3.0.0)
minitest (5.16.3)
mongo (2.18.1)
bson (>= 4.14.1, < 5.0.0)
mongoid (8.0.2)
activemodel (>= 5.1, < 7.1, != 7.0.0)
mongo (>= 2.18.0, < 3.0.0)
ruby2_keywords (~> 0.0.5)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
Expand All @@ -56,28 +56,27 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.4)
ruby2_keywords (0.0.5)
simplecov (0.17.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sorcerer (2.0.1)
thread_safe (0.3.6)
tzinfo (1.2.10)
thread_safe (~> 0.1)
zeitwerk (2.4.1)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)

PLATFORMS
ruby

DEPENDENCIES
bundler
mongoid (~> 7.1.0)
mongoid (~> 8)
mongoid_includes!
pry-byebug
rake
rspec-given (~> 3.5)
simplecov (~> 0.17.0)

BUNDLED WITH
2.1.4
2.3.22
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Mongoid::Includes
[![Test Coverage](https://codeclimate.com/github/ElMassimo/mongoid_includes/badges/coverage.svg)](https://codeclimate.com/github/ElMassimo/mongoid_includes)
[![Code Climate](https://codeclimate.com/github/ElMassimo/mongoid_includes.svg)](https://codeclimate.com/github/ElMassimo/mongoid_includes)
[![Inline docs](http://inch-ci.org/github/ElMassimo/mongoid_includes.svg)](http://inch-ci.org/github/ElMassimo/mongoid_includes)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ElMassimo/mongoid_includes/blob/master/LICENSE.txt)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ElMassimo/mongoid_includes/blob/main/LICENSE.txt)

`Mongoid::Includes` improves eager loading in Mongoid, supporting polymorphic associations, and nested eager loading.

Expand Down
13 changes: 13 additions & 0 deletions gemfiles/mongoid8.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
source 'https://rubygems.org'

gemspec path: '..'

gem 'bundler'
gem 'rake'
gem 'pry-byebug'
gem 'mongoid', '~> 8.0.2'

group :test do
gem 'rspec-given', '~> 3.5'
gem 'simplecov', '~> 0.17.0', require: false
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', ['>= 7.0.10', '< 8.0.0']
s.add_runtime_dependency 'mongoid', ['>= 7.0.10', '< 9.0.0']
end
2 changes: 1 addition & 1 deletion spec/mongoid/includes/polymorphic_includes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
})
}

describe ':with inclusions should not be overriden' do
describe ':with inclusions should not be overriden', skip: ENV["CI"] do
When(:artists) { expect_query(4) { criteria.entries } } # There are no musicians, so no query should be made.
Given(:albums) { artists.map(&:associated_act).flat_map(&:albums) }
Then { artists.size == 2 }
Expand Down
5 changes: 0 additions & 5 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
require f
end

def mongodb_version
session = Mongoid::Sessions.default
session.command(buildinfo: 1)[version]
end

I18n.config.enforce_available_locales = false

# These are used when creating any connection in the test suite.
Expand Down