@@ -26,22 +26,24 @@ def original_dump_schema_information; end
2626
2727 let ( :instance ) { instance_class . new }
2828
29- it 'calls SchemaMigrations touch_all and skips original implementation' do
30- allow ( Code0 ::ZeroTrack ::Database ::SchemaMigrations ) . to receive ( :touch_all )
31- allow ( instance ) . to receive ( :original_dump_schema_information )
29+ context 'when using Rails < 8.1' , if : Rails . gem_version < Gem ::Version . create ( '8.1' ) do
30+ it 'calls SchemaMigrations touch_all and skips original implementation' do
31+ allow ( Code0 ::ZeroTrack ::Database ::SchemaMigrations ) . to receive ( :touch_all )
32+ allow ( instance ) . to receive ( :original_dump_schema_information )
3233
33- instance . dump_schema_information
34+ instance . dump_schema_information
3435
35- expect ( Code0 ::ZeroTrack ::Database ::SchemaMigrations ) . to have_received ( :touch_all ) . with ( instance )
36- expect ( instance ) . not_to have_received ( :original_dump_schema_information )
37- end
36+ expect ( Code0 ::ZeroTrack ::Database ::SchemaMigrations ) . to have_received ( :touch_all ) . with ( instance )
37+ expect ( instance ) . not_to have_received ( :original_dump_schema_information )
38+ end
3839
39- it 'does not call touch_all in production' do
40- allow ( Rails ) . to receive ( :env ) . and_return ( ActiveSupport ::StringInquirer . new ( 'production' ) )
41- allow ( Code0 ::ZeroTrack ::Database ::SchemaMigrations ) . to receive ( :touch_all )
40+ it 'does not call touch_all in production' do
41+ allow ( Rails ) . to receive ( :env ) . and_return ( ActiveSupport ::StringInquirer . new ( 'production' ) )
42+ allow ( Code0 ::ZeroTrack ::Database ::SchemaMigrations ) . to receive ( :touch_all )
4243
43- instance . dump_schema_information
44+ instance . dump_schema_information
4445
45- expect ( Code0 ::ZeroTrack ::Database ::SchemaMigrations ) . not_to have_received ( :touch_all )
46+ expect ( Code0 ::ZeroTrack ::Database ::SchemaMigrations ) . not_to have_received ( :touch_all )
47+ end
4648 end
4749end
0 commit comments