From a4eb892e1b80ed28f56fe1333e98e0b2731bc04d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Bol=C3=ADvar?= Date: Wed, 14 Feb 2024 13:29:26 +0100 Subject: [PATCH] Fix command specs --- spec/commands/create_minor_account_spec.rb | 9 ++++++--- spec/commands/update_minor_account_spec.rb | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/commands/create_minor_account_spec.rb b/spec/commands/create_minor_account_spec.rb index 83c978e..c687a95 100644 --- a/spec/commands/create_minor_account_spec.rb +++ b/spec/commands/create_minor_account_spec.rb @@ -5,10 +5,13 @@ module Decidim::Kids describe CreateMinorAccount do describe "call" do - let!(:current_user) { create(:user, :confirmed) } + let(:organization) { create :organization } + let!(:current_user) { create(:user, :confirmed, organization: organization) } let!(:form) do - Decidim::Kids::MinorAccountForm.from_params(form_params) + MinorAccountForm.from_params(form_params).with_context( + current_organization: organization + ) end let!(:command) { described_class.new(form, current_user) } @@ -17,7 +20,7 @@ module Decidim::Kids { name: "Mike", email: "test@example.com", - birthday: "01/11/2009", + birthday: "01/11/#{Time.zone.today.year - 12}", tos_agreement: true } end diff --git a/spec/commands/update_minor_account_spec.rb b/spec/commands/update_minor_account_spec.rb index 8e52334..917f099 100644 --- a/spec/commands/update_minor_account_spec.rb +++ b/spec/commands/update_minor_account_spec.rb @@ -16,6 +16,8 @@ module Decidim::Kids email: email, birthday: birthday, tos_agreement: tos_agreement + ).with_context( + current_organization: organization ) end