Sha256: 47149ccfad9ff306c075e827716bffb11d8a1a57f5570c45ecea201d21244fd6
Contents?: true
Size: 1.12 KB
Versions: 9
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true require "spec_helper" module Decidim module Pages describe CreatePage, :db do describe "call" do let(:feature) { create(:feature, manifest_name: "pages") } let(:command) { described_class.new(feature) } describe "when the page is not saved" do before do expect_any_instance_of(Page).to receive(:save).and_return(false) end it "broadcasts invalid" do expect { command.call }.to broadcast(:invalid) end it "doesn't create a page" do expect do command.call end.not_to change { Page.count } end end describe "when the page is saved" do it "broadcasts ok" do expect { command.call }.to broadcast(:ok) end it "creates a new page with the same name as the feature" do expect(Page).to receive(:new).with(feature: feature).and_call_original expect do command.call end.to change { Page.count }.by(1) end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems