File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,25 @@ class BindParameterTest < ActiveRecord::TestCase
151151end
152152
153153
154-
154+ module ActiveRecord
155+ class InstrumentationTest < ActiveRecord ::TestCase
156+ # This fails randomly due to schema cache being lost?
157+ coerce_tests! :test_payload_name_on_load
158+ def test_payload_name_on_load_coerced
159+ Book . create ( name : "test book" )
160+ Book . first
161+ subscriber = ActiveSupport ::Notifications . subscribe ( "sql.active_record" ) do |*args |
162+ event = ActiveSupport ::Notifications ::Event . new ( *args )
163+ if event . payload [ :sql ] . match "SELECT"
164+ assert_equal "Book Load" , event . payload [ :name ]
165+ end
166+ end
167+ Book . first
168+ ensure
169+ ActiveSupport ::Notifications . unsubscribe ( subscriber ) if subscriber
170+ end
171+ end
172+ end
155173
156174class CalculationsTest < ActiveRecord ::TestCase
157175 # This fails randomly due to schema cache being lost?
You can’t perform that action at this time.
0 commit comments