Skip to content

Commit 15fb427

Browse files
committed
Failing spec for railsadminteam#3354
1 parent 555f778 commit 15fb427

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class PaperTrailTestWithCustomAssociation < ActiveRecord::Base
2+
self.table_name = :paper_trail_tests
3+
if PaperTrail::VERSION::MAJOR >= 10
4+
has_paper_trail versions: {name: :trails}
5+
else
6+
has_paper_trail versions: :trails
7+
end
8+
end

spec/factories.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,9 @@
9292
factory :paper_trail_test_subclass_in_namespace,
9393
parent: :paper_trail_test,
9494
class: 'PaperTrailTest::SubclassInNamespace'
95+
96+
factory :paper_trail_test_with_custom_association,
97+
parent: :paper_trail_test,
98+
class: 'PaperTrailTestWithCustomAssociation'
9599
end
96100
end

spec/integration/history/rails_admin_paper_trail_spec.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
end
107107

108108
it '#table returns item class name' do
109-
expect(@version.table.to_s).to eq('PaperTrailTest')
109+
expect(@version.table.to_s).to eq(@model.model.base_class.name)
110110
end
111111
end
112112

@@ -143,7 +143,7 @@
143143
end
144144
end
145145

146-
context 'PaperTrailTest' do
146+
context 'with a normal PaperTrail model' do
147147
let(:paper_class_name) { 'PaperTrailTest' }
148148
let(:paper_factory) { :paper_trail_test }
149149

@@ -155,7 +155,7 @@
155155
it_behaves_like :paper_history
156156
end
157157

158-
context 'PaperTrailTestSubclass' do
158+
context 'with a subclassed PaperTrail model' do
159159
let(:paper_class_name) { 'PaperTrailTestSubclass' }
160160
let(:paper_factory) { :paper_trail_test_subclass }
161161

@@ -167,7 +167,7 @@
167167
it_behaves_like :paper_history
168168
end
169169

170-
context 'PaperTrailTest::SubclassInNamespace' do
170+
context 'with a namespaced PaperTrail model' do
171171
let(:paper_class_name) { 'PaperTrailTest::SubclassInNamespace' }
172172
let(:paper_factory) { :paper_trail_test_subclass_in_namespace }
173173

@@ -178,4 +178,11 @@
178178

179179
it_behaves_like :paper_history
180180
end
181+
182+
context 'with a PaperTrail model with custom version association name' do
183+
let(:paper_class_name) { 'PaperTrailTestWithCustomAssociation' }
184+
let(:paper_factory) { :paper_trail_test_with_custom_association }
185+
186+
it_behaves_like :paper_history
187+
end
181188
end

0 commit comments

Comments
 (0)