Sha256: d3e7c9c627cddb6a03261907033fff4325395fa5fd9bab0d2f9029264eec0c82
Contents?: true
Size: 1.53 KB
Versions: 135
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) { FactoryGirl.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
135 entries across 135 versions & 1 rubygems