Skip to content

Commit 794f081

Browse files
committed
Add an integration spec showing forwardable regression
1 parent 5378d7d commit 794f081

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ group :development, :test do
2929

3030
gem 'mongoid-compatibility'
3131
gem 'mongoid-danger', '~> 0.2.0'
32+
gem 'mongoid-history'
3233
gem 'rspec', '~> 3.9'
3334
gem 'rubocop', '0.81.0'
3435
gem 'rubocop-rspec', '1.38.1'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# frozen_string_literal: true
2+
3+
require 'mongoid-history'
4+
5+
# This replicates the exception reported at https://github.com/mongoid/mongoid-history/issues/238#issuecomment-1063155193
6+
# when mongoid-locker required 'forwardable' instead of relying on the
7+
# active support-provided delegation method
8+
RSpec.describe 'MongoidHistory' do # rubocop:disable RSpec/DescribeClass
9+
# rubocop:disable RSpec/ExampleLength
10+
it 'does not raise an exception' do
11+
expect do
12+
Class.new do
13+
include Mongoid::Document
14+
include Mongoid::Locker
15+
include Mongoid::History::Trackable
16+
17+
field :title
18+
19+
track_history on: [:title]
20+
end
21+
end.not_to raise_exception
22+
end
23+
# rubocop:enable RSpec/ExampleLength
24+
end

spec/spec_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
ENV['RACK_ENV'] = 'test'
44

5+
require 'logger' # Required for compatibility with activesupport 7
6+
57
if ENV['COVERAGE']
68
require 'simplecov'
79
require 'simplecov_json_formatter'

0 commit comments

Comments
 (0)