Sha256: cef00311c56397bb4d5b11be0f393ce9f029ab592d6d3698ea8c00ce89d0c10d
Contents?: true
Size: 1.53 KB
Versions: 5
Compression:
Stored size: 1.53 KB
Contents
require "spec_helper" RSpec.describe LiveEvents::ModuleItemEvent do let(:payload) { { "body" => { module_item_id: 1, module_id: 1, context_id: 1, context_type: "assignment", position: 10, workflow_state: "active", }, } } describe "#perform" do context "the module item already exists" do let!(:cmi) { FactoryBot.create(:context_module_item, canvas_id: payload["body"][:module_item_id]) } xit "updates it" do expect { LiveEvents::ModuleItemEvent.new.perform(payload) }.to_not change { ContextModuleItem.count } expect(cmi.reload.canvas_id).to eq(payload["body"][:module_item_id]) expect(cmi.position).to eq(payload["body"][:position]) expect(cmi.workflow_state).to eq(payload["body"][:workflow_state]) expect(cmi.canvas_content_type).to eq("Assignment") expect(cmi.canvas_content_id).to eq(143) end end context "the module item does not already exist" do xit "creates it" do expect { LiveEvents::ModuleItemEvent.new.perform(payload) }.to change { ContextModuleItem.count }.by(1) cmi = ContextModuleItem.last expect(cmi.canvas_id).to eq(payload["body"][:module_item_id]) expect(cmi.position).to eq(payload["body"][:position]) expect(cmi.workflow_state).to eq(payload["body"][:workflow_state]) expect(cmi.canvas_content_type).to eq("Assignment") expect(cmi.canvas_content_id).to eq(143) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems