Sha256: 9d04e73aa25538c2cc4be1914161208deb7c709475652451ffb7990d53bb5c67
Contents?: true
Size: 1.15 KB
Versions: 11
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true require "spec_helper" module Decidim module System describe CreateAdmin do describe "call" do let(:form) { AdminForm.new(params) } let(:command) { described_class.new(form) } describe "when the admin already exists" do before do create(:admin, email: "email@foo.bar") end let(:params) do { email: "email@foo.bar" } end it "broadcasts invalid" do expect { command.call }.to broadcast(:invalid) end end describe "when the admin doesn't exist" do before do create(:admin, email: "email@foo.bar") end let(:params) do { email: "different_email@foo.bar", password: "fake123", password_confirmation: "fake123" } end it "broadcasts ok and creates an admin" do expect { command.call }.to broadcast(:ok) expect(Admin.where(email: "different_email@foo.bar")).to exist end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems