Sha256: e8cf0af829b55f4f32d212a3a42208e984e8e57160821a152eadb6951afdb8bf
Contents?: true
Size: 1.09 KB
Versions: 25
Compression:
Stored size: 1.09 KB
Contents
require "spec_helper" RSpec.describe CanvasSync::LiveEvents::ProcessEventJob do before(:all) do User.include(CanvasSync::Concerns::LiveEventSync) end let(:event) { { "metadata" => { event_name: "user_created", }, "payload" => { user_id: 1, }, } } describe "#perform" do it "invokes a legacy handler if present" do expect(LiveEvents::UserCreatedEvent).to receive(:perform_later) described_class.perform_now(event) end it "does not invoke new handlers if legacy is present" do expect(CanvasSync::LiveEvents).to_not receive(:registered_handlers) described_class.perform_now(event) end it "invokes new handlers" do hide_const("LiveEvents::UserCreatedEvent") expect(CanvasSync::LiveEvents).to receive(:registered_handlers).and_call_original expect(User).to receive(:cs_internal_process_live_event).and_call_original expect_any_instance_of(User).to receive(:process_live_event).with(:created, event["payload"], event["metadata"]) described_class.perform_now(event) end end end
Version data entries
25 entries across 25 versions & 1 rubygems