File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed
dummy_app/app/active_record Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change 92
92
factory :paper_trail_test_subclass_in_namespace ,
93
93
parent : :paper_trail_test ,
94
94
class : 'PaperTrailTest::SubclassInNamespace'
95
+
96
+ factory :paper_trail_test_with_custom_association ,
97
+ parent : :paper_trail_test ,
98
+ class : 'PaperTrailTestWithCustomAssociation'
95
99
end
96
100
end
Original file line number Diff line number Diff line change 106
106
end
107
107
108
108
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 )
110
110
end
111
111
end
112
112
143
143
end
144
144
end
145
145
146
- context 'PaperTrailTest ' do
146
+ context 'with a normal PaperTrail model ' do
147
147
let ( :paper_class_name ) { 'PaperTrailTest' }
148
148
let ( :paper_factory ) { :paper_trail_test }
149
149
155
155
it_behaves_like :paper_history
156
156
end
157
157
158
- context 'PaperTrailTestSubclass ' do
158
+ context 'with a subclassed PaperTrail model ' do
159
159
let ( :paper_class_name ) { 'PaperTrailTestSubclass' }
160
160
let ( :paper_factory ) { :paper_trail_test_subclass }
161
161
167
167
it_behaves_like :paper_history
168
168
end
169
169
170
- context 'PaperTrailTest::SubclassInNamespace ' do
170
+ context 'with a namespaced PaperTrail model ' do
171
171
let ( :paper_class_name ) { 'PaperTrailTest::SubclassInNamespace' }
172
172
let ( :paper_factory ) { :paper_trail_test_subclass_in_namespace }
173
173
178
178
179
179
it_behaves_like :paper_history
180
180
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
181
188
end
You can’t perform that action at this time.
0 commit comments