Sha256: 20af41537335764a3c95c0c45f37b0f1023f010389d08a1c62b5ce0e12a10acc
Contents?: true
Size: 1.3 KB
Versions: 7
Compression:
Stored size: 1.3 KB
Contents
require "spec_helper" RSpec.describe LiveEvents::ModuleEvent do let(:payload) { { "body" => { module_id: "1", name: "Module 2", position: 1337, workflow_state: "active", context_id: 1, context_type: "Course", }, } } describe "#perform" do context "the module already exists" do let!(:context_module) { FactoryBot.create(:context_module, canvas_id: payload["body"][:module_id]) } xit "updates it" do expect { LiveEvents::ModuleEvent.new.perform(payload) }.to_not change { ContextModule.count } expect(context_module.reload.name).to eq(payload["body"][:name]) expect(context_module.position).to eq(payload["body"][:position]) expect(context_module.workflow_state).to eq(payload["body"][:workflow_state]) end end context "the module does not already exist" do xit "creates it" do expect { LiveEvents::ModuleEvent.new.perform(payload) }.to change { ContextModule.count }.by(1) expect(ContextModule.last.name).to eq(payload["body"][:name]) expect(ContextModule.last.position).to eq(payload["body"][:position]) expect(ContextModule.last.workflow_state).to eq(payload["body"][:workflow_state]) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems