File tree Expand file tree Collapse file tree
spec/modelscope/integration Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33RSpec . describe CallbackHell , "with attribute-generated callbacks and validations" do
4+ def normalization_supported?
5+ ActiveRecord ::Base . respond_to? ( :normalizes )
6+ end
47 subject ( :foo ) { CallbackHell ::Collector . new ( Foo , mode : :full ) . collect }
58 subject ( :bar ) { CallbackHell ::Collector . new ( Bar , mode : :full ) . collect }
69
710 it "correctly marks the callbacks generated by attributes" do
11+ skip "Normalization not supported in this Rails version" unless normalization_supported?
812 expect ( foo ) . to have_callback (
913 callback_name : :before_validate ,
1014 method_name : :cant_modify_encrypted_attributes_when_frozen ,
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33RSpec . describe CallbackHell , "with an empty ActiveRecord" do
4+ def normalization_supported?
5+ ActiveRecord ::Base . respond_to? ( :normalizes )
6+ end
7+
48 let ( :options ) { { } }
59 subject ( :ar ) { CallbackHell ::Collector . new ( ApplicationRecord , **options ) . collect }
610
1822 method_name : :cant_modify_encrypted_attributes_when_frozen ,
1923 origin : :rails , inherited : false
2024 )
21- expect ( ar ) . to have_callback (
22- method_name : :normalize_changed_in_place_attributes ,
23- origin : :rails , inherited : false
24- )
25+ if normalization_supported?
26+ expect ( ar ) . to have_callback (
27+ method_name : :normalize_changed_in_place_attributes ,
28+ origin : :rails , inherited : false
29+ )
30+ end
2531 end
2632 end
2733end
You can’t perform that action at this time.
0 commit comments