Sha256: ed6dd0b22a34d71589e045ba8b8e5e3b8334cf01ce63b1845ffe592d47dda13c
Contents?: true
Size: 1.16 KB
Versions: 6
Compression:
Stored size: 1.16 KB
Contents
require "helper" class ModelInstrumentationTest < ActiveSupport::TestCase setup :setup_subscriber teardown :teardown_subscriber def setup_subscriber @subscriber = Nunes::Subscribers::ActiveRecord.subscribe(adapter) end def teardown_subscriber ActiveSupport::Notifications.unsubscribe @subscriber if @subscriber end test "transaction" do Post.create(title: 'Testing') assert_timer "active_record.sql.transaction_begin" assert_timer "active_record.sql.transaction_commit" end test "create" do Post.create(title: 'Testing') assert_timer "active_record.sql" assert_timer "active_record.sql.insert" end test "update" do post = Post.create adapter.clear post.update_attributes(title: "Title") assert_timer "active_record.sql" assert_timer "active_record.sql.update" end test "find" do post = Post.create adapter.clear Post.find(post.id) assert_timer "active_record.sql" assert_timer "active_record.sql.select" end test "destroy" do post = Post.create adapter.clear post.destroy assert_timer "active_record.sql" assert_timer "active_record.sql.delete" end end
Version data entries
6 entries across 6 versions & 1 rubygems