Sha256: e1350bcab8705093e8cfbde910df36c02f5b809dfa0057606f4bec598ace82b7
Contents?: true
Size: 1.14 KB
Versions: 11
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true require "spec_helper" module Decidim module Admin describe CreateStaticPage 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
11 entries across 11 versions & 1 rubygems