From 863bb805345d4c10e369efbb2eceda77cdb39d38 Mon Sep 17 00:00:00 2001 From: Anna Topalidi Date: Fri, 6 Sep 2024 09:21:17 +0200 Subject: [PATCH] fix admin specs --- .../app/commands/decidim/admin/create_share_token.rb | 4 ++-- .../app/commands/decidim/admin/update_share_token.rb | 2 +- decidim-admin/spec/forms/share_token_form_spec.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/decidim-admin/app/commands/decidim/admin/create_share_token.rb b/decidim-admin/app/commands/decidim/admin/create_share_token.rb index 099f4a9c637b5..821cc76a64d95 100644 --- a/decidim-admin/app/commands/decidim/admin/create_share_token.rb +++ b/decidim-admin/app/commands/decidim/admin/create_share_token.rb @@ -21,8 +21,8 @@ def initialize(form) def call return broadcast(:invalid) if form.invalid? - create_share_token - broadcast(:ok) + new_token = create_share_token + broadcast(:ok, new_token) end private diff --git a/decidim-admin/app/commands/decidim/admin/update_share_token.rb b/decidim-admin/app/commands/decidim/admin/update_share_token.rb index 26216668afcc8..1dc1f38076073 100644 --- a/decidim-admin/app/commands/decidim/admin/update_share_token.rb +++ b/decidim-admin/app/commands/decidim/admin/update_share_token.rb @@ -24,7 +24,7 @@ def call return broadcast(:invalid) if form.invalid? update_share_token - broadcast(:ok) + broadcast(:ok, token) end private diff --git a/decidim-admin/spec/forms/share_token_form_spec.rb b/decidim-admin/spec/forms/share_token_form_spec.rb index 472251fd12429..2b4a01fad17a7 100644 --- a/decidim-admin/spec/forms/share_token_form_spec.rb +++ b/decidim-admin/spec/forms/share_token_form_spec.rb @@ -42,7 +42,7 @@ module Decidim::Admin it "validates presence of token" do form.token = nil expect(form).to be_invalid - expect(form.errors[:token]).to include("cannot be blank") + expect(form.errors[:token]).to include("can't be blank") end context "when automatic_token is set" do @@ -60,7 +60,7 @@ module Decidim::Admin it "validates presence of expires_at" do expect(form).to be_invalid - expect(form.errors[:expires_at]).to include("cannot be blank") + expect(form.errors[:expires_at]).to include("can't be blank") end context "when no_expiration is set" do