Sha256: 26570d8afa56594810d3b00dfef30494191709ab31ad6c80999c3e82037b66ac
Contents?: true
Size: 1.12 KB
Versions: 1
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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-0.1.0 | decidim-pages/spec/commands/create_page_spec.rb |