Sha256: 117f35bed24a37928aa2a835ccfa6f98599e0a29d5c64625ec0176e46ccf5932
Contents?: true
Size: 1.14 KB
Versions: 9
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true require "spec_helper" module Decidim module Admin describe CreateStaticPage, :db do describe "call" do let(:organization) { create(:organization) } let(:form) { StaticPageForm.from_model(build(:static_page)).with_context(current_organization: organization) } let(:command) { described_class.new(form) } describe "when the form is not valid" do before do expect(form).to receive(:invalid?).and_return(true) 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 { StaticPage.count } end end describe "when the form is valid" do it "broadcasts ok" do expect { command.call }.to broadcast(:ok) end it "creates a page in the organization" do expect do command.call end.to change { organization.static_pages.count }.by(1) end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems