Sha256: f4540c52e747a04a14c7087e0bb76e0d81deb03efef1103547881d4cc4ea8a7c
Contents?: true
Size: 1.31 KB
Versions: 7
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true require "spec_helper" module Decidim module Admin describe UpdateStaticPage, :db do describe "call" do let(:organization) { create(:organization) } let(:page) { create(:static_page, organization: organization) } let(:form) do StaticPageForm.from_params( static_page: page.attributes.merge(slug: "new-slug") ).with_context( current_organization: page.organization ) end let(:command) { described_class.new(page, 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 update the page" do command.call page.reload expect(page.slug).not_to eq("new_slug") end end describe "when the form is valid" do it "broadcasts ok" do expect { command.call }.to broadcast(:ok) end it "updates the page in the organization" do command.call page.reload expect(page.slug).to eq("new-slug") end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems